Bug 14999: Make sure order prices are not mixed-up
authorJoonas Kylmälä <joonas.kylmala@iki.fi>
Sat, 2 Oct 2021 12:28:52 +0000 (12:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 2 Nov 2021 13:57:06 +0000 (14:57 +0100)
commitae84b13e48752e063e63572123f879ca9c87d615
treebdebbe22febdbe036b420d20101c10c1215b071c
parent134e9715d2e29f6077fbb15c28188b9dfb4fb739
Bug 14999: Make sure order prices are not mixed-up

We were shifting the price and replacement price for imported orders
only after the line:

> $duplinbatch = $import_batch_id and next if $duplifound;

This lead to the "replacementprice" and "price" query parameters not
being shifted/removed from the list if a duplicate record came across
and caused the prices be applied to the next record being imported.

To reproduce:
 1) Download two records from koha to marcxml file, then cat those:
   cat bib1.marcxml bib2.marcxml > bibs.marcxml
 2) Delete bib2 from koha
 3) Stage bibs.marcxml for import
 4) Create a new order basket, then "Add to basket" using "From a
    staged file" option
 5) Select both bib1 and bib2 and set price & replacement price for
    bib1 to be 99.00 and for bib2 to be 88.00
 6) Click save and notice bib2 was imported with the wrong prices, 99.00!
 7) Apply patch and notice the prices are now correctly set to 88.00.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
acqui/addorderiso2709.pl