Bugzilla – Attachment 67428 Details for
Bug 19260
Reservations / holds marked as problems being seen as expired ones and deleted wrongly.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19260 - Restore ExpireReservesMaxPickupDelay
Bug-19260---Restore-ExpireReservesMaxPickupDelay.patch (text/plain), 3.30 KB, created by
Magnus Enger
on 2017-09-28 11:29:20 UTC
(
hide
)
Description:
Bug 19260 - Restore ExpireReservesMaxPickupDelay
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2017-09-28 11:29:20 UTC
Size:
3.30 KB
patch
obsolete
>From 3cbc39572104fb938ba22ff75e5cc67152e79019 Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Thu, 28 Sep 2017 11:19:09 +0000 >Subject: [PATCH] Bug 19260 - Restore ExpireReservesMaxPickupDelay > >It looks like bug 12063 accidentally removed the functionality of >ExpireReservesMaxPickupDelay. This patch aims to restore it. > >To test: > >Before applying the patch: >- Make sure ExpireReservesMaxPickUpDelay = "Don't allow" >- Check out a book to a user >- Add a reservastion on it for another user >- Check the hold in the database. You should have: > found = W, waitingdate = today, expirationdate = today + the value of > ReservesMaxPickUpDelay > >The problem here is the expirationdate, it should be empty when >ExpireReservesMaxPickUpDelay = "Don't allow". > >After applying the patch: >- Repeat the steps above >- expirationdate should now be NULL > >Please be creative when testing this. I am not sure I have seen >all the possible concequences. >--- > Koha/Hold.pm | 36 ++++++++++++++++++++---------------- > 1 file changed, 20 insertions(+), 16 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index d27bbae..7905c39 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -129,26 +129,30 @@ sub set_waiting { > waitingdate => $today->ymd, > }; > >- my $requested_expiration; >- if ($self->expirationdate) { >- $requested_expiration = dt_from_string($self->expirationdate); >- } >+ if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) { > >- my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >- my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >- my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); >+ my $requested_expiration; >+ if ($self->expirationdate) { >+ $requested_expiration = dt_from_string($self->expirationdate); >+ } > >- my $expirationdate = $today->clone; >- $expirationdate->add(days => $max_pickup_delay); >+ my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >+ my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >+ my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); > >- if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >- $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); >- } >+ my $expirationdate = $today->clone; >+ $expirationdate->add(days => $max_pickup_delay); > >- # If patron's requested expiration date is prior to the >- # calculated one, we keep the patron's one. >- my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >- $values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; >+ if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >+ $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); >+ } >+ >+ # If patron's requested expiration date is prior to the >+ # calculated one, we keep the patron's one. >+ my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >+ $values->{expirationdate} = $cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd; >+ >+ } > > $self->set($values)->store(); > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19260
:
67428
|
67489
|
67653
|
67654
|
67659
|
67660
|
67677
|
67678
|
67679
|
67680
|
67733
|
67992
|
67993
|
67994
|
67995