Changeset 6373


Ignore:
Timestamp:
06/01/12 02:21:15 (12 years ago)
Author:
natan
Message:

Ticket #2824 - Problema ao sinalizar uma mensagem depois de excluir uma regra de filtro. - Corrigido

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/api/controller.php

    r6328 r6373  
    534534            return( $URI ); 
    535535        } 
     536         
     537        public static function finalizeCommit( $TX, $params, $original, $method ) 
     538        { 
     539            $TX['rollback'] = !!!$params['properties']; 
     540 
     541            if( $params['properties'] && is_array($params['properties']) && isset($params['properties']['id']) ) 
     542                $TX['id'] = $params['properties']['id']; 
     543 
     544            self::$tx[ $params['URI']['service'] ][] = array_merge( $TX, $original['URI'], array( 'service' => $params['URI']['service'], 'method' => $method ) ); 
     545 
     546            if( isset($commit) && $commit ) 
     547            { 
     548                if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) ) 
     549                    self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] ); 
     550 
     551                unset( self::$tx[ $params['URI']['service'] ] ); 
     552            } 
     553 
     554            return( empty($params['properties']) ? false : $params['properties'] ); 
     555        } 
    536556 
    537557        //TODO: Compatibilizar as configs relativas aos modulos, adicionando os mesmos nas options passadas 
     
    548568 
    549569                if( isset($params['URI']['concept'])  && !self::fire( 'before', $method, $params, $original ) ) 
    550                     return( empty($params['properties']) ? false : $params['properties'] ); 
     570                   return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
    551571 
    552572                 
     
    572592 
    573593                    if( !self::fire( 'before', $method, $params, $original, true ) ) 
    574                         return( empty($params['properties']) ? false : $params['properties'] ); 
     594                        return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
    575595                } 
    576596 
     
    612632                if( isset($params['URI']['service']) ) 
    613633                    if( !self::fire( 'after', $method, $params, $original, true ) ) 
    614                         return( empty($params['properties']) ? false : $params['properties'] ); 
     634                        return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
    615635 
    616636                if( isset($URI['concept']) ) 
     
    621641 
    622642                if( isset( $TX ) ) 
    623                 { 
    624                     $TX['rollback'] = !!!$params['properties']; 
    625  
    626                     if( $params['properties'] && is_array($params['properties']) && isset($params['properties']['id']) ) 
    627                         $TX['id'] = $params['properties']['id']; 
    628  
    629                     self::$tx[ $params['URI']['service'] ][] = array_merge( $TX, $original['URI'], array( 'service' => $params['URI']['service'], 'method' => $method ) ); 
    630  
    631                     if( isset($commit) && $commit ) 
    632                     { 
    633                         if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) ) 
    634                             self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] ); 
    635  
    636                         unset( self::$tx[ $params['URI']['service'] ] ); 
    637                     } 
    638                 } 
     643                    self::finalizeCommit( $TX, $params, $original, $method ); 
    639644            } 
    640645            catch( Exception $e ) 
Note: See TracChangeset for help on using the changeset viewer.