@@ -, +, @@ --- Koha/CirculationRules.pm | 8 +----- Koha/Hold.pm | 2 +- .../data/mysql/atomicupdate/bug_25711.pl | 26 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 - .../admin/preferences/circulation.pref | 5 ---- 5 files changed, 28 insertions(+), 14 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_25711.pl --- a/Koha/CirculationRules.pm +++ a/Koha/CirculationRules.pm @@ -667,7 +667,6 @@ sub get_effective_daysmode { =head3 get_effective_expire_reserves_charge Return the value for expire_reserves_charge defined in the circulation rules. -If not defined (or empty string), the value of the system preference ExpireReservesMaxPickUpDelayCharge is returned =cut @@ -678,7 +677,7 @@ sub get_effective_expire_reserves_charge { my $branchcode = $params->{branchcode}; my $categorycode = $params->{categorycode}; - my $expire_reserves_charge_rule = $class->get_effective_rule( + return $class->get_effective_rule( { itemtype => $itemtype, branchcode => $branchcode, @@ -686,11 +685,6 @@ sub get_effective_expire_reserves_charge { rule_name => 'expire_reserves_charge', } ); - - # return the rule value (incl. 0) if rule found so there's an object in the variable, - # or return default value from sysprefs when rule wasn't found and there's undef - return $expire_reserves_charge_rule ? $expire_reserves_charge_rule->rule_value : C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); - } =head3 type --- a/Koha/Hold.pm +++ a/Koha/Hold.pm @@ -539,7 +539,7 @@ my $cancel_hold = $hold->cancel( Cancel a hold: - The hold will be moved to the old_reserves table with a priority=0 - The priority of other holds will be updated -- The patron will be charge (see ExpireReservesMaxPickUpDelayCharge) if the charge_cancel_fee parameter is set +- The patron will be charged if charge_cancel_fee parameter is set (controlled by the expire_reserves_charge circ rule) - The canceled hold will have the cancellation reason added to old_reserves.cancellation_reason if one is passed in - a CANCEL HOLDS log will be done if the pref HoldsLog is on --- a/installer/data/mysql/atomicupdate/bug_25711.pl +++ a/installer/data/mysql/atomicupdate/bug_25711.pl @@ -0,0 +1,26 @@ +use Modern::Perl; + +return { + bug_number => "25711", + description => "Move ExpireReservesMaxPickUpDelayCharge to the circulation rules", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + my ($expire_reserves_charge) = $dbh->selectrow_array( q{ + SELECT value FROM systempreferences + WHERE variable='ExpireReservesMaxPickUpDelayCharge'; + }); + + $expire_reserves_charge //= 0; + + $dbh->do(qq{ + INSERT INTO circulation_rules + ( categorycode, branchcode, itemtype, rule_name, rule_value ) + VALUES + ( NULL, NULL, NULL, 'expire_reserves_charge', $expire_reserves_charge ); + }); + + say $out "ExpireReservesMaxPickUpDelayCharge migrated to the expire_reserves_charge circulation rule"; + }, +}; --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -212,7 +212,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), ('ExpireReservesMaxPickUpDelay','0','','Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay','YesNo'), -('ExpireReservesMaxPickUpDelayCharge','0',NULL,'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.','free'), ('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo'), ('ExcludeHolidaysFromMaxPickUpDelay', '0', NULL, 'If ON, reserves max pickup delay takes into accountthe closed days.', 'YesNo'), ('ExportCircHistory', 0, NULL, "Display the export circulation options", 'YesNo' ), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -756,11 +756,6 @@ Circulation: 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.' - - - - If using ExpireReservesMaxPickUpDelay, charge a patron who allows their waiting hold to expire a fee of - - pref: ExpireReservesMaxPickUpDelayCharge - class: currency - - "." - - Satisfy holds using items from the libraries - pref: StaticHoldsQueueWeight --