Bugzilla – Attachment 152612 Details for
Bug 34022
Adding items on receive is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34022: Adjust items data structure
Bug-34022-Adjust-items-data-structure.patch (text/plain), 3.92 KB, created by
PTFS Europe Sandboxes
on 2023-06-23 06:40:44 UTC
(
hide
)
Description:
Bug 34022: Adjust items data structure
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2023-06-23 06:40:44 UTC
Size:
3.92 KB
patch
obsolete
>From e0d5f1fc791128366e5f77148442e97970f16a5f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 22 Jun 2023 16:06:11 -0300 >Subject: [PATCH] Bug 34022: Adjust items data structure > >When creating items at receiving, the generated data structure didn't >match what the code expected, so this patch adapts the code to match the >new data structure introduced by bug 8179. > >Once I fixed that, I noticed that the $.ajax request payload, when it >contains an array parameter, it renames it like `param[]`. So the >finishreceive.pl controller is adjusted to this behaviour for the 'on >receiving' use case. > >To test: >1. Apply this patch >2. Create a basket with 'create items on receive' >3. Create an order line >4. Close basket >5. Receive shipment >6. Enter invoice number >7. Click on Receive link in the table >8. Fill out item form, make sure all mandatory fields are set >9. Save >10. Verify that the order line is marked as 'received' >11. Verify that there item is created on the record >=> SUCCESS: Works as expected >12. Sign off :-D > >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >--- > acqui/finishreceive.pl | 10 +++++----- > .../prog/en/modules/acqui/orderreceive.tt | 14 ++++++-------- > 2 files changed, 11 insertions(+), 13 deletions(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index b682724139..a9803b8542 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -145,11 +145,11 @@ if ($quantityrec > $origquantityrec ) { > # now, add items if applicable > if ($basket->effective_create_items eq 'receiving') { > >- my @tags = $input->multi_param('tag'); >- my @subfields = $input->multi_param('subfield'); >- my @field_values = $input->multi_param('field_value'); >- my @serials = $input->multi_param('serial'); >- my @itemid = $input->multi_param('itemid'); >+ my @tags = $input->multi_param('tag[]'); >+ my @subfields = $input->multi_param('subfield[]'); >+ my @field_values = $input->multi_param('field_value[]'); >+ my @serials = $input->multi_param('serial[]'); >+ my @itemid = $input->multi_param('itemid[]'); > #Rebuilding ALL the data for items into a hash > # parting them on $itemid. > my %itemhash; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 749e68dc70..6a0091244e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -695,14 +695,12 @@ > params['replacementprice'] = row.replacement_price; > params['unitprice'] = ( invoiceincgst=="1" ) ? ( row.unit_price_tax_included || row.ecost_tax_included ) : ( row.unit_price_tax_excluded || row.ecost_tax_excluded ); > params['order_internalnote'] = row.internal_note; >- if(effective_create_items == 'receiving') { >- Object.keys(row.items).forEach(function(key) { >- var item = row.items[key]; >- Object.keys(item).forEach(function(key) { >- var field = item[key]; >- Object.keys(field).forEach(function(key) { >- if(!params[key]) params[key] = []; >- params[key].push(item[key]); >+ if (effective_create_items == 'receiving') { >+ row.items.forEach(function(item){ >+ Object.keys(item).forEach(function(item_field){ >+ Object.keys(item[item_field]).forEach(function(key){ >+ if (!params[key]) params[key] = []; >+ params[key].push(item[item_field][key]); > }); > }); > }); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34022
:
152377
|
152383
|
152581
|
152612
|
152619