From adc61f01948c31e2eef38a7df867345aa6e49f33 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Tue, 3 Sep 2019 11:08:49 +0200 Subject: [PATCH] Bug 23531: fix ILSDI non-implemented but documented parameters test plan : 1/ Submit a hold through ILSDI with start_date and expiry_date parameters 2/ Verify in Koha those parameters are not applied to the newly created reserve. Delete reserve. 3/ Apply patch and repeat 1. 4/ Verify the reserve created by same request as 1 now has both dates applied and visible in Koha. Signed-off-by: Christophe Croullebois Signed-off-by: Arthur Suzuki Signed-off-by: David Nind Signed-off-by: Jonathan Druart --- C4/ILSDI/Services.pm | 58 +++++++++++++------ .../opac-tmpl/bootstrap/en/modules/ilsdi.tt | 8 +-- opac/ilsdi.pl | 4 +- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 1ed424e18a..23c4022700 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -673,9 +673,9 @@ Parameters: IP address where the end user request is being placed - pickup_location (Optional) a branch code indicating the location to which to deliver the item for pickup - - needed_before_date (Optional) - date after which hold request is no longer needed - - pickup_expiry_date (Optional) + - start_date (Optional) + date after which hold request is no longer needed if the document has not been made available + - expiry_date (Optional) date after which item returned to shelf if item is not picked up =cut @@ -728,6 +728,16 @@ sub HoldTitle { return { code => 'libraryNotPickupLocation' } unless $destination->pickup_location; return { code => 'cannotBeTransferred' } unless $biblio->can_be_transferred({ to => $destination }); + my $resdate; + if ( $cgi->param('start_date') ) { + $resdate = $cgi->param('start_date'); + } + + my $expdate; + if ( $cgi->param('expiry_date') ) { + $expdate = $cgi->param('expiry_date'); + } + # Add the reserve # $branch, $borrowernumber, $biblionumber, # $constraint, $bibitems, $priority, $resdate, $expdate, $notes, @@ -735,11 +745,13 @@ sub HoldTitle { my $priority= C4::Reserves::CalculatePriority( $biblionumber ); AddReserve( { - branch => $branch, - borrowernumber => $borrowernumber, - biblionumber => $biblionumber, - priority => $priority, - title => $title, + branch => $branch, + borrowernumber => $borrowernumber, + biblionumber => $biblionumber, + priority => $priority, + reservation_date => $resdate, + expiration_date => $expdate, + title => $title, } ); @@ -769,9 +781,9 @@ Parameters: an itemnumber - pickup_location (Optional) a branch code indicating the location to which to deliver the item for pickup - - needed_before_date (Optional) - date after which hold request is no longer needed - - pickup_expiry_date (Optional) + - start_date (Optional) + date after which hold request is no longer needed if the item has not been made available + - expiry_date (Optional) date after which item returned to shelf if item is not picked up =cut @@ -815,16 +827,28 @@ sub HoldItem { my $canitembereserved = C4::Reserves::CanItemBeReserved( $borrowernumber, $itemnumber, $branch )->{status}; return { code => $canitembereserved } unless $canitembereserved eq 'OK'; + my $resdate; + if ( $cgi->param('start_date') ) { + $resdate = $cgi->param('start_date'); + } + + my $expdate; + if ( $cgi->param('expiry_date') ) { + $expdate = $cgi->param('expiry_date'); + } + # Add the reserve my $priority = C4::Reserves::CalculatePriority($biblionumber); AddReserve( { - branch => $branch, - borrowernumber => $borrowernumber, - biblionumber => $biblionumber, - priority => $priority, - title => $title, - itemnumber => $itemnumber, + branch => $branch, + borrowernumber => $borrowernumber, + biblionumber => $biblionumber, + priority => $priority, + reservation_date => $resdate, + expiration_date => $expdate, + title => $title, + itemnumber => $itemnumber, } ); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt index dde7091850..0664a64f0f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt @@ -720,9 +720,9 @@
IP address where the end user request is being placed
pickup_location (Optional)
an identifier indicating the location to which to deliver the item for pickup
-
needed_before_date (Optional)
+
start_date (Optional)
date after which hold request is no longer needed
-
pickup_expiry_date (Optional)
+
expiry_date (Optional)
date after which item returned to shelf if item is not picked up

Example Call

@@ -751,9 +751,9 @@
the ILS identifier for the specific item on which the request is placed
pickup_location (Optional)
an identifier indicating the location to which to deliver the item for pickup
-
needed_before_date (Optional)
+
start_date (Optional)
date after which hold request is no longer needed
-
pickup_expiry_date (Optional)
+
expiry_date (Optional)
date after which item returned to shelf if item is not picked up

Example Call

diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl index 346f23e4ed..a3e9566b42 100755 --- a/opac/ilsdi.pl +++ b/opac/ilsdi.pl @@ -108,8 +108,8 @@ my %optional = ( 'GetPatronStatus' => [], 'GetServices' => [], 'RenewLoan' => ['desired_due_date'], - 'HoldTitle' => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ], - 'HoldItem' => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ], + 'HoldTitle' => [ 'pickup_location', 'start_date', 'expiry_date' ], + 'HoldItem' => [ 'pickup_location', 'start_date', 'expiry_date' ], 'CancelHold' => [], ); -- 2.20.1