Bug 20724: Correctly mark an hold as waiting - ReservesNeedReturns
authorKyle M Hall <kyle@bywatetsolutions.com>
Thu, 10 May 2018 12:12:04 +0000 (08:12 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 24 Sep 2018 13:07:17 +0000 (15:07 +0200)
We need to call Koha::Hold->set_waiting to correctly
calculate the expiration date.

It fixes a regression introduced by
  commit 26634151dbce0bf39ff6c9eda5b58bb993996a2d
  Bug 12063 - Fix QA failures

The expiration date has to be set for waiting holds

== Test plan (time to execute: less than 4min) ==
1. Set ReservesNeedReturns to "Don't automatically"
2. Place a hold on a specific item
3. Check it in and confirm hold
4. The hold should have an expiration date
     record page → Hold → "Expiration" column
5. It should be listed in staff:/cgi-bin/koha/circ/waitingreserves.pl
6. Set ReservesNeedReturns to "Automatically"
7. Place a hold on a specific item
    (which should also behave like we check the item in to
    keep it for the patron)
8. The hold should have an *empty* expiration date
     record page → Hold → "Expiration" column
9. Holds awaiting pickup page should crash
     staff:/cgi-bin/koha/circ/waitingreserves.pl
10. Cancel the hold to remove the corrupted data
     record page → Hold → the red X
11. Apply this patch
12. Place a hold on a specific item
13. The hold should have an expiration date (not empty)
14. It should be listed in staff:/cgi-bin/koha/circ/waitingreserves.pl
15. Celebrate!

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c585f1149770ec401f188e061211501897cec0bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2d3b25b04ea6a47ed0f5ebdc3e10fb16b474184f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

C4/Reserves.pm

index d763937..2f480ca 100644 (file)
@@ -210,6 +210,7 @@ sub AddReserve {
             itemtype       => $itemtype,
         }
     )->store();
+    $hold->set_waiting() if $found eq 'W';
 
     logaction( 'HOLDS', 'CREATE', $hold->id, Dumper($hold->unblessed) )
         if C4::Context->preference('HoldsLog');