Bug 22922: Allow to modify hold dates on reserve/request.pl
authorJulian Maurice <julian.maurice@biblibre.com>
Tue, 14 May 2019 14:42:24 +0000 (16:42 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 21 Oct 2019 09:00:36 +0000 (10:00 +0100)
Test plan:
1. Place some holds
2. Go to the 'Holds' tab of the biblio record
3. Modify dates in the table and click on 'Update holds' button
4. Verify that dates have been correctly updated

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Reserves.pm
koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc
reserve/modrequest.pl
reserve/request.pl

index 2a77c3d..8f14b29 100644 (file)
@@ -906,6 +906,8 @@ sub ModReserve {
 
     my $rank = $params->{'rank'};
     my $reserve_id = $params->{'reserve_id'};
+    my $reservedate = $params->{reservedate} || undef;
+    my $expirationdate = $params->{expirationdate} || undef;
     my $branchcode = $params->{'branchcode'};
     my $itemnumber = $params->{'itemnumber'};
     my $suspend_until = $params->{'suspend_until'};
@@ -937,6 +939,8 @@ sub ModReserve {
         $hold->set(
             {
                 priority    => $rank,
+                reservedate => $reservedate,
+                expirationdate => $expirationdate,
                 branchcode  => $branchcode,
                 itemnumber  => $itemnumber,
                 found       => undef,
index c40d3e6..77c49e1 100644 (file)
             </td>
 
             <td>[% hold.notes | html %]</td>
-            <td>[% hold.date | html %]</td>
-            <td>[% hold.expirationdate | html %]</td>
+            <td><input type="date" value="[% hold.date | html %]" required name="reservedate"></td>
+            <td><input type="date" value="[% hold.expirationdate | html %]" name="expirationdate"></td>
 
             <td>
                 [% IF ( hold.found ) %]
index 0d1b2d0..7e2c189 100755 (executable)
@@ -44,6 +44,8 @@ my @reserve_id = $query->multi_param('reserve_id');
 my @rank = $query->multi_param('rank-request');
 my @biblionumber = $query->multi_param('biblionumber');
 my @borrower = $query->multi_param('borrowernumber');
+my @reservedates = $query->multi_param('reservedate');
+my @expirationdates = $query->multi_param('expirationdate');
 my @branch = $query->multi_param('pickup');
 my @itemnumber = $query->multi_param('itemnumber');
 my @suspend_until=$query->multi_param('suspend_until');
@@ -70,6 +72,8 @@ else {
         ModReserve({
             rank => $rank[$i],
             reserve_id => $reserve_id[$i],
+            reservedate => $reservedates[$i],
+            expirationdate => $expirationdates[$i],
             branchcode => $branch[$i],
             itemnumber => $itemnumber[$i],
             suspend_until => $suspend_until[$i]
index c783243..c501482 100755 (executable)
@@ -661,9 +661,8 @@ foreach my $biblionumber (@biblionumbers) {
             }
         }
 
-        $reserve{'expirationdate'} = output_pref( { dt => dt_from_string( $res->expirationdate ), dateonly => 1 } )
-          unless ( !defined( $res->expirationdate ) || $res->expirationdate eq '0000-00-00' );
-        $reserve{'date'}           = output_pref( { dt => dt_from_string( $res->reservedate ), dateonly => 1 } );
+        $reserve{'expirationdate'} = $res->expirationdate;
+        $reserve{'date'}           = $res->reservedate;
         $reserve{'borrowernumber'} = $res->borrowernumber();
         $reserve{'biblionumber'}   = $res->biblionumber();
         $reserve{'patron'}         = $res->borrower;