Bug 19479: Display price in basket group formatted according to CurrencyFormat syspre...
[koha.git] / acqui / orderreceive.pl
index 116277d..c88a533 100755 (executable)
@@ -58,8 +58,7 @@ The biblionumber of this order.
 
 =cut
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Context;
@@ -74,6 +73,7 @@ use C4::Suggestions;
 use C4::Koha;
 
 use Koha::Acquisition::Booksellers;
+use Koha::Acquisition::Orders;
 use Koha::DateUtils qw( dt_from_string );
 use Koha::ItemTypes;
 use Koha::Patrons;
@@ -111,6 +111,7 @@ unless ( $results and @$results) {
 
 # prepare the form for receiving
 my $order = $results->[0];
+my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket;
 
 # Check if ACQ framework exists
 my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
@@ -118,7 +119,7 @@ unless($acq_fw) {
     $template->param('NoACQframework' => 1);
 }
 
-my $AcqCreateItem = C4::Context->preference('AcqCreateItem');
+my $AcqCreateItem = $basket->effective_create_items;
 if ($AcqCreateItem eq 'receiving') {
     $template->param(
         AcqCreateItemReceiving => 1,
@@ -184,6 +185,12 @@ my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
 
 my $authorisedby = $order->{authorisedby};
 my $authorised_patron = Koha::Patrons->find( $authorisedby );
+if ( $authorised_patron ) { # This should not happen unless there was a migration issue (or very old install?)
+    $template->param(
+        memberfirstname  => $authorised_patron->firstname || "",
+        membersurname    => $authorised_patron->surname || "",
+    );
+}
 
 my $budget = GetBudget( $order->{budget_id} );
 
@@ -216,8 +223,6 @@ $template->param(
     ecost                 => $ecost,
     unitprice             => $unitprice,
     tax_rate              => $tax_rate,
-    memberfirstname       => $authorised_patron->firstname || "",
-    membersurname         => $authorised_patron->surname || "",
     invoiceid             => $invoice->{invoiceid},
     invoice               => $invoice->{invoicenumber},
     datereceived          => $datereceived,