From 0d17d7473a6614329275aa9a8d45b4507aa250a1 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 --- 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 ac45c9f698..eee23b435d 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -187,7 +187,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 2802a8b2f4..1d46427cc7 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -164,7 +164,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'), @@ -557,6 +556,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), ('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','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 8306a626fb..0077ccdc26 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 @@ -726,18 +726,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: yes: Allow no: "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 @@ -819,7 +819,7 @@ Circulation: choices: yes: Allow no: "Don't allow" - - expired holds to be canceled on days the library is closed.
NOTE: This will not apply if DisableReserveExpiration is enabled. + - expired holds to be canceled on days the library is closed.
NOTE: This will not apply if ReserveExpiration is disabled. - - pref: ExcludeHolidaysFromMaxPickUpDelay choices: @@ -895,11 +895,11 @@ Circulation: type: textarea syntax: text/x-yaml - - - 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 6dd456d5c3..2d5e45ce1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -449,7 +449,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 987a720993..4ae7334144 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -284,7 +284,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 587a6de1da..0b9d9347d0 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') ) { CancelExpiredReserves($reason); } diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t index 883f1f08c6..82201ae232 100755 --- a/t/db_dependent/Hold.t +++ b/t/db_dependent/Hold.t @@ -287,14 +287,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( @@ -307,7 +307,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 bada784c6a..4a79d18562 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -1217,11 +1217,11 @@ subtest 'MergeHolds' => sub { is( $biblio_2->holds->count, 1, 'Hold has been transferred' ); }; -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( @@ -1231,14 +1231,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