Bug 13282: t/Message.t shouldn't depend on the DB
[koha.git] / acqui / basketheader.pl
index 93bd7f8..b0ea2e7 100755 (executable)
@@ -52,14 +52,15 @@ use C4::Context;
 use C4::Auth;
 use C4::Branch;
 use C4::Output;
-use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/;
+use C4::Acquisition qw/GetBasket NewBasket ModBasketHeader/;
 use C4::Bookseller qw/GetBookSellerFromId GetBookSeller/;
+use C4::Contract qw/GetContracts/;
 
 
 my $input = new CGI;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
-        template_name   => "acqui/basketheader.tmpl",
+        template_name   => "acqui/basketheader.tt",
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
@@ -84,7 +85,12 @@ if ( $op eq 'add_form' ) {
         if (! $booksellerid) {
             $booksellerid=$basket->{'booksellerid'};
         }
-        @contractloop = &GetContracts($booksellerid, 1);
+        my $contracts = GetContracts({
+            booksellerid => $booksellerid,
+            activeonly => 1,
+        });
+
+        @contractloop = @$contracts;
         for (@contractloop) {
             if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) {
                 $_->{'selected'} = 1;
@@ -94,7 +100,11 @@ if ( $op eq 'add_form' ) {
     } else {
     #new basket
         my $basket;
-        push(@contractloop, &GetContracts($booksellerid, 1));
+        my $contracts = GetContracts({
+            booksellerid => $booksellerid,
+            activeonly => 1,
+        });
+        push(@contractloop, @$contracts);
     }
     my $bookseller = GetBookSellerFromId($booksellerid);
     my $count = scalar @contractloop;