From a94c0978ba2b52af56354e82b498ae49b8674cf9 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 19 Feb 2021 11:03:39 +1300 Subject: [PATCH] Bug 24194: (follow-up) Renaming syspref to ReserveExpiration Signed-off-by: David Nind https://bugs.koha-community.org/show_bug.cgi?id=24914 Signed-off-by: David Nind --- Koha/Hold.pm | 2 +- .../bug24194-add-DisableReserveExpiration-syspref.perl | 7 ------- .../bug24194-add-ReserveExpiration-syspref.perl | 7 +++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 16 ++++++++-------- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 2 +- misc/cronjobs/holds/cancel_expired_holds.pl | 2 +- t/db_dependent/Hold.t | 6 +++--- t/db_dependent/Reserves.t | 8 ++++---- 10 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl create mode 100644 installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.perl diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 49c708868f..8ef19de31a 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -185,7 +185,7 @@ sub set_waiting { desk_id => $desk_id, }; - if ( C4::Context->preference('DisableReserveExpiration') ){ + if ( !C4::Context->preference('ReserveExpiration') ){ $values->{expirationdate} = undef; } else { my $requested_expiration; diff --git a/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl b/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl deleted file mode 100644 index bed084b3ce..0000000000 --- a/installer/data/mysql/atomicupdate/bug24194-add-DisableReserveExpiration-syspref.perl +++ /dev/null @@ -1,7 +0,0 @@ -$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 holds module.", "YesNo" ) }); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24194 - DisableReserveExpiration system preference)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.perl b/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-syspref.perl new file mode 100644 index 0000000000..997334ae8e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug24194-add-ReserveExpiration-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 ( "ReserveExpiration", 1, NULL, "Disable the use of expiration date in holds module.", "YesNo" ) }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24194 - ReserveExpiration system preference)\n"; +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index f6cee4d560..c5744387d5 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -175,7 +175,6 @@ 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'), ('CSVDelimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), -('DisableReserveExpiration', 0, NULL, 'Disable the use of expiration date in holds module.', 'YesNo'), ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding staff interface 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'), @@ -564,6 +563,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ReplyToDefault','',NULL,'Use this email address as the replyto in emails','Free'), ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), ('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'), +('ReserveExpiration', 1, NULL, 'Disable the use of expiration date in holds module.', 'YesNo'), ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'), ('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','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 ae583ff669..37f4d72415 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 @@ -727,18 +727,18 @@ Circulation: - Mark a hold as problematic if it has been waiting for more than - pref: ReservesMaxPickUpDelay class: integer - - "days.
NOTE: If DisableReserveExpiration is enabled, holds marked as problematic must be dealt with manually as they will never automatically expire." + - "days.
NOTE: If ReserveExpiration is disabled, holds marked as problematic must be dealt with manually as they will never automatically expire." - - pref: ExpireReservesMaxPickUpDelay choices: 1: Allow 0: "Don't allow" - - 'holds to expire automatically if they have not been picked by within the time period specified in the ReservesMaxPickUpDelay system preference.
NOTE: This system preference requires the misc/cronjobs/holds/cancel_expired_holds.pl cronjob. Ask your system administrator to schedule it.
NOTE: This will not apply if DisableReserveExpiration is enabled.' + - 'holds to expire automatically if they have not been picked by within the time period specified in the ReservesMaxPickUpDelay system preference.
NOTE: This system preference requires the misc/cronjobs/holds/cancel_expired_holds.pl cronjob. Ask your system administrator to schedule it.
NOTE: This will not apply if ReserveExpiration is disabled."' - - If using ExpireReservesMaxPickUpDelay, charge a patron who allows their waiting hold to expire a fee of - pref: ExpireReservesMaxPickUpDelayCharge class: currency - - ".
NOTE: This will not apply if DisableReserveExpiration is enabled." + - ".
NOTE: This will not apply if ReserveExpiration is disabled." - - Satisfy holds using items from the libraries - pref: StaticHoldsQueueWeight @@ -821,7 +821,7 @@ Circulation: choices: 1: allow 0: "don't allow" - - expired holds to be canceled on days the library is closed per the calendar.
NOTE: This will not apply if DisableReserveExpiration is enabled. + - expired holds to be canceled on days the library is closed per the calendar.
NOTE: This will not apply if ReserveExpiration is disabled. - - pref: ExcludeHolidaysFromMaxPickUpDelay choices: @@ -916,11 +916,11 @@ Circulation: years: years - from reserve date. - - - pref: DisableReserveExpiration + - pref: ReserveExpiration choices: - yes: Disable - no: "Don't disable" - - the use of expiration dates in holds. This means patrons will not be able to specify a date when their hold is not needed, and any hold awaiting pickup will not automatically expire after it has been waiting for a problematic number of days. The expiration date will be hidden from both the OPAC and staff interface. + yes: Enable + no: "Disable" + - the use of expiration dates in holds. When enabled, patrons can specify a date when their hold is not needed, any hold awaiting pickup will automatically expire after it has been waiting for a problematic number of days, and expiration dates will show on both the OPAC and staff interface. Interlibrary loans: - - pref: ILLModule 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 93f57436e3..61be28aa23 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -522,7 +522,7 @@ [% END %] - [% UNLESS Koha.Preference('DisableReserveExpiration') %] + [% IF Koha.Preference('ReserveExpiration') %]
  • 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 75d7798cac..83f85e0712 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -286,7 +286,7 @@
  • [% END %] - [% IF !Koha.Preference('DisableReserveExpiration') %] + [% IF Koha.Preference('ReserveExpiration') %]
  • diff --git a/misc/cronjobs/holds/cancel_expired_holds.pl b/misc/cronjobs/holds/cancel_expired_holds.pl index 2c72d4b83c..36984873e2 100755 --- a/misc/cronjobs/holds/cancel_expired_holds.pl +++ b/misc/cronjobs/holds/cancel_expired_holds.pl @@ -80,6 +80,6 @@ pod2usage(1) if $help; cronlogaction(); -unless( C4::Context->preference('DisableReserveExpiration') ) { +if( C4::Context->preference('ReserveExpiration') ) { C4::Reserves::CancelExpiredReserves($reason); } diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t index 5f74973ba4..3d8fc35c1d 100755 --- a/t/db_dependent/Hold.t +++ b/t/db_dependent/Hold.t @@ -368,14 +368,14 @@ subtest 'suspend() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'DisableReserveExpiration syspref tests' => sub { +subtest 'ReserveExpiration syspref tests' => sub { plan tests => 2; $schema->storage->txn_begin; # Disable expiration date for reserves - t::lib::Mocks::mock_preference( 'DisableReserveExpiration', 1 ); + t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 ); my $expirationdate = dt_from_string->add( days => 1 ); my $hold = $builder->build_object( @@ -388,7 +388,7 @@ subtest 'DisableReserveExpiration syspref tests' => sub { is( $hold->expirationdate, undef, "No expiration date should be set with reserve expiration disabled" ); # Re-enable expiration date for reserves - t::lib::Mocks::mock_preference( 'DisableReserveExpiration', 0 ); + t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 ); $hold = $builder->build_object( { class => 'Koha::Holds', diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index bbac530212..6d9a4e0add 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -1332,11 +1332,11 @@ subtest 'ModReserveAffect logging' => sub { like( $log->info, qr{$expected}, 'Timestamp logged is the current one' ); }; -subtest 'DisableReserveExpiration syspref tests' => sub { +subtest 'ReserveExpiration syspref tests' => sub { plan tests => 2; - t::lib::Mocks::mock_preference( 'DisableReserveExpiration', 0 ); + t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 ); my $expirationdate = dt_from_string->add( days => 1 ); my $hold = $builder->build_object( @@ -1346,14 +1346,14 @@ subtest 'DisableReserveExpiration syspref tests' => sub { ); # Disable expiration date for reserves - t::lib::Mocks::mock_preference( 'DisableReserveExpiration', 1 ); + t::lib::Mocks::mock_preference( 'ReserveExpiration', 0 ); my $reverted = C4::Reserves::RevertWaitingStatus({ itemnumber => $hold->itemnumber }); is( $reverted->expirationdate, undef, "Expiration date should be removed with reserve expiration disabled" ); # Re-enable expiration date for reserves - t::lib::Mocks::mock_preference( 'DisableReserveExpiration', 0 ); + t::lib::Mocks::mock_preference( 'ReserveExpiration', 1 ); $hold = $builder->build_object( { class => 'Koha::Holds', -- 2.11.0