Bug 18971: Typo Koha::ItemsTypes for Koha::ItemTypes
[koha.git] / acqui / orderreceive.pl
index 837a117..ee244d7 100755 (executable)
@@ -75,6 +75,8 @@ use C4::Koha;
 
 use Koha::Acquisition::Booksellers;
 use Koha::DateUtils qw( dt_from_string );
+use Koha::ItemTypes;
+use Koha::Patrons;
 
 my $input      = new CGI;
 
@@ -144,8 +146,8 @@ if ($AcqCreateItem eq 'receiving') {
         $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
         $item->{materials} = $descriptions->{lib} // '';
 
-        my $itemtype = getitemtypeinfo($item->{itype});
-        $item->{itemtype} = $itemtype->{description};
+        my $itemtype = Koha::ItemTypes->find( $item->{itype} );
+        $item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
         push @items, $item;
     }
     $template->param(items => \@items);
@@ -179,7 +181,7 @@ if( defined $order->{tax_rate_on_receiving} ) {
 my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
 
 my $authorisedby = $order->{authorisedby};
-my $member = GetMember( borrowernumber => $authorisedby );
+my $authorised_patron = Koha::Patrons->find( $authorisedby );
 
 my $budget = GetBudget( $order->{budget_id} );
 
@@ -212,8 +214,8 @@ $template->param(
     ecost                 => $ecost,
     unitprice             => $unitprice,
     tax_rate              => $tax_rate,
-    memberfirstname       => $member->{firstname} || "",
-    membersurname         => $member->{surname} || "",
+    memberfirstname       => $authorised_patron->firstname || "",
+    membersurname         => $authorised_patron->surname || "",
     invoiceid             => $invoice->{invoiceid},
     invoice               => $invoice->{invoicenumber},
     datereceived          => $datereceived,
@@ -225,7 +227,7 @@ $template->param(
     gst_values            => \@gst_values,
 );
 
-my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
+my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
 my @budget_loop;
 my $periods = GetBudgetPeriods( );
 foreach my $period (@$periods) {
@@ -236,7 +238,7 @@ foreach my $period (@$periods) {
     my $budget_hierarchy = GetBudgetHierarchy( $period->{'budget_period_id'} );
     my @funds;
     foreach my $r ( @{$budget_hierarchy} ) {
-        next unless ( CanUserUseBudget( $borrower, $r, $userflags ) );
+        next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
         if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
             next;
         }