warn "Grabbing copies for volume: " . $volume->id . "\n";
my $creq = $session->request(
- "open-ils.storage.direct.asset.copy.search.call_number.atomic",
- $volume->id );
+ "open-ils.storage.direct.asset.copy.search.call_number.atomic", $volume->id );
+
my $copies = $creq->gather(1);
+ $copies = [ sort { $a->barcode cmp $b->barcode } @$copies ];
+
$volume->copies($copies);
push( @volumes, $volume );
}
+__PACKAGE__->register_method(
+ method => "set_circ_lost",
+ api_name => "open-ils.circ.circulation.set_lost",
+ NOTES => <<" NOTES");
+ Params are login, circid
+ login must have SET_CIRC_LOST perms
+ Sets a circulation to lost
+ NOTES
+
+__PACKAGE__->register_method(
+ method => "set_circ_lost",
+ api_name => "open-ils.circ.circulation.set_claims_returned",
+ NOTES => <<" NOTES");
+ Params are login, circid
+ login must have SET_CIRC_MISSING perms
+ Sets a circulation to lost
+ NOTES
+
+sub set_circ_lost {
+ my( $self, $client, $login, $circid ) = @_;
+
+ my $user = $apputils->check_user_session($login);
+ my $session = OpenSRF::AppSession->create('open-ils.storage');
+ my $circ = $session->request(
+ "open-ils.storage.direct.action.circulation.retrieve", $circid )->gather(1);
+
+ if(!$circ) { throw OpenSRF::EX::ERROR ("No circulation exists with id $circid"); }
+
+ if($self->api_name =~ /lost/) {
+ if($apputils->check_user_perms($user->id, $circ->circ_lib, "SET_CIRC_LOST")) {
+ return OpenILS::Perm->new("SET_CIRC_LOST");
+ }
+ $circ->stop_fines("LOST");
+ }
+
+ if($self->api_name =~ /claims_returned/) {
+ if($apputils->check_user_perms($user->id, $circ->circ_lib, "SET_CIRC_CLAIMS_RETURNED")) {
+ return OpenILS::Perm->new("SET_CIRC_CLAIMS_RETURNED");
+ }
+ $circ->stop_fines("CLAIMSRETURNED");
+ }
+
+
+ my $s = $session->request(
+ "open-ils.storage.direct.action.circulation.update", $circ )->gather(1);
+
+ if(!$s) { throw OpenSRF::EX::ERROR ("Error updating circulation with id $circid"); }
+
+}
+
+
+
method => "copy_counts_per_org",
api_name => "open-ils.search.biblio.copy_counts.retrieve");
+__PACKAGE__->register_method(
+ method => "copy_counts_per_org",
+ api_name => "open-ils.search.biblio.copy_counts.retrieve.staff");
+
sub copy_counts_per_org {
my( $self, $client, $record_id ) = @_;
+
+ warn "Retreiveing copy copy counts for record $record_id and method " . $self->api_name . "\n";
+
+ my $method = "open-ils.storage.biblio.record_entry.global_copy_count.atomic";
+ if($self->api_name =~ /staff/) { $method =~ s/atomic/staff\.atomic/; }
+
my $counts = $apputils->simple_scalar_request(
- "open-ils.storage",
- "open-ils.storage.biblio.record_entry.global_copy_count.atomic",
- $record_id );
+ "open-ils.storage", $method, $record_id );
+
$counts = [ sort {$a->[0] <=> $b->[0]} @$counts ];
return $counts;
}