From bdcbada8b892c3e322c1a9378d9343b4eb9f2089 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 24 Dec 2015 14:53:16 +0000 Subject: [PATCH] Bug 14752 - Add multiple copies to a basket at once This patch add an 'Add multiple copies' button on the new order page in acquisitions. While processing the multiple copies a modal is displayed. To test: 1 - Add an order to an acquisitions basket 2 - Choose to add multiple items 3 - A modal shouold warn about ignoring UniqueItemFields from syspref 4 - When submitting the modal should popup until all items are processed. 5 - The modal should disappear after items are added. 6 - Items should be cloned, minus unique fields 7 - Enable autoBarcode for various formats, ensure you are warned that barcodes will be generated, and ensure they are generated correctly Sponsored by: Middletown Township Public Library (http://www.mtpl.org) Signed-off-by: sonia BOUIS Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- acqui/addorder.pl | 18 +++++- .../prog/en/includes/additem.js.inc | 3 + .../prog/en/modules/acqui/neworderempty.tt | 33 +++++++++++ koha-tmpl/intranet-tmpl/prog/js/additem.js | 57 +++++++++++++++++-- 4 files changed, 106 insertions(+), 5 deletions(-) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 70cb36c92d..80f01c68de 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -130,6 +130,7 @@ use C4::Budgets; use C4::Items; use C4::Output; use Koha::Acquisition::Currencies; +use C4::Barcodes; ### "-------------------- addorder.pl ----------" @@ -307,7 +308,6 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { push @{$itemhash{$itemid[$i]}->{'indicator'}},$indicator[$i]; } foreach my $item (keys %itemhash){ - my $xml = TransformHtmlToXml( $itemhash{$item}->{'tags'}, $itemhash{$item}->{'subfields'}, $itemhash{$item}->{'field_values'}, @@ -315,6 +315,22 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { $itemhash{$item}->{'ind_tag'}, 'ITEM'); my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); + my ($barcodefield,$barcodesubfield) = GetMarcFromKohaField('items.barcode'); + my $barcode = $record->subfield($barcodefield,$barcodesubfield); + my $aBpref = C4::Context->preference('autoBarcode'); + if( $barcode eq '' && $aBpref ne 'OFF'){ + my $barcodeobj; + if ( $aBpref eq 'hbyymmincr'){ + my ($homebranchfield,$homebranchsubfield) = GetMarcFromKohaField('items.homebranch'); + my $homebranch = $record->subfield($homebranchfield,$homebranchsubfield); + $barcodeobj = C4::Barcodes->new($aBpref, $homebranch); + } else { + $barcodeobj = C4::Barcodes->new($aBpref); + } + $barcode = $barcodeobj->value(); + $record->field($barcodefield)->delete_subfield( code => $barcodesubfield); + $record->field($barcodefield)->add_subfields($barcodesubfield => $barcode); + } my ($biblionumber,$bibitemnum,$itemnumber) = AddItemFromMarc($record,$$orderinfo{biblionumber}); $order->add_item($itemnumber); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc index 28d39e4b04..1ecee30c40 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc @@ -1,6 +1,9 @@