IDEMPIERE-2658 Show bpartner name instead of user name in description of allocations generated from Payment Allocation

This commit is contained in:
Nicolas Micoud 2015-07-29 10:23:40 -05:00
parent b96bfd7229
commit 37f512dbd6
5 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,10 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2658 - Show bpartner name instead of user name in description of allocations generated from Payment Allocation
-- Jul 29, 2015 4:16:23 PM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200064,0,0,TO_DATE('2015-07-29 16:16:22','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2015-07-29 16:16:22','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOCATION_DESCRIPTION','@#AD_User_Name@','Description of allocation generated through the Allocation (manual) form','D','C','3a12099d-4449-43ee-b8b2-5738a7c96d94')
;
SELECT register_migration_script('201507291615_IDEMPIERE-2658.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-2658 - Show bpartner name instead of user name in description of allocations generated from Payment Allocation
-- Jul 29, 2015 4:16:23 PM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200064,0,0,TO_TIMESTAMP('2015-07-29 16:16:22','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2015-07-29 16:16:22','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOCATION_DESCRIPTION','@#AD_User_Name@','Description of allocation generated through the Allocation (manual) form','D','C','3a12099d-4449-43ee-b8b2-5738a7c96d94')
;
SELECT register_migration_script('201507291615_IDEMPIERE-2658.sql') FROM dual
;

View File

@ -54,7 +54,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
/**
*
*/
private static final long serialVersionUID = 8726957992840702609L;
private static final long serialVersionUID = -7787519874581251920L;
/** Tolerance Gain and Loss */
private static final BigDecimal TOLERANCE = BigDecimal.valueOf(0.02);
@ -1256,4 +1256,18 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{
return m_reversal;
} // isReversal
/** Returns a description parsing the bpartner defined in the Allocation form and then the allocation itself */
public String getDescriptionForManualAllocation(int bpartnerID, String trxName)
{
String sysconfig_desc = MSysConfig.getValue(MSysConfig.ALLOCATION_DESCRIPTION, "@#AD_User_Name@", getAD_Client_ID());
String description = "";
if (sysconfig_desc.contains("@")) {
description = Env.parseVariable(sysconfig_desc, new MBPartner(getCtx(), bpartnerID, null), trxName, true);
description = Env.parseVariable(description, this, trxName, true);
} else
description = Env.getContext(getCtx(), "#AD_User_Name"); // just to be sure
return description;
}
} // MAllocation

View File

@ -42,10 +42,11 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 6107779915945715515L;
private static final long serialVersionUID = 4290286149969983294L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
public static final String ALLOCATION_DESCRIPTION = "ALLOCATION_DESCRIPTION";
public static final String ALLOW_APPLY_PAYMENT_TO_CREDITMEMO = "ALLOW_APPLY_PAYMENT_TO_CREDITMEMO";
public static final String ALLOW_OVER_APPLIED_PAYMENT = "ALLOW_OVER_APPLIED_PAYMENT";
public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole";

View File

@ -659,6 +659,7 @@ public class Allocation
DateTrx, C_Currency_ID, Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName);
alloc.setAD_Org_ID(AD_Org_ID);
alloc.setC_DocType_ID(m_C_DocType_ID);
alloc.setDescription(alloc.getDescriptionForManualAllocation(m_C_BPartner_ID, trxName));
alloc.saveEx();
// For all invoices
BigDecimal unmatchedApplied = Env.ZERO;