Changeset 83 for LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
- Timestamp:
- 05/10/09 19:03:39 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
r77 r83 140 140 foreach my $uid (@lobjfrom) { 141 141 my $sobj = $self->from->get_object($otype, $uid); 142 if ($exists{$uid}) { 143 my %fields = map { $_ => $sobj->get_c_field($_, 'r') } @common_fields; 144 my $dobj = $destbase->get_object($otype, $uid); 145 $dobj->set_c_fields(%fields) unless($self->{options}{test}); 146 warn " $otype $uid: synched\n"; 147 } elsif (!$self->{options}{nocreate} && !$options{nocreate}) { 148 my %fields = map { $_ => $sobj->get_c_field($_, 'r') } @common_fields; 149 $destbase->create_c_object($otype, $uid, %fields) unless($self->{options}{test}); 150 warn " $otype $uid: created\n"; 151 } 142 $destbase->sync_object( 143 $sobj, 144 nocreate => ($self->{options}{nocreate} || $options{nocreate}), 145 ) unless($self->{options}{test}); 146 warn " $otype $uid: synched\n"; 152 147 } 153 148 } … … 172 167 } 173 168 169 sub sync_object { 170 my ($self, $otype, $uid) = @_; 171 my $sobj = $self->from->get_object($otype, $uid) or return; 172 foreach ($self->to) { 173 $_->sync_object($sobj) 174 } 175 foreach ($self->to) { 176 $_->commit; 177 } 178 1; 179 } 180 174 181 sub process { 175 182 my ($self) = @_;
Note: See TracChangeset
for help on using the changeset viewer.