From bf67c1e1beaa02faebdaab28ad79512d2d3bcee2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 3 Nov 2023 20:10:01 +0000 Subject: [PATCH] Bug 35254: Add import_record_id to order inputs This patch follows the logic of bug 32166 and adds specific inputs for each order to avoid any misalignment when some records are not imported To test: 1 - Find a vendor in acquisitions 2 - Create or find an open basket 3 - Add to basket form a new file 4 - Stage file and add to basket 5 - Select the second record in the list 6 - Enter price info 7 - Save (don't forget, you need to set item type in the second tab) 8 - The order has no price info! 9 - Apply patch 10 - Repeat 3-7 above, staging file fresh 11 - Confirm order has correct prices 12 - Test with a file with many records 13 - Confirm any combination of choosing/skipping records works as expected --- acqui/addorderiso2709.pl | 28 +++++++++---------- .../prog/en/modules/acqui/addorderiso2709.tt | 14 +++++----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index f90f3da3d36..e79a0ae4472 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -144,13 +144,6 @@ if ($op eq ""){ my $duplinbatch; my $imported = 0; my @import_record_id_selected = $input->multi_param("import_record_id"); - my @quantities = $input->multi_param('quantity'); - my @prices = $input->multi_param('price'); - my @orderreplacementprices = $input->multi_param('replacementprice'); - my @budgets_id = $input->multi_param('budget_id'); - my @discount = $input->multi_param('discount'); - my @sort1 = $input->multi_param('sort1'); - my @sort2 = $input->multi_param('sort2'); my $matcher_id = $input->param('matcher_id'); my $active_currency = Koha::Acquisition::Currencies->get_active; my $biblio_count = 0; @@ -163,13 +156,20 @@ if ($op eq ""){ my $matches = $import_record->get_import_record_matches({ chosen => 1 }); my $match = $matches->count ? $matches->next : undef; my $biblionumber = $match ? $match->candidate_match_id : 0; - my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; - my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id; - my $c_discount = shift ( @discount); - my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || ''; - my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || ''; - my $c_replacement_price = shift( @orderreplacementprices ); - my $c_price = shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); + my $c_quantity = + $input->param( 'quantity_' . $import_record->import_record_id ) + || GetMarcQuantity( $marcrecord, C4::Context->preference('marcflavour') ) + || 1; + my $c_budget_id = + $input->param( 'budget_id_' . $import_record->import_record_id ) + || $input->param('all_budget_id') + || $budget_id; + my $c_discount = $input->param( 'discount_' . $import_record->import_record_id ); + my $c_sort1 = $input->param( 'sort1_' . $import_record->import_record_id ) || $input->param('all_sort1') || ''; + my $c_sort2 = $input->param( 'sort2_' . $import_record->import_record_id ) || $input->param('all_sort2') || ''; + my $c_replacement_price = $input->param( 'replacementprice_' . $import_record->import_record_id ); + my $c_price = $input->param( 'price_' . $import_record->import_record_id ) + || GetMarcPrice( $marcrecord, C4::Context->preference('marcflavour') ); # Insert the biblio, or find it through matcher if ( $biblionumber ) { # If matched during staging we can continue diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 84e22d4f015..35692ee15e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -188,20 +188,20 @@
  • - + Required
  • - +
  • - +
  • - % + %
    If empty, discount rate from vendor will be used
  • @@ -210,7 +210,7 @@ [% Budget_name | html %] [% ELSE %] - [% FOREACH budget IN budget_loop %] [% IF ( budget.b_id == biblio.budget_id ) %] @@ -231,11 +231,11 @@
  • - +
  • - +
  • [% IF ( biblio.iteminfos.size ) %] -- 2.30.2