Changeset 1182 for trunk/LATMOS-Accounts/lib/LATMOS
- Timestamp:
- 10/01/12 18:14:22 (12 years ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm
r1113 r1182 79 79 } 80 80 return($old || 0); 81 } 82 83 =head2 temp_switch_unexported($CODE, $value) 84 85 Switch the base to unexported mode given by C<$value>, run C<$CODE>, restore 86 back the previous state and return the result of code ref. 87 88 =cut 89 90 sub temp_switch_unexported (&;$) { 91 my ($self, $sub, $value) = @_; 92 93 my $old = $self->unexported($value || 0); 94 my $res = $sub->(); 95 $self->unexported($old); 96 return $res; 81 97 } 82 98 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r1181 r1182 534 534 $field, $min, $max); 535 535 my %existsid; 536 my $oldunexported = $base->unexported(1);537 foreach ($base->list_objects($class->type)) {538 my $obj = $base->get_object($class->type, $_) or next;539 my $id = $obj->_get_c_field($field) or next;540 $existsid{$id + 0} = 1;541 }542 $base->unexported($oldunexported);536 $base->temp_switch_unexported(sub { 537 foreach ($base->list_objects($class->type)) { 538 my $obj = $base->get_object($class->type, $_) or next; 539 my $id = $obj->_get_c_field($field) or next; 540 $existsid{$id + 0} = 1; 541 } 542 }, 1); 543 543 $min += 0; 544 544 $max += 0;
Note: See TracChangeset
for help on using the changeset viewer.