Check to see if existing loan date is less than recall date
authorArt Rhyno <art632000@yahoo.ca>
Sat, 22 Sep 2012 04:46:20 +0000 (00:46 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 2 Oct 2012 20:51:30 +0000 (16:51 -0400)
It seems possible that a recall can be issued that actually extends
the loan period for an item with semester or other generous loan
periods. This adds a check for the current loan period and uses it
if the calculated threshold date is later.

Signed-off-by: Art Rhyno <art632000@yahoo.ca>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index 4101309..64fc01b 100644 (file)
@@ -1626,6 +1626,11 @@ sub process_recall {
             $return_date = $threshold_date;
         }
 
+        # Ensure that new loan period is not longer than original due date, if it is, stick with original date
+        if (DateTime->compare(DateTime::Format::ISO8601->parse_datetime($circ->due_date),DateTime::Format::ISO8601->parse_datetime($return_date)) == -1) {
+           $return_date = $circ->due_date;
+        };
+
         my $update_fields = {
             due_date => $return_date,
             renewal_remaining => 0,