delete hold_copy_maps on hold cancel and hold fulfillment time
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Aug 2006 17:57:19 +0000 (17:57 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Aug 2006 17:57:19 +0000 (17:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5409 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index d12b232..799e3f7 100644 (file)
@@ -845,6 +845,8 @@ sub handle_checkout_holds {
                        return $self->bail_on_events($self->editor->event)
                                unless $self->editor->update_action_hold_request($hold);
 
+                       $holdcode->delete_hold_copy_maps($self->editor, $hold->id);
+
          push( @fulfilled, $hold->id );
       }
 
index 85d9a96..0d0a5d0 100644 (file)
@@ -417,10 +417,25 @@ sub cancel_hold {
        $e->update_action_hold_request($hold)
                or return $e->event;
 
+       $self->delete_hold_copy_maps($e, $hold->id);
+
        $e->commit;
        return 1;
 }
 
+sub delete_hold_copy_maps {
+       my $class = shift;
+       my $editor = shift;
+       my $holdid = shift;
+
+       my $maps = $editor->search_action_hold_copy_map({hold=>$holdid});
+       for(@$maps) {
+               $editor->delete_action_hold_copy_map($_) 
+                       or return $editor->event;
+       }
+       return undef;
+}
+
 
 __PACKAGE__->register_method(
        method  => "update_hold",