changed duplicate holds test to look at formats for MR holds
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Jun 2006 20:37:42 +0000 (20:37 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Jun 2006 20:37:42 +0000 (20:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4660 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index de6f86b..1df5a39 100644 (file)
@@ -91,15 +91,16 @@ sub create_hold {
                my $t                   = $hold->hold_type;
 
                # See if a duplicate hold already exists
-               my $existing = $e->search_action_hold_request( 
-                       {
-                               usr                     => $recipient->id
-                               hold_type       => $t
-                               fulfillment_time => undef, 
-                               target          => $hold->target
-                       }
-               );
+               my $sargs = {
+                       usr                     => $recipient->id, 
+                       hold_type       => $t
+                       fulfillment_time => undef
+                       target          => $hold->target
+               };
+
+               $sargs->{holdable_formats} = $hold->holdable_formats if $t eq 'M';
                        
+               my $existing = $e->search_action_hold_request($sargs); 
                my $eevt = OpenILS::Event->new('HOLD_EXISTS') if @$existing;
 
                if( $t eq 'M' ) { $pevt = $e->event unless $e->checkperm($pid, $porg, 'MR_HOLDS'); }