trucking along
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jul 2005 17:21:39 +0000 (17:21 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Jul 2005 17:21:39 +0000 (17:21 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1493 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index 9e79187..7cc1244 100644 (file)
@@ -525,10 +525,12 @@ sub _build_volume_list {
 
                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 );
index ecae5e0..6eb4ce8 100644 (file)
@@ -112,6 +112,58 @@ sub title_from_transaction {
 }
 
 
+__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"); }
+
+}
+
+
+
 
 
 
index 187e55c..e01d9a9 100644 (file)
@@ -965,12 +965,21 @@ __PACKAGE__->register_method(
        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;
 }