From 7d31f77ae6d1f136c58e55fa06139ac366fc6b85 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 10 Nov 2022 20:11:58 +0000 Subject: [PATCH] Bug 32166: Use import record id for retrieving correct inputs When importing from a staged file we retrieve the records form the DB, skip any that are not selected, and process the rest. When we skip some, we still raise our record count, and use this to retrieve the inputs. When building the page, we don't increment for skipped reocrds, so there can be a mismatch, i.e. Record #1 on the page to add records may be the 3rd record in the import file Rather than using a counting system, let us use the import record id directly To test: 0 - Set system preferences: MarcFieldsToOrder: price: 949$g quantity: 949$k budget_code: 949$l discount: 949$m sort1: 949$n sort2: 949$q MarcItemFieldsToOrder: homebranch: 949$a holdingbranch: 949$b itype: 949$y nonpublic_note: 949$x public_note: 949$z loc: 949$c ccode: 949$8 notforloan: 949$7 uri: 949$u copyno: 949$t price: 949$g replacementprice: 949$v itemcallnumber: 949$o quantity: 949$k budget_code: 949$l 1 - Stage attached sample file, Format:MARCXML, Record matching:Koha biblio 999$c 2 - Add to a basket from the staged file 3 - Select 1st record to basket and save 4 - Record is added with the fields above as expected 5 - Add to basket again, select 2nd record 6 - Record is added with price from 020a, ignoring incoming fields 7 - Repeat with 3rd, same problem 8 - Apply patch 9 - Stage file and repeat step 3 10 - Confirm added with correct values 11 - Add 2nd record and save, values correct 12 - Add 3rd record, values correct Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- acqui/addorderiso2709.pl | 28 +++++++++---------- .../prog/en/modules/acqui/addorderiso2709.tt | 28 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index b65663d862..e6d50ab454 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -205,21 +205,21 @@ if ($op eq ""){ $import_record->import_biblio->matched_biblionumber($biblionumber)->store; # Add items from MarcItemFieldsToOrder - my @homebranches = $input->multi_param('homebranch_' . $biblio_count); + my @homebranches = $input->multi_param('homebranch_' . $import_record->import_record_id); my $count = scalar @homebranches; - my @holdingbranches = $input->multi_param('holdingbranch_' . $biblio_count); - my @itypes = $input->multi_param('itype_' . $biblio_count); - my @nonpublic_notes = $input->multi_param('nonpublic_note_' . $biblio_count); - my @public_notes = $input->multi_param('public_note_' . $biblio_count); - my @locs = $input->multi_param('loc_' . $biblio_count); - my @ccodes = $input->multi_param('ccode_' . $biblio_count); - my @notforloans = $input->multi_param('notforloan_' . $biblio_count); - my @uris = $input->multi_param('uri_' . $biblio_count); - my @copynos = $input->multi_param('copyno_' . $biblio_count); - my @budget_codes = $input->multi_param('budget_code_' . $biblio_count); - my @itemprices = $input->multi_param('itemprice_' . $biblio_count); - my @replacementprices = $input->multi_param('replacementprice_' . $biblio_count); - my @itemcallnumbers = $input->multi_param('itemcallnumber_' . $biblio_count); + my @holdingbranches = $input->multi_param('holdingbranch_' . $import_record->import_record_id); + my @itypes = $input->multi_param('itype_' . $import_record->import_record_id); + my @nonpublic_notes = $input->multi_param('nonpublic_note_' . $import_record->import_record_id); + my @public_notes = $input->multi_param('public_note_' . $import_record->import_record_id); + my @locs = $input->multi_param('loc_' . $import_record->import_record_id); + my @ccodes = $input->multi_param('ccode_' . $import_record->import_record_id); + my @notforloans = $input->multi_param('notforloan_' . $import_record->import_record_id); + my @uris = $input->multi_param('uri_' . $import_record->import_record_id); + my @copynos = $input->multi_param('copyno_' . $import_record->import_record_id); + my @budget_codes = $input->multi_param('budget_code_' . $import_record->import_record_id); + my @itemprices = $input->multi_param('itemprice_' . $import_record->import_record_id); + my @replacementprices = $input->multi_param('replacementprice_' . $import_record->import_record_id); + my @itemcallnumbers = $input->multi_param('itemcallnumber_' . $import_record->import_record_id); my $itemcreation = 0; my @itemnumbers; 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 77fbe6e770..760db5213a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -210,7 +210,7 @@
  1. - [% FOREACH l IN libraries %] [% IF l.branchcode == item.homebranch %] @@ -223,7 +223,7 @@
  2. - [% FOREACH l IN libraries %] [% IF l.branchcode == item.holdingbranch %] @@ -235,7 +235,7 @@
  3. - [% FOREACH itemtype IN itemtypes %] [% IF itemtype.itemtype == item.itype %] @@ -248,15 +248,15 @@
  4. - +
  5. - +
  6. - [% FOREACH locationloo IN locationloop %] [% IF ( locationloo.code ) == (item.loc) %] @@ -270,7 +270,7 @@
  7. - [% FOREACH ccodeloo IN ccodeloop %] [% IF ( ccodeloo.code ) == (item.ccode) %] @@ -284,7 +284,7 @@
  8. - [% FOREACH n IN notforloanloop %] [% IF n.code == item.notforloan %] @@ -297,15 +297,15 @@
  9. - +
  10. - +
  11. - [% FOREACH budget_loo IN budget_loop %] [% IF ( budget_loo.b_id ) == ( item.budget_id ) %] @@ -317,15 +317,15 @@
  12. - +
  13. - +
  14. - +
-- 2.39.5