use C4::Branch; # GetBranches
use C4::Members;
+use Koha::Number::Price;
+use Koha::Acquisition::Order;
+
my $input = new CGI;
my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({
- template_name => "acqui/addorderiso2709.tmpl",
+ template_name => "acqui/addorderiso2709.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
# 3rd step = import the records
#
} elsif ( $op eq 'import_records' ) {
- my $num=FormatNumber();
#import selected lines
$template->param('basketno' => $cgiparams->{'basketno'});
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards
}
}
( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
+ SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
# 2nd add authorities if applicable
if (C4::Context->preference("BiblioAddsAuthorities")){
my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'});
# in France, the cents separator is the , but sometimes, ppl use a .
# in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
$price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
- $price = $num->unformat_number($price);
+ $price = Koha::Number::Price->new($price)->unformat;
$orderinfo{gstrate} = $bookseller->{gstrate};
my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
if ( $bookseller->{listincgst} ) {
# remove uncertainprice flag if we have found a price in the MARC record
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
- my ( $basketno, $ordernumber ) = NewOrder( \%orderinfo );
+ my $order = Koha::Acquisition::Order->new( \%orderinfo )->insert;
# 4th, add items if applicable
# parse the item sent by the form, and create an item just for the import_record_id we are dealing with
my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
- NewOrderItem( $itemnumber, $ordernumber );
+ $order->add_item( $itemnumber );
}
+ } else {
+ SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
}
}
# go to basket page
if (scalar @$stagedList) {
push @list, {
import_batch_id => $batch->{'import_batch_id'},
- num_biblios => $batch->{'num_records'},
+ num_records => $batch->{'num_records'},
num_items => $batch->{'num_items'},
staged_date => $batch->{'upload_timestamp'},
import_status => $batch->{'import_status'},
push @list, \%cellrecord;
}
- my $num_biblios = $batch->{'num_records'};
+ my $num_records = $batch->{'num_records'};
my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
my $item_action = GetImportBatchItemAction($import_batch_id);
$template->param(biblio_list => \@list,
- num_results => $num_biblios,
+ num_results => $num_records,
import_batch_id => $import_batch_id,
"overlay_action_${overlay_action}" => 1,
overlay_action => $overlay_action,
comments => $batch->{'comments'},
import_status => $batch->{'import_status'},
upload_timestamp => $batch->{'upload_timestamp'},
- num_biblios => $batch->{'num_records'},
+ num_records => $batch->{'num_records'},
num_items => $batch->{'num_items'});
if ($batch->{'num_records'} > 0) {
if ($batch->{'import_status'} eq 'staged' or $batch->{'import_status'} eq 'reverted') {