Changeset 2408


Ignore:
Timestamp:
06/23/20 00:45:44 (4 years ago)
Author:
nanardon
Message:

Always try to sync missing object in destination base

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm

    r2175 r2408  
    294294                $filtering{$otype} = { map { $_ => 1 } 
    295295                    $self->from->search_objects($otype, $filter, 'oalias=NULL') }; 
    296             } else { 
    297                 $filtering{$otype} = $existings{$otype}; 
    298296            } 
    299297 
     
    321319            foreach ($destbase->listRealObjects($otype)) { 
    322320 
    323                 if ($filtering{$otype}{$_}) { 
     321                if ($filtering{$otype}{$_} || $existings{$otype}{$_}) { 
    324322                    # the object must exists 
    325323                    next; 
     
    350348 
    351349            # Finding object to synchronize: 
    352             @{$objlist{$otype}} = grep { $filtering{$otype}{$_} } $self->from->list_objects_from_rev( 
    353                 $otype, 
    354                 $self->val($self->from->label, $destbase->label, 0), 
    355             ); 
     350            { 
     351                my %ObjList = (); 
     352 
     353                # Objects to refresh 
     354                $ObjList{ $_ } = 1 foreach(grep { $filtering{$otype}{$_} } $self->from->list_objects_from_rev( 
     355                    $otype, 
     356                    $self->val($self->from->label, $destbase->label, 0), 
     357                )); 
     358 
     359                my %destExists = ( map { $_ => 1 } 
     360                    $destbase->listRealObjects($otype) ); 
     361 
     362                # Objects missing in dest, we try to sync it 
     363                foreach (keys %{ $existings{ $otype } || {} }) { 
     364                    $destExists{ $_ } and next; 
     365                    $filtering{$otype}{$_} and next; 
     366                    $ObjList{ $_ } = 1; 
     367                } 
     368 
     369                @{$objlist{$otype}} = sort keys %ObjList; 
     370            } 
    356371        } 
    357372 
Note: See TracChangeset for help on using the changeset viewer.