use C4::Items; #PrepareItemRecord
use C4::Output;
use C4::Koha;
-use C4::Branch; # GetBranches
use C4::Members;
use C4::Search qw/FindDuplicate/;
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
use Koha::Acquisition::Bookseller;
+use Koha::Acquisition::Currencies;
+use Koha::ItemTypes;
our $input = new CGI;
my $booksellerid = $input->param('booksellerid'); # FIXME: else ERROR!
my $suggestion;
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
-# get currencies (for change rates calcs if needed)
-my $active_currency = GetCurrency();
-my $default_currency;
-if (! $data->{currency} ) { # New order no currency set
- if ( $bookseller->{listprice} ) {
- $default_currency = $bookseller->{listprice};
- }
- else {
- $default_currency = $active_currency->{currency};
- }
-}
-
-my @rates = GetCurrencies();
-
-# ## @rates
-
-my @loop_currency = ();
-for my $curr ( @rates ) {
- my $selected;
- if ($data->{currency} ) {
- $selected = $curr->{currency} eq $data->{currency};
- }
- else {
- $selected = $curr->{currency} eq $default_currency;
- }
- push @loop_currency, {
- currcode => $curr->{currency},
- rate => $curr->{rate},
- selected => $selected,
- }
-}
-
-# build branches list
-my $onlymine =
- C4::Context->preference('IndependentBranches')
- && C4::Context->userenv
- && !C4::Context->IsSuperLibrarian()
- && C4::Context->userenv->{branch};
-my $branches = GetBranches($onlymine);
-my @branchloop;
-foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
- my %row = (
- value => $thisbranch,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- $row{'selected'} = 1 if( $thisbranch && $data->{branchcode} && $thisbranch eq $data->{branchcode}) ;
- push @branchloop, \%row;
-}
-$template->param( branchloop => \@branchloop );
+my @currencies = Koha::Acquisition::Currencies->search;
+my $active_currency = Koha::Acquisition::Currencies->get_active;
# build bookfund list
my $borrower= GetMember('borrowernumber' => $loggedinuser);
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
# Check if ACQ framework exists
- my $marc = GetMarcStructure(1, 'ACQ');
+ my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
unless($marc) {
$template->param('NoACQframework' => 1);
}
}
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
my @itemtypes;
-@itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes');
+@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
if ( defined $subscriptionid ) {
my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
$budget_id = $lastOrderReceived->{budgetid};
$data->{listprice} = $lastOrderReceived->{listprice};
$data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
- $data->{gstrate} = $lastOrderReceived->{gstrate};
+ $data->{tax_rate} = $lastOrderReceived->{tax_rate};
$data->{discount} = $lastOrderReceived->{discount};
$data->{rrp} = $lastOrderReceived->{rrp};
$data->{ecost} = $lastOrderReceived->{ecost};
ordernumber => $ordernumber,
# basket informations
basketno => $basketno,
+ basket => $basket,
basketname => $basket->{'basketname'},
basketnote => $basket->{'note'},
booksellerid => $basket->{'booksellerid'},
listincgst => $bookseller->{'listincgst'},
invoiceincgst => $bookseller->{'invoiceincgst'},
name => $bookseller->{'name'},
- cur_active_sym => $active_currency->{'symbol'},
- cur_active => $active_currency->{'currency'},
- loop_currencies => \@loop_currency,
+ cur_active_sym => $active_currency->symbol,
+ cur_active => $active_currency->currency,
+ currencies => \@currencies,
+ currency => $data->{currency},
+ vendor_currency => $bookseller->{listprice},
orderexists => ( $new eq 'yes' ) ? 0 : 1,
title => $data->{'title'},
author => $data->{'author'},
quantityrec => $quantity,
rrp => $data->{'rrp'},
gst_values => \@gst_values,
- gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
+ tax_rate => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
total => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
ecost => sprintf( "%.2f", $data->{ecost} || 0),