From 450af0e28bab1cdc1bab52241a74b60dfd8495c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 13 Oct 2015 05:27:22 +0000 Subject: [PATCH] Bug 14999: Fetch the corresponding values for the specific biblio item Test plan: 1. In acquisitions add orders to basket from a staged file. You need to add orders which when added doesn't show the right quantity/price in the basket (after it has been added). I succeeded in this by selecting order items from under different headings (in the page "Add orders from iso2709 file"). So this means that you would need to have a staged file with multiple sections in it. 2. Notice the problem with the wrong prices and quantities showing in the basket. 3. Apply this patch. 4. Remove those items you added to the basket and add them again and notice that they have now the corresponding values in them in the basket. 5. Look for anomalies. Sponsored-by: Vaara-kirjastot --- acqui/addorderiso2709.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 6bb744f..152eec5 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -171,16 +171,26 @@ if ($op eq ""){ for my $biblio (@$biblios){ # Check if this import_record_id was selected next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected; + + # With this we know from which index from the http params we get the data + my $index; + for (my $i = 0; $i <= $#import_record_id_selected; $i++) { + if ($import_record_id_selected[$i] eq $$biblio{import_record_id}) { + $index = $i; + last; + } + } + my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 ); my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}: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_quantity = $quantities[$index] || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; + my $c_budget_id = $budgets_id[$index] || $input->param('all_budget_id') || $budget_id; + my $c_discount = $discount[$index]; $c_discount = $c_discount / 100 if $c_discount > 1; - my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || ''; - my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || ''; + my $c_sort1 = $sort1[$index] || $input->param('all_sort1') || ''; + my $c_sort2 = $sort2[$index] || $input->param('all_sort2') || ''; # 1st insert the biblio, or find it through matcher unless ( $biblionumber ) { -- 1.9.1