From eaaf41d7a962e408faee1abdee1deb43f97ccb71 Mon Sep 17 00:00:00 2001 From: Daniel Watford Date: Fri, 28 May 2021 10:29:57 +0100 Subject: [PATCH] Fixed: Default From Date for Product Config Item Content truncated to seconds rather than milliseconds. (OFBIZ-12246) There was a mismatch in timestamp resolution. Updates to Product Config Item Contents rely on second resolution timestamps for finding records to update. By default, millisecond resolution timestamps were created for config item contents' From Date which caused records to not be found during update operations. Also made From Date a display-only field when editing a config item content since it is a primary key and cannot be modified. --- .../product/config/ProductConfigItemContentServices.groovy | 7 +++++-- applications/product/widget/catalog/ConfigForms.xml | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/applications/product/groovyScripts/product/config/ProductConfigItemContentServices.groovy b/applications/product/groovyScripts/product/config/ProductConfigItemContentServices.groovy index be7f42de17a..0f446b7422a 100644 --- a/applications/product/groovyScripts/product/config/ProductConfigItemContentServices.groovy +++ b/applications/product/groovyScripts/product/config/ProductConfigItemContentServices.groovy @@ -30,7 +30,7 @@ def createProductConfigItemContent() { Map result = success() GenericValue newEntity = makeValue("ProdConfItemContent", parameters) if (!newEntity.fromDate) { - newEntity.fromDate = UtilDateTime.nowTimestamp() + newEntity.fromDate = UtilDateTime.getTimestamp(System.currentTimeSeconds() * 1000) } newEntity.create() @@ -47,7 +47,10 @@ def createProductConfigItemContent() { * Update Content For ProductConfigItem */ def updateProductConfigItemContent() { - GenericValue lookedUpValue = from("ProdConfItemContent").where(parameters).queryOne() + GenericValue pkParameters = makeValue("ProdConfItemContent") + pkParameters.setPKFields(parameters) + + GenericValue lookedUpValue = from("ProdConfItemContent").where(pkParameters).queryOne() lookedUpValue.setNonPKFields(parameters) lookedUpValue.store() diff --git a/applications/product/widget/catalog/ConfigForms.xml b/applications/product/widget/catalog/ConfigForms.xml index 9c618c5aabd..291b1c8be2d 100644 --- a/applications/product/widget/catalog/ConfigForms.xml +++ b/applications/product/widget/catalog/ConfigForms.xml @@ -177,8 +177,9 @@ under the License. header-row-style="header-row" default-table-style="basic-table"> - - + + +