When adding order lines to a basket from a staged marc file using the mappings in MarcItemFieldsToOrder a default budget should be selected when adding order lines if no budget is selected in the UI. Currently this does not happen and the order line creation fails. To replicate: 1) Add the following to the syspref MarcItemFieldsToOrder homebranch: 975$a holdingbranch: 975$b itype: 975$y nonpublic_note: 975$x public_note: 975$z loc: 975$c ccode: 975$8 notforloan: 975$7 uri: 975$u copyno: 975$n quantity: 975$q budget_code: 975$h price: 975$p replacementprice: 975$v 2) Save the file attached ready to stage 3) Navigate to Acquisitions, choose a vendor and then create/choose a basket 4) Click Add to basket and then From a new file 5) Choose the file you just saved 6) Change the Record matching rule to ISBN and the Action if matching record found to Ignore incoming record. Click stage for import 7) When the job progress is complete, click the Add staged files to basket button 8) Click on the Item information tab and in field y - Koha item type select Books 9) Click Select all on the table 10) Observe that under Item record 1, the budget_code field says "Select a fund...". Do not change this field, this is just to show that no budget has been selected 11) At the bottom of the form, click Save 12) You should be back on the basket page - observe that no order lines have been added
Created attachment 154084 [details] Test file with mapped fields
Created attachment 154085 [details] [review] Bug 34445: Set default budget in addorderiso2709.pl This patch allows the default budget to be used as a fallback if no budget is selected. Currently the default budget is set using lines 129-133 but then is never used. Test plan: 1) Apply patch 2) restart_all 3) Follow the steps from the bug description 4) Order lines should be added properly
Created attachment 154413 [details] [review] Bug 34445: Set default budget in addorderiso2709.pl This patch allows the default budget to be used as a fallback if no budget is selected. Currently the default budget is set using lines 129-133 but then is never used. Test plan: 1) Apply patch 2) restart_all 3) Follow the steps from the bug description 4) Order lines should be added properly Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
WARN tidiness The file is less tidy than before (bad/messy lines before: 307, now: 308) Please correct. This is a oneliner patch. Should be possible to tidy :)
Created attachment 154791 [details] [review] Bug 34445: (QA follow-up) Tidy file perl tidy for patch
Please squash. Note that perltidy does not like for (my $i = 0; $i < $count; $i++) { + # Use default budget if no budget selected in the UI + $budget_codes[$i] = $budget_id + if !$budget_codes[$i]; It seems to insert an empty line before the new comment line.. Sorry about that, i think it is nonsense.. Another question: You are putting an id in a field called budget_code. Are you really sure that this is correct?? It does not look good.
The terminology is confusing, I think budget_codes needs changing to budget_ids because the values in the array are the integer values from the budget_id fields in aqbudgets. I'll change it and re-upload
Created attachment 154795 [details] [review] Bug 34445: Set default budget in addorderiso2709.pl This patch allows the default budget to be used as a fallback if no budget is selected. Currently the default budget is set using lines 129-133 but then is never used. QA follow-up: - perl tidied - budget_codes changed to budget_ids for consistency Test plan: 1) Apply patch 2) restart_all 3) Follow the steps from the bug description 4) Order lines should be added properly
Created attachment 154874 [details] [review] Bug 34445: Set default budget in addorderiso2709.pl This patch allows the default budget to be used as a fallback if no budget is selected. Currently the default budget is set using lines 129-133 but then is never used. QA follow-up: - perl tidied - budget_codes changed to budget_ids for consistency Test plan: 1) Apply patch 2) restart_all 3) Follow the steps from the bug description 4) Order lines should be added properly Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] Rearranged comments
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.04
Nice work everyone! Pushed to oldstable for 22.11.x