Bug 9456: (follow-up) remove whitespaces and tab
[koha.git] / admin / aqcontract.pl
index 07fb757..ab513e7 100755 (executable)
@@ -51,25 +51,35 @@ $template->param(
     contractnumber => $contractnumber,
     booksellerid   => $booksellerid,
     booksellername => $bookseller->{name},
-    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
-    dateformat     => C4::Context->preference("dateformat"),
+    basketcount   => $bookseller->{'basketcount'},
+    subscriptioncount   => $bookseller->{'subscriptioncount'},
 );
 
 #ADD_FORM: called if $op is 'add_form'. Used to create form to add or  modify a record
 if ( $op eq 'add_form' ) {
     $template->param( add_form => 1 );
 
-    # if contractnumber exists, it's a modify action, so read values to modify...
-    my $contract = @{GetContract( { contractnumber => $contractnumber } )}[0] if $contractnumber;
-
-    $template->param(
-        contractnumber           => $$contract{contractnumber},
-        contractname             => $$contract{contractname},
-        contractdescription      => $$contract{contractdescription},
-        contractstartdate        => format_date( $$contract{contractstartdate} ),
-        contractenddate          => format_date( $$contract{contractenddate} ),
-        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar,
-    );
+   # if contractnumber exists, it's a modify action, so read values to modify...
+    if ($contractnumber) {
+        my $contract =
+          @{ GetContract( { contractnumber => $contractnumber } ) }[0];
+
+        $template->param(
+            contractnumber      => $contract->{contractnumber},
+            contractname        => $contract->{contractname},
+            contractdescription => $contract->{contractdescription},
+            contractstartdate => format_date( $contract->{contractstartdate} ),
+            contractenddate   => format_date( $contract->{contractenddate} ),
+        );
+    } else {
+        $template->param(
+            contractnumber           => undef,
+            contractname             => undef,
+            contractdescription      => undef,
+            contractstartdate        => undef,
+            contractenddate          => undef,
+        );
+    }
 
     # END $OP eq ADD_FORM
 }
@@ -99,7 +109,7 @@ elsif ( $op eq 'add_validate' ) {
         });
     }
 
-    print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
+    print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid");
     exit;
 
     # END $OP eq ADD_VALIDATE
@@ -126,7 +136,7 @@ elsif ( $op eq 'delete_confirmed' ) {
 
     DelContract( { contractnumber => $contractnumber } );
 
-    print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
+    print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?booksellerid=$booksellerid");
     exit;
 
     # END $OP eq DELETE_CONFIRMED