my $circ = $circs->[0];
$log->info("Recalling circ ID : " . $circ->id);
+ my $old_due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date))->iso8601();
+
# Give the user a new due date of either a full recall threshold,
# or the return interval, whichever is further in the future
my $threshold_date = DateTime::Format::ISO8601->parse_datetime(clean_ISO8601($circ->xact_start))->add(seconds => interval_to_seconds($recall_threshold))->iso8601();
$return_date = $threshold_date;
}
+ # But if the new due date is later than the old one,
+ # keep the old one.
+ if (DateTime->compare(DateTime::Format::ISO8601->parse_datetime($return_date), DateTime::Format::ISO8601->parse_datetime($old_due_date)) == 1) {
+ $return_date = $old_due_date;
+ }
+
my $update_fields = {
due_date => $return_date,
renewal_remaining => 0,
$self->log_hold("recalling circ ".$circ->id);
+ my $old_due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date))->iso8601();
+
# Give the user a new due date of either a full recall threshold,
# or the return interval, whichever is further in the future.
my $threshold_date = DateTime::Format::ISO8601
$return_date = $threshold_date;
}
+ # But if the new due date is later than the old one,
+ # keep the old one.
+ if (DateTime->compare(
+ DateTime::Format::ISO8601->parse_datetime($return_date),
+ DateTime::Format::ISO8601->parse_datetime($old_due_date)) == 1) {
+ $return_date = $old_due_date;
+ }
+
my %update_fields = (
due_date => $return_date,
renewal_remaining => 0,