Bug 13612 - Remove old YUI javacript libraries from opac-tmpl
[koha.git] / acqui / basketheader.pl
index 8f75f40..15c76e8 100755 (executable)
@@ -47,19 +47,20 @@ If it exists, C<$basketno> is the basket we edit
 
 use strict;
 use warnings;
-use CGI;
+use CGI qw ( -utf8 );
 use C4::Context;
 use C4::Auth;
 use C4::Branch;
 use C4::Output;
-use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/;
-use C4::Bookseller qw/GetBookSellerFromId GetBookSeller/;
+use C4::Acquisition qw/GetBasket NewBasket ModBasketHeader/;
+use C4::Contract qw/GetContracts/;
 
+use Koha::Acquisition::Bookseller;
 
 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,15 +100,19 @@ 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 $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
     my $count = scalar @contractloop;
     if ( $count > 0) {
         $template->param(contractloop => \@contractloop,
                          basketcontractnumber => $basket->{'contractnumber'});
     }
-    my @booksellers = C4::Bookseller::GetBookSeller();
+    my @booksellers = Koha::Acquisition::Bookseller->search;
     $template->param( add_form => 1,
                     basketname => $basket->{'basketname'},
                     basketnote => $basket->{'note'},
@@ -148,7 +158,6 @@ if ( $op eq 'add_form' ) {
             $input->param('basketnote'),
             $input->param('basketbooksellernote'),
             $input->param('basketcontractnumber') || undef,
-            undef,
             $input->param('deliveryplace'),
             $input->param('billingplace'),
         );