diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js b/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js index 283d1cb7a7cdb0568b117c1f8001fe4f7a2ef796..c00baa2b4d1917e12c5fe5ed0db7c0a6d00852bb 100644 --- a/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Offeritem_entity/recordcontainers/db/onDBDelete.js @@ -16,28 +16,15 @@ if(oid != "") deletedIds.push(oiid); var cols = ["NET", "VAT"]; + var vals = oiUtils.getNetAndVat(deletedIds); - var vals = oiUtils.getNetAndVat(deletedIds); var discountedVals = OfferItemUtils.getDiscountedNet(deletedIds, oid, discount); - - let config = entities.createConfigForUpdatingRows() - config.entity("Offer_entity"); - - if(discountedVals){ - config.fieldValues({ - "NET": vals[0], - "VAT": vals[1], - "DISCOUNTED_NET": discountedVals[0], - "DISCOUNTED_VAT": discountedVals[1] - }); - } - else{ - config.fieldValues({ - "NET": vals[0], - "VAT": vals[1] - }); + if(discountedVals) + { + cols.push("DISCOUNTED_NET", "DISCOUNTED_VAT"); + vals = vals.concat(discountedVals); } - config.uid(oid); - entities.updateRow(config); - -} \ No newline at end of file + + newWhere("SALESORDER.SALESORDERID", oid) + .updateData(true, "SALESORDER", cols, null, vals); +}