Bug 14903: (followup)Remove C4::Dates from circ/circulation.pl
authorMarc Véron <veron@veron.ch>
Tue, 27 Oct 2015 16:50:21 +0000 (17:50 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 29 Oct 2015 14:57:49 +0000 (11:57 -0300)
Follow up to fix QA issues from comment #15
...and amended for comment #18

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
circ/circulation.pl

index 1812061..bac91d7 100755 (executable)
@@ -174,7 +174,8 @@ for my $barcode ( @$barcodes ) {
 
 my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
 my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
-$duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso' }); };
+$duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso' }); }
+    if ( $duedatespec );
 
 my $issueconfirmed = $query->param('issueconfirmed');
 my $cancelreserve  = $query->param('cancelreserve');
@@ -203,11 +204,11 @@ if( $onsite_checkout && !$duedatespec_allow ) {
     $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
     $datedue .= ' 23:59:00';
 } elsif( $duedatespec_allow ) {
-    if ($datedue) {
-        $datedue = eval { dt_from_string( $datedue ) };
+    if ( $duedatespec ) {
+        $datedue = eval { dt_from_string( $duedatespec ) };
         if (! $datedue ) {
             $invalidduedate = 1;
-            $template->param( IMPOSSIBLE=>1, INVALID_DATE=>$datedue );
+            $template->param( IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec );
         }
     }
 }