diff --git a/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl b/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl index d81555489d..473a7df402 100644 --- a/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl +++ b/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl @@ -154,12 +154,22 @@ document.lookupinventory.productId.focus(); <#if ! product.equals( productTmp )> <#assign quantityAvailableAtDate = 0> <#assign errorEvents = delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "ERROR", "productId", inven.productId))> - <#assign initialQohEvent = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "INITIAL_QOH", "productId", inven.productId)))> - <#if initialQohEvent?exists && initialQohEvent.eventQuantity?has_content> - <#assign quantityAvailableAtDate = initialQohEvent.eventQuantity> + <#assign qohEvents = delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "INITIAL_QOH", "productId", inven.productId))> + <#assign additionalErrorMessage = ""> + <#assign initialQohEvent = null> + <#assign productFacility = null> + <#if qohEvents?has_content> + <#assign initialQohEvent = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(qohEvents)> - <#if initialQohEvent?exists && initialQohEvent.facilityId?has_content> - <#assign productFacility = delegator.findByPrimaryKey("ProductFacility", Static["org.ofbiz.base.util.UtilMisc"].toMap("facilityId", initialQohEvent.facilityId, "productId", inven.productId))?if_exists> + <#if initialQohEvent != null> + <#if initialQohEvent.eventQuantity?has_content> + <#assign quantityAvailableAtDate = initialQohEvent.eventQuantity> + + <#if initialQohEvent.facilityId?has_content> + <#assign productFacility = delegator.findByPrimaryKey("ProductFacility", Static["org.ofbiz.base.util.UtilMisc"].toMap("facilityId", initialQohEvent.facilityId, "productId", inven.productId))?if_exists> + + <#else> + <#assign additionalErrorMessage = "No QOH information found, assuming 0."> @@ -168,7 +178,7 @@ document.lookupinventory.productId.focus(); - <#if productFacility?exists && productFacility?has_content> + <#if productFacility != null && productFacility?has_content>
${uiLabelMap.ProductFacility}: ${productFacility.facilityId?if_exists}
@@ -187,6 +197,11 @@ document.lookupinventory.productId.focus();
${quantityAvailableAtDate}
+ <#if additionalErrorMessage?has_content> + +
${additionalErrorMessage}
+ + <#list errorEvents as errorEvent>
${errorEvent.eventName?if_exists}