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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-11-03 20:10:01 +00:00 committed by Tomas Cohen Arazi
parent 64edb69245
commit 7e2f6d66d6
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -188,20 +188,20 @@
</li>
<li class="quantity">
<label for="quantity_record_[% biblio.import_record_id | html %]" class="required">Quantity: </label>
<input id="quantity_record_[% biblio.import_record_id | html %]" type="text" pattern="[0-9]+" value="[% biblio.quantity.length ? biblio.quantity : 1 | html %]" name="quantity" />
<input id="quantity_record_[% biblio.import_record_id | html %]" type="text" pattern="[0-9]+" value="[% biblio.quantity.length ? biblio.quantity : 1 | html %]" name="quantity_[% biblio.import_record_id | html %]" />
<span class="required">Required</span>
</li>
<li class="price">
<label for="price_record_[% biblio.import_record_id | html %]">Price: </label>
<input id="price_record_[% biblio.import_record_id | html %]" class="decimal" type="text" value="[% biblio.price | $Price on_editing => 1 %]" name="price" />
<input id="price_record_[% biblio.import_record_id | html %]" class="decimal" type="text" value="[% biblio.price | $Price on_editing => 1 %]" name="price_[% biblio.import_record_id | html %]" />
</li>
<li class="replacementprice">
<label for="replacementprice_record_[% biblio.import_record_id | html %]">Replacement price: </label>
<input id="replacementprice_record_[% biblio.import_record_id | html %]" class="decimal" type="text" value="[% biblio.replacementprice | $Price on_editing => 1 %]" name="replacementprice" />
<input id="replacementprice_record_[% biblio.import_record_id | html %]" class="decimal" type="text" value="[% biblio.replacementprice | $Price on_editing => 1 %]" name="replacementprice_[% biblio.import_record_id | html %]" />
</li>
<li class="discount">
<label for="discount_record_[% biblio.import_record_id | html %]">Discount: </label>
<input id="discount_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.discount | html %]" name="discount" size="6" /> %
<input id="discount_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.discount | html %]" name="discount_[% biblio.import_record_id | html %]" size="6" /> %
<div class="hint">If empty, discount rate from vendor will be used</div>
</li>
<li class="fund">
@ -210,7 +210,7 @@
<input type="hidden" size="20" name="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
[% ELSE %]
<label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
<select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id">
<select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
<option value="">Select a fund (will use default if set)</option>
[% FOREACH budget IN budget_loop %]
[% IF ( budget.b_id == biblio.budget_id ) %]
@ -231,11 +231,11 @@
</li>
<li class="sort1">
<label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
<input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1" value="[% biblio.sort1 | html %]" />
<input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1_[% biblio.import_record_id | html %]" value="[% biblio.sort1 | html %]" />
</li>
<li class="sort2">
<label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
<input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
<input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2_[% biblio.import_record_id | html %]" value="[% biblio.sort2 | html %]" />
</li>
</ol>
[% IF ( biblio.iteminfos.size ) %]