added simple mark-damaged/mark-missing api - unused, needs testing and probably some...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Aug 2006 16:44:25 +0000 (16:44 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Aug 2006 16:44:25 +0000 (16:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5490 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ.pm

index 743e243..d8b98a1 100644 (file)
@@ -751,4 +751,40 @@ sub copy_details {
 
 
 
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_damaged',
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_missing',
+);
+
+sub mark_item {
+       my( $self, $conn, $auth, $copy_id ) = @_;
+       my $e = new_editor(authtoken=>$auth, xact =>1);
+       return $e->event unless $e->checkauth;
+
+       my $perm = 'MARK_ITEM_MISSING';
+       my $stat = OILS_COPY_STATUS_MISSING;
+
+       if( $self->api_name =~ /damaged/ ) {
+               $perm = 'MARK_ITEM_DAMAGED';
+               $stat = OILS_COPY_STATUS_DAMAGED;
+       }
+
+       my $copy = $e->retrieve_asset_copy($copy_id)
+               or return $e->event;
+       $copy->status($stat);
+
+       $e->update_asset_copy($copy) or return $e->event;
+
+       $e->commit;
+       return 1;
+}
+
+
+
+
+
 1;