IDEMPIERE-2318: Handling NPE and providing meaning full error message
This commit is contained in:
parent
06bc792db5
commit
7c106e3dda
|
@ -0,0 +1,10 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Nov 17, 2014 6:27:47 PM IST
|
||||
-- IDEMPIERE-2318: Handling NPE for Attribute not set on product and Batch level costing used
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created,Updated) VALUES ('E','No attribute set configured on product ',200328,'D','b8793354-b3b6-4106-8d8a-32d511d5b5d9','NoAttributeSet','Y',100,100,0,0,TO_DATE('2014-11-17 18:27:46','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-11-17 18:27:46','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201411170824_IDEMPIERE-2318.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,7 @@
|
|||
-- Nov 17, 2014 6:27:47 PM IST
|
||||
-- IDEMPIERE-2318: Handling NPE for Attribute not set on product and Batch level costing used
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created,Updated) VALUES ('E','No attribute set configured on product ',200328,'D','b8793354-b3b6-4106-8d8a-32d511d5b5d9','NoAttributeSet','Y',100,100,0,0,TO_TIMESTAMP('2014-11-17 18:27:46','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-11-17 18:27:46','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201411170824_IDEMPIERE-2318.sql') FROM dual
|
||||
;
|
|
@ -1190,6 +1190,11 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
continue;
|
||||
if (product != null && product.isASIMandatory(isSOTrx()))
|
||||
{
|
||||
if(product.getAttributeSet()==null){
|
||||
m_processMsg = "@NoAttributeSet@=" + product.getValue();
|
||||
return DocAction.STATUS_Invalid;
|
||||
|
||||
}
|
||||
if (! product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) {
|
||||
m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() +
|
||||
", @M_Product_ID@=" + product.getValue() + ")";
|
||||
|
|
|
@ -268,6 +268,10 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
|
||||
if (product != null && product.isASIMandatory(isSOTrx()))
|
||||
{
|
||||
if(product.getAttributeSet()==null){
|
||||
log.saveError("NoAttributeSet", product.getValue());
|
||||
return false;
|
||||
}
|
||||
if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, isSOTrx())) {
|
||||
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
|
||||
return false;
|
||||
|
|
|
@ -211,6 +211,10 @@ public class MMovementLine extends X_M_MovementLine
|
|||
// Mandatory Instance
|
||||
MProduct product = getProduct();
|
||||
if (getM_AttributeSetInstance_ID() == 0) {
|
||||
if(product.getAttributeSet()==null){
|
||||
log.saveError("NoAttributeSet", product.getValue());
|
||||
return false;
|
||||
}
|
||||
if (product != null && product.isASIMandatory(true)) {
|
||||
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) {
|
||||
log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
|
||||
|
|
|
@ -1338,6 +1338,11 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
if (line.getM_Product_ID() > 0 && line.getM_AttributeSetInstance_ID() == 0) {
|
||||
MProduct product = line.getProduct();
|
||||
if (product.isASIMandatory(isSOTrx())) {
|
||||
if(product.getAttributeSet()==null){
|
||||
m_processMsg = "@NoAttributeSet@=" + product.getValue();
|
||||
return DocAction.STATUS_Invalid;
|
||||
|
||||
}
|
||||
if (! product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) {
|
||||
StringBuilder msg = new StringBuilder("@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #")
|
||||
.append(line.getLine())
|
||||
|
|
Loading…
Reference in New Issue