<field name="available_copy_hold_ratio" reporter:datatype="float" reporter:label="Minimum Available Copy/Hold Ratio"/>
<field name="description" reporter:datatype="text" reporter:label="Description"/>
<field name="renew_extends_due_date" reporter:datatype="bool" reporter:label="Early Renewal Extends Due Date"/>
- <field name="renew_extend_percent" reporter:datatype="float" reporter:label="Early Renewal Minimum Duration Percent"/>
+ <field name="renew_extend_min_interval" reporter:datatype="interval" reporter:label="Early Renewal Minimum Duration Interval"/>
</fields>
<links>
<link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
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));
$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'));
}
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.
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;
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.