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> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
5f1c5a04fa
commit
a40c512bf0
2 changed files with 11 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue