=cut
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Koha;
use Koha::Acquisition::Booksellers;
+use Koha::Acquisition::Orders;
use Koha::DateUtils qw( dt_from_string );
use Koha::ItemTypes;
use Koha::Patrons;
# 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 } );
$template->param('NoACQframework' => 1);
}
-my $AcqCreateItem = C4::Context->preference('AcqCreateItem');
+my $AcqCreateItem = $basket->effective_create_items;
if ($AcqCreateItem eq 'receiving') {
$template->param(
AcqCreateItemReceiving => 1,
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
$item->{materials} = $descriptions->{lib} // '';
- my $itemtype = Koha::ItemsTypes->find( $item->{itype} );
- $item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
+ my $itemtype = Koha::ItemTypes->find( $item->{itype} );
+ if (defined $itemtype) {
+ $item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
+ }
push @items, $item;
}
$template->param(items => \@items);
my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
-my $authorisedby = $order->{authorisedby};
-my $authorised_patron = Koha::Patrons->find( $authorisedby );
+my $creator = Koha::Patrons->find( $order->{created_by} );
my $budget = GetBudget( $order->{budget_id} );
ecost => $ecost,
unitprice => $unitprice,
tax_rate => $tax_rate,
- memberfirstname => $authorised_patron->firstname || "",
- membersurname => $authorised_patron->surname || "",
+ creator => $creator,
invoiceid => $invoice->{invoiceid},
invoice => $invoice->{invoicenumber},
datereceived => $datereceived,