Bugfix 1978 - on circ, check date specified output is later than now.
authorJoe Atzberger <joe.atzberger@liblime.com>
Mon, 16 Jun 2008 17:09:43 +0000 (12:09 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 16 Jun 2008 20:37:11 +0000 (15:37 -0500)
This resolves all remaining significant parts of the bug.
Note that this may have to be revisited for hourly or partial-day circ functionality
for 3.2.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
circ/circulation.pl

index 004e7c8..0d302bb 100755 (executable)
@@ -143,7 +143,14 @@ my $newexpiry      = $query->param('dateexpiry');
 my ($datedue,$invalidduedate);
 if ($duedatespec) {
        if ($duedatespec =~ C4::Dates->regexp('syspref')) {
-               $datedue = C4::Dates->new($duedatespec);
+               my $tempdate = C4::Dates->new($duedatespec);
+               if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
+                       # i.e., it has to be later than today/now
+                       $datedue = $tempdate;
+               } else {
+                       $invalidduedate = 1;
+                       $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
+               }
        } else {
                $invalidduedate = 1;
                $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);