Permalink
Browse files

PT17016201: Using Suspend All button in OPAC...

Appears the smart matching was not correctly being evaluated as
'W'aiting and 'T'ransit items were still being suspended.  The
croak error is also now being caught by Try::Tiny.
  • Loading branch information...
1 parent 59ce2c4 commit f8ae3e609514d7c3639f2a9ca81edd4e55a227e0 @dlbptfs dlbptfs committed with ctfliblime Sep 8, 2011
Showing with 9 additions and 4 deletions.
  1. +1 −1 C4/Reserves.pm
  2. +8 −3 opac/opac-modrequest.pl
View
@@ -2476,7 +2476,7 @@ sub SuspendReserve {
my $reserve = GetReserve($reservenumber);
croak sprintf 'Nonexistent reserve (%d)', $reservenumber unless $reserve;
- croak 'Cannot suspend waiting or in-transit holds' if ([qw(W T)] ~~ ($reserve->{found} // ''));
+ croak 'Cannot suspend waiting or in-transit holds' if ($reserve->{found} ~~ [qw(W T)]);
C4::Context->dbh->do(q{
UPDATE reserves SET
View
@@ -26,6 +26,7 @@
use warnings;
use CGI;
+use Try::Tiny;
use C4::Output;
use C4::Reserves;
use C4::Auth;
@@ -58,11 +59,15 @@
$resumedate = $parts[2] . '-' . $parts[0] . '-' . $parts[1];
}
- if ( $resumedate =~ m/^([0-9]{4})(?:(1[0-2]|0[1-9])|-?(1[0-2]|0[1-9])-?)(3[0-1]|0[1-9]|[1-2][0-9])$/ ) {
+ try {
+ if ( $resumedate =~ m/^([0-9]{4})(?:(1[0-2]|0[1-9])|-?(1[0-2]|0[1-9])-?)(3[0-1]|0[1-9]|[1-2][0-9])$/ ) {
SuspendReserve( $reservenumber[$i], $resumedate );
- } else {
+ } else {
SuspendReserve( $reservenumber[$i] );
- }
+ }
+ } catch {
+ warn "error caught: $_";
+ }
} elsif ($reservenumber[$i]) {
CancelReserve($reservenumber[$i]);
}

0 comments on commit f8ae3e6

Please sign in to comment.