Bugzilla – Attachment 100927 Details for
Bug 24194
Add system preference to disable the use of expiration dates for holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24194: Add DisableReserveExpiration system preference to hide expiration date options for reserves
Bug-24194-Add-DisableReserveExpiration-system-pref.patch (text/plain), 11.87 KB, created by
Aleisha Amohia
on 2020-03-17 22:41:42 UTC
(
hide
)
Description:
Bug 24194: Add DisableReserveExpiration system preference to hide expiration date options for reserves
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-03-17 22:41:42 UTC
Size:
11.87 KB
patch
obsolete
>From 30e9428b9760aefe6a1b4df764c670e2b31998f6 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 9 Dec 2019 04:33:42 +0000 >Subject: [PATCH] Bug 24194: Add DisableReserveExpiration system preference to > hide expiration date options for reserves > >To test: >1) Update database >2) Go to place a hold on any biblio in the staff intranet and confirm >you can see the 'Hold expires on date' field. >3) In another tab, go to place a hold on any biblio in the OPAC and >confirm you can see the 'Hold not needed after' field as an option. >4) In yet another tab, open the staff intranet and place a reserve for a user. Check it in and set the reserve as >waiting. Notice that an expiration date has now been generated for this >reserve. >5) Attempt to check out the item you reserved to some other borrower. >Revert waiting status. Notice that the expiration date that was >generated remains. >6) Go to Administration -> system preferences and set DisableReserveExpiration system preference to 'Disable' >7) Refresh the hold request page in the intranet. Confirm the expiration >date field disappears. >8) Refresh the hold request page in the OPAC. Confirm the expiration >date field disappears. >9) Place another reserve. Check it in and set the reserve as waiting. >Notice that no expiration date was generated for this reserve. >10) Attempt to check out the item you reserved to some other borrower. >Revert waiting status. The expiration date should remain null. > >Sponsored-by: Horowhenua Library Trust > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Reserves.pm | 28 +++++++++++++----- > Koha/Hold.pm | 34 ++++++++++++---------- > ...24194-add-DisableReserveExpiration-syspref.perl | 7 +++++ > installer/data/mysql/sysprefs.sql | 1 + > .../en/modules/admin/preferences/circulation.pref | 6 ++++ > .../prog/en/modules/reserve/request.tt | 14 +++++---- > .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 12 ++++---- > 7 files changed, 67 insertions(+), 35 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 00d921d..7e7002b 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1987,14 +1987,26 @@ sub RevertWaitingStatus { > $sth = $dbh->prepare( $query ); > $sth->execute( $reserve->{'biblionumber'} ); > >- $hold->set( >- { >- priority => 1, >- found => undef, >- waitingdate => undef, >- itemnumber => $hold->item_level_hold ? $hold->itemnumber : undef, >- } >- )->store(); >+ if ( C4::Context->preference('DisableReserveExpiration') ){ >+ $hold->set( >+ { >+ priority => 1, >+ found => undef, >+ waitingdate => undef, >+ expirationdate => undef, >+ itemnumber => $hold->item_level_hold ? $hold->itemnumber : undef, >+ } >+ )->store(); >+ } else { >+ $hold->set( >+ { >+ priority => 1, >+ found => undef, >+ waitingdate => undef, >+ itemnumber => $hold->item_level_hold ? $hold->itemnumber : undef, >+ } >+ )->store(); >+ } > > _FixPriority( { biblionumber => $reserve->{biblionumber} } ); > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 6896f5e..6d88200 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -171,27 +171,29 @@ sub set_waiting { > waitingdate => $today->ymd, > }; > >- my $requested_expiration; >- if ($self->expirationdate) { >- $requested_expiration = dt_from_string($self->expirationdate); >- } >+ unless ( C4::Context->preference('DisableReserveExpiration') ){ >+ my $requested_expiration; >+ if ($self->expirationdate) { >+ $requested_expiration = dt_from_string($self->expirationdate); >+ } >+ >+ 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 $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >- my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >- my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); >+ my $expirationdate = $today->clone; >+ $expirationdate->add(days => $max_pickup_delay); > >- my $expirationdate = $today->clone; >- $expirationdate->add(days => $max_pickup_delay); >+ if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >+ $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); >+ } > >- 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; > } > >- # 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(); > > return $self; >diff --git a/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl b/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl >new file mode 100644 >index 0000000..a5fe773 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl >@@ -0,0 +1,7 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ( "DisableReserveExpiration", 0, NULL, "Disable the use of expiration date in reserves module.", "YesNo" ) }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 24194 - DisableReserveExpiration system preference)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index fc6cb88..df80c6c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -155,6 +155,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('DefaultToLoggedInLibraryNoticesSlips', '0', NULL , 'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), > ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), > ('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), >+('DisableReserveExpiration', 0, NULL, 'Disable the use of expiration date in reserves module.', 'YesNo'), > ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'), > ('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'), > ('displayFacetCount','0',NULL,NULL,'YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 3134f23..31e47a7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -156,6 +156,12 @@ Circulation: > yes: Allow > no: "Don't allow" > - patrons to submit notes about checked out items. >+ - >+ - pref: DisableReserveExpiration >+ choices: >+ yes: Disable >+ no: "Don't disable" >+ - the use of expiration dates in reserves. > > Checkout Policy: > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 3ee726c..6ce76be 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -453,12 +453,14 @@ > </li> > [% END %] > >- <li> >- <label for="to">Hold expires on date:</label> >- <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> >- <input type="hidden" class="datepickerto_hidden" /> >- <a href="#" id="clear-date-to" class="clear-date">Clear date</a> >- </li> >+ [% IF !Koha.Preference('DisableReserveExpiration') %] >+ <li> >+ <label for="to">Hold expires on date:</label> >+ <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> >+ <input type="hidden" class="datepickerto_hidden" /> >+ <a href="#" id="clear-date-to" class="clear-date">Clear date</a> >+ </li> >+ [% END %] > > [% UNLESS ( multi_hold ) %] > <li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index d637f70..3e19085 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -278,11 +278,13 @@ > </li> > [% END %] > >- <li> >- <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label> >- <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" /> >- <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span> >- </li> >+ [% IF !Koha.Preference('DisableReserveExpiration') %] >+ <li> >+ <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label> >+ <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="holddateto" /> >+ <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span> >+ </li> >+ [% END %] > > [% IF Koha.Preference('AllowHoldItemTypeSelection') %] > [% itemtypes = [] %] >-- >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 24194
:
96120
|
96121
|
98048
|
98368
|
100927
|
110082
|
110127
|
111443
|
113284
|
113285
|
116626
|
116627
|
117016
|
117085
|
117089
|
117097
|
117098
|
117099
|
117100
|
117101
|
118258
|
118259
|
118260
|
118261
|
118262
|
118263
|
128301
|
128302
|
128303
|
128304
|
128305
|
128306
|
128307
|
128308
|
140646
|
140647
|
144076
|
147527
|
147528
|
150799
|
150800
|
159060
|
159061
|
167796
|
167797
|
169174
|
174650
|
174651
|
174652