Changeset 565
- Timestamp:
- 12/17/09 15:57:06 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Onlyaddress.pm
r445 r565 29 29 } 30 30 31 sub list_from_rev { 32 my ($class, $base, $rev) = @_; 33 34 my $sth = $base->db->prepare_cached( 35 sprintf( 36 q{select %s as k from %s where ikey not in (select okey from %s 37 where attr = 'isMainAddress') and rev > ? %s order by %s}, 38 $base->db->quote_identifier($class->key_field), 39 $base->db->quote_identifier($class->object_table), 40 $base->db->quote_identifier($class->object_table. '_attributes'), # attr 41 ($base->{wexported} ? '' : 'and exported = true'), 42 $base->db->quote_identifier($class->key_field), 43 ) 44 ); 45 $sth->execute($rev); 46 my @keys; 47 while(my $res = $sth->fetchrow_hashref) { 48 push(@keys, $res->{k}); 49 } 50 @keys 51 } 52 53 sub new { 54 my ($class, $base, $id) = @_; 55 my $sth = $base->db->prepare_cached( 56 sprintf(q{select 1 from %s where %s = ? %s and ikey not in (select okey from %s where attr = 'isMainAddress')}, 57 $base->db->quote_identifier($class->object_table), 58 $base->db->quote_identifier($class->key_field), 59 ($base->{wexported} ? '' : 'and exported = true'), 60 $base->db->quote_identifier($class->object_table. '_attributes'), 61 ), 62 ); 63 my $count = $sth->execute($id); 64 $sth->finish; 65 $count == 1 or return; 66 $class->SUPER::new($base, $id); 67 } 68 31 69 1; -
LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
r564 r565 218 218 foreach my $ba (@concerned_bases) { 219 219 foreach ($ba->list_objects($otype)) { 220 $ba->sync_object_from($self->from, $otype, $_, %options) 221 if(!$existing{$_}); 220 if(!$existing{$_}) { 221 my $res = $ba->sync_object_from($self->from, $otype, $_, %options); 222 la_log(LA_NOTICE, "%s::%s::%s => %s %s", 223 $self->from->label, $otype, $_, $ba->label, $res, 224 ) if ($res); 225 } 222 226 } 223 227 } … … 228 232 foreach my $otype ($self->from->list_supported_objects) { 229 233 foreach my $destbase ($self->to) { 234 warn $self->val($self->from->label, $destbase->label, 0); 230 235 my @lobjfrom = $self->from->list_objects_from_rev( 231 236 $otype, 232 $self->val($self->from->label, $destbase->label ) || 0,237 $self->val($self->from->label, $destbase->label, 0), 233 238 ); 234 239 foreach (@lobjfrom) {
Note: See TracChangeset
for help on using the changeset viewer.