From: Bill Erickson Date: Fri, 25 Jun 2021 17:03:10 +0000 (-0400) Subject: LP1891369 Renewal exentions uses min interval X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=dc3b933a4aea8b009ef7fa5d9e5db0c03826186f;p=evergreen%2Fmasslnc.git LP1891369 Renewal exentions uses min interval Specify the minimum renewal extension interval as an interval instead of a percentage of the total duration. Signed-off-by: Bill Erickson Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index e22a2eb088..a4fb45b078 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2196,7 +2196,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 68273a23b2..88d2d73cf5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -2392,19 +2392,16 @@ sub extend_renewal_due_date { my $now_time = DateTime->now->epoch; - if (my $percent = $matchpoint->renew_extend_percent) { - # If the percent is zero, all renewals are extended. + if (my $interval = $matchpoint->renew_extend_min_interval) { - my $total_duration = $end_time - $start_time; + my $min_duration = OpenILS::Utils::DateTime->interval_to_seconds($interval); my $checkout_duration = $now_time - $start_time; - my $duration_percent = ($checkout_duration / $total_duration) * 100; - return if $duration_percent < $percent; + return if $checkout_duration < $min_duration; } my $remaining_duration = $end_time - $now_time; - # $circ->due_date is already in the correct timezone. my $due_date = DateTime::Format::ISO8601->new ->parse_datetime(clean_ISO8601($circ->due_date)); @@ -2412,6 +2409,7 @@ sub extend_renewal_due_date { $logger->info("circulator: extended renewal due date to $due_date"); + # $circ->due_date is already in the needed timezone. $circ->due_date($due_date->strftime('%FT%T%z')); } diff --git a/Open-ILS/src/sql/Pg/100.circ_matrix.sql b/Open-ILS/src/sql/Pg/100.circ_matrix.sql index 1eff5502ec..1badabe07c 100644 --- a/Open-ILS/src/sql/Pg/100.circ_matrix.sql +++ b/Open-ILS/src/sql/Pg/100.circ_matrix.sql @@ -83,9 +83,9 @@ CREATE TABLE config.circ_matrix_matchpoint ( script_test TEXT, -- javascript source total_copy_hold_ratio FLOAT, available_copy_hold_ratio FLOAT, + description TEXT, renew_extends_due_date BOOLEAN NOT NULL DEFAULT FALSE, - renew_extend_percent FLOAT NOT NULL DEFAULT 0, - description TEXT + renew_extend_min_interval INTERVAL ); -- Nulls don't count for a constraint match, so we have to coalesce them into something that does. diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.renewals-use-full-time.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.renewals-use-full-time.sql index 3e2a0d8deb..640bc7e301 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.renewals-use-full-time.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.renewals-use-full-time.sql @@ -4,6 +4,6 @@ BEGIN; ALTER TABLE config.circ_matrix_matchpoint ADD COLUMN renew_extends_due_date BOOLEAN NOT NULL DEFAULT FALSE, - ADD COLUMN renew_extend_percent FLOAT NOT NULL DEFAULT 0; + ADD COLUMN renew_extend_min_interval INTERVAL; COMMIT; diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/renewals-extend-due-date.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/renewals-extend-due-date.adoc index b7b1b904fc..25c20e5cad 100644 --- a/docs/RELEASE_NOTES_NEXT/Circulation/renewals-extend-due-date.adoc +++ b/docs/RELEASE_NOTES_NEXT/Circulation/renewals-extend-due-date.adoc @@ -16,12 +16,15 @@ Circulation Policies. Enables this new feature for a circulation policy. -*Early Renewal Minimum Duration Percent* +*Early Renewal Minimum Duration Interval* -Specifies how early in a checkout a renewal will result in an extended -due date. E.g. A value of 50 (percent) means no due date extension -would occur if an attempt to renew occurred after 5 days of a 14 day -circulation duration. In this case, the renewal would still be allowed, -it just wouldn't get the extended due date. +Specifies the amount of time a circulation has to be checked out before a +renewal will result in an extended due date. +For example, if you wanted to support due date extensions on 14-day checkout +renewals, but only if the item has been checked out at least 8 days, you +would enter "8 days" for the value of this field. + +If no value is set for a given matchpoint that supports renewal extension, +all renewals using that matchpoint will be eligible.