From 8cb92b7feafc79e04248c81d2f9d74df319dfd4c Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 12 Oct 2023 22:37:58 +0000 Subject: [PATCH] Bug 32776: Terminology: Reserves to Holds The syspref is now called ConvertSelectedHoldsToRecalls The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl --- ..._-_add_ConvertSelectedHoldsToRecalls_syspref.pl | 14 ++++++++++++++ ...add_ConvertSelectedReservesToRecalls_syspref.pl | 14 -------------- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../en/modules/admin/preferences/circulation.pref | 10 +++++----- misc/cronjobs/recalls/convert_holds_to_recalls.pl | 14 +++++++------- 5 files changed, 27 insertions(+), 27 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedHoldsToRecalls_syspref.pl delete mode 100644 installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedReservesToRecalls_syspref.pl diff --git a/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedHoldsToRecalls_syspref.pl b/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedHoldsToRecalls_syspref.pl new file mode 100755 index 00000000000..a1cb83c122d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedHoldsToRecalls_syspref.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "32776", + description => "Convert selected reserves to recalls", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('ConvertSelectedHoldsToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice') }); + + say $out "Added system preference 'ConvertSelectedHoldsToRecalls'"; + }, +}; diff --git a/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedReservesToRecalls_syspref.pl b/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedReservesToRecalls_syspref.pl deleted file mode 100644 index b53de318836..00000000000 --- a/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedReservesToRecalls_syspref.pl +++ /dev/null @@ -1,14 +0,0 @@ -use Modern::Perl; - -return { - bug_number => "32776", - description => "Convert selected reserves to recalls", - up => sub { - my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; - - $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('ConvertSelectedReservesToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice') }); - - say $out "Added system preference 'ConvertSelectedReservesToRecalls'"; - }, -}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index c29b1684288..7665ba34ea1 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -161,7 +161,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'), ('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'), ('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'), -('ConvertSelectedReservesToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice'), +('ConvertSelectedHoldsToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_holds_to_recalls.pl cronjob should convert only the oldest hold on the record to a recall, or one hold for each item available to be recalled', 'Choice'), ('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'), ('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'), ('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', '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 6b36e7d798d..c0ded505710 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 @@ -1358,13 +1358,13 @@ Circulation: - . (Requires UseRecalls.) - - Automatically convert - - pref: ConvertSelectedReservesToRecalls + - pref: ConvertedSelectedHoldsToRecalls default: oldest choices: - oldest: the oldest reserve placed on the record - recallable: one reserve for each item available to be recalled - - to a recall, once a specific number of reserves have been requested on the record. - - This system preference is used by the convert_reserves_to_recalls.pl cronjob. + oldest: the oldest hold placed on the record + recallable: one hold for each item available to be recalled + - to a recall, once a specific number of holds have been requested on the record. + - This system preference is used by the convert_holds_to_recalls.pl cronjob. SIP2: - diff --git a/misc/cronjobs/recalls/convert_holds_to_recalls.pl b/misc/cronjobs/recalls/convert_holds_to_recalls.pl index 49982492933..a9992e4bfaa 100755 --- a/misc/cronjobs/recalls/convert_holds_to_recalls.pl +++ b/misc/cronjobs/recalls/convert_holds_to_recalls.pl @@ -46,11 +46,11 @@ This script converts holds to recalls when a record has a set minimum number of If a record is found to have the specified minimum number of holds, the script will find the oldest hold and convert it to a recall, as long as it would be a legal recall. -This script uses the ConvertSelectedReservesToRecalls system preference. +This script uses the ConvertedSelectedHoldsToRecalls system preference. -When ConvertSelectedReservesToRecalls is set to 'oldest', this script will only convert the single oldest hold. Once converted, the script will move on to the next record, it will not continue to convert holds on this record. +When ConvertedSelectedHoldsToRecalls is set to 'oldest', this script will only convert the single oldest hold. Once converted, the script will move on to the next record, it will not continue to convert holds on this record. -When ConvertSelectedReservesToRecalls is set to 'recallable', this script will convert reserves one-by-one, oldest first, until all recallable items have been recalled. +When ConvertedSelectedHoldsToRecalls is set to 'recallable', this script will convert reserves one-by-one, oldest first, until all recallable items have been recalled. Options: -v verbose @@ -99,7 +99,7 @@ foreach my $bib ( @bib_holds ) { # Get all holds on this biblio my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber} }, { order_by => { -asc => 'reservedate' } })->as_list; - if ( C4::Context->preference('ConvertSelectedReservesToRecalls') eq 'oldest' ) { + if ( C4::Context->preference('ConvertedSelectedHoldsToRecalls') eq 'oldest' ) { my $hold_to_convert = $holds[0]; my $itemnumber_to_allocate = can_convert( $hold_to_convert ); @@ -109,7 +109,7 @@ foreach my $bib ( @bib_holds ) { report( $hold_to_convert, ++$count ); } - } elsif ( C4::Context->preference('ConvertSelectedReservesToRecalls') eq 'recallable' ) { + } elsif ( C4::Context->preference('ConvertedSelectedHoldsToRecalls') eq 'recallable' ) { my $this_record_holds_converted = 0; @@ -138,8 +138,8 @@ sub can_convert { my $hold = shift; my $item = shift; - my $patron = Koha::Patrons->find( $hold_to_convert->borrowernumber ); - my $biblio = Koha::Biblios->find( $hold_to_convert->biblionumber ); + my $patron = Koha::Patrons->find( $hold->borrowernumber ); + my $biblio = Koha::Biblios->find( $hold->biblionumber ); if ( $hold->item_level_hold ) { -- 2.30.2