Ignore:
Timestamp:
06/01/12 15:53:54 (12 years ago)
Author:
natan
Message:

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

File:
1 edited

Legend:

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

    r6373 r6384  
    489489 
    490490                    if( $return === false ) 
    491                 return( false ); 
     491                        return( false ); 
    492492 
    493493                    if( isset($return) ) 
     
    535535        } 
    536536         
    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'] ] ); 
     537        public static function finalizeCommit( $method, $params, $original, $TX = array() ) 
     538        { 
     539            if( $TX !== false ) 
     540            { 
     541                $TX['rollback'] = !!!$params['properties']; 
     542 
     543                if( $params['properties'] && is_array($params['properties']) && isset($params['properties']['id']) ) 
     544                    $TX['id'] = $params['properties']['id']; 
     545 
     546                self::$tx[ $params['URI']['service'] ][] = array_merge( $TX, $original['URI'], array( 'service' => $params['URI']['service'], 'method' => $method ) ); 
    552547            } 
    553548 
     
    568563 
    569564                if( isset($params['URI']['concept'])  && !self::fire( 'before', $method, $params, $original ) ) 
    570                    return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
    571  
    572                  
     565                   return( self::finalizeCommit( $method, $params, $original ) ); 
    573566 
    574567                if( $params && !$params['service'] ) 
     
    592585 
    593586                    if( !self::fire( 'before', $method, $params, $original, true ) ) 
    594                         return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
     587                        return( self::finalizeCommit( $method, $params, $original, isset($TX) ? $TX : false ) ); 
    595588                } 
    596589 
     
    632625                if( isset($params['URI']['service']) ) 
    633626                    if( !self::fire( 'after', $method, $params, $original, true ) ) 
    634                         return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 
     627                        return( self::finalizeCommit( $method, $params, $original, isset($TX) ? $TX : false ) ); 
    635628 
    636629                if( isset($URI['concept']) ) 
     
    641634 
    642635                if( isset( $TX ) ) 
    643                     self::finalizeCommit( $TX, $params, $original, $method ); 
     636                { 
     637                    self::finalizeCommit( $params, $original, $method, $TX ); 
     638                     
     639                    if( isset($commit) && $commit ) 
     640                    { 
     641                        if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) ) 
     642                            self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] ); 
     643 
     644                        unset( self::$tx[ $params['URI']['service'] ] ); 
     645                    } 
     646                } 
    644647            } 
    645648            catch( Exception $e ) 
     
    726729                      $URI['id'] = $result['id']; 
    727730 
    728                 self::$tx[ $URI['service'] ][ count(self::$tx[ $URI['service'] ]) - 1 ]['order'] = $order; 
    729                 self::$tx[ $URI['service'] ][ count(self::$tx[ $URI['service'] ]) - 1 ]['id'] = $URI['id']; 
     731                $index =  count(self::$tx[ $URI['service'] ]) - 1; 
     732 
     733                self::$tx[ $URI['service'] ][ $index ]['order'] = $order; 
     734                self::$tx[ $URI['service'] ][ $index ]['id'] = $URI['id']; 
     735 
     736                if( !isset(self::$tx[ $URI['service'] ][ $index ]['concept']) ) 
     737                    self::$tx[ $URI['service'] ][ $index ]['concept'] = $URI['concept']; 
    730738 
    731739                foreach( $postpone as $linkTarget => $dt ) 
Note: See TracChangeset for help on using the changeset viewer.