diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java b/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java index 78c7535f43..db6846b241 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportGLJournal.java @@ -460,7 +460,57 @@ public class ImportGLJournal extends SvrProcess no = DB.executeUpdate(sql.toString(), get_TrxName()); if (no != 0) log.warning ("Invalid Project=" + no); + + // tbayen: IDEMPIERE-539 Import GL Window does not allow Key Values for Activity, Campaign, Sales Region + // Set Campaign + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET C_Campaign_ID=(SELECT p.C_Campaign_ID FROM C_Campaign p") + .append(" WHERE p.Value=i.CampaignValue AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) ") + .append("WHERE C_Campaign_ID IS NULL AND CampaignValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + log.fine("Set Campaign from Value=" + no); + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Campaign, '") + .append("WHERE C_Campaign_ID IS NULL AND CampaignValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + if (no != 0) + log.warning ("Invalid Campaign=" + no); + // Set Activity + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET C_Activity_ID=(SELECT p.C_Activity_ID FROM C_Activity p") + .append(" WHERE p.Value=i.ActivityValue AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) ") + .append("WHERE C_Activity_ID IS NULL AND ActivityValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + log.fine("Set Activity from Value=" + no); + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Activity, '") + .append("WHERE C_Activity_ID IS NULL AND ActivityValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + if (no != 0) + log.warning ("Invalid Activity=" + no); + + // Set SalesRegion + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET C_SalesRegion_ID=(SELECT p.C_SalesRegion_ID FROM C_SalesRegion p") + .append(" WHERE p.Value=i.SalesRegionValue AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) ") + .append("WHERE C_SalesRegion_ID IS NULL AND SalesRegionValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + log.fine("Set SalesRegion from Value=" + no); + sql = new StringBuilder ("UPDATE I_GLJournal i ") + .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid SalesRegion, '") + .append("WHERE C_SalesRegion_ID IS NULL AND SalesRegionValue IS NOT NULL") + .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); + no = DB.executeUpdate(sql.toString(), get_TrxName()); + if (no != 0) + log.warning ("Invalid SalesRegion=" + no); + + // Set TrxOrg sql = new StringBuilder ("UPDATE I_GLJournal i ") .append("SET AD_OrgTrx_ID=(SELECT o.AD_Org_ID FROM AD_Org o") diff --git a/org.adempiere.base/src/org/compiere/model/I_I_GLJournal.java b/org.adempiere.base/src/org/compiere/model/I_I_GLJournal.java index 931455f4d8..a1ad28d292 100644 --- a/org.adempiere.base/src/org/compiere/model/I_I_GLJournal.java +++ b/org.adempiere.base/src/org/compiere/model/I_I_GLJournal.java @@ -82,6 +82,15 @@ public interface I_I_GLJournal */ public String getAcctSchemaName(); + /** Column name ActivityValue */ + public static final String COLUMNNAME_ActivityValue = "ActivityValue"; + + /** Set Activity Value */ + public void setActivityValue (String ActivityValue); + + /** Get Activity Value */ + public String getActivityValue(); + /** Column name AD_Client_ID */ public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; @@ -250,6 +259,15 @@ public interface I_I_GLJournal public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException; + /** Column name CampaignValue */ + public static final String COLUMNNAME_CampaignValue = "CampaignValue"; + + /** Set CampaignValue */ + public void setCampaignValue (String CampaignValue); + + /** Get CampaignValue */ + public String getCampaignValue(); + /** Column name CategoryName */ public static final String COLUMNNAME_CategoryName = "CategoryName"; @@ -853,6 +871,19 @@ public interface I_I_GLJournal */ public BigDecimal getQty(); + /** Column name SalesRegionValue */ + public static final String COLUMNNAME_SalesRegionValue = "SalesRegionValue"; + + /** Set Sales Region Value. + * Key of the Sales Region + */ + public void setSalesRegionValue (String SalesRegionValue); + + /** Get Sales Region Value. + * Key of the Sales Region + */ + public String getSalesRegionValue(); + /** Column name SKU */ public static final String COLUMNNAME_SKU = "SKU"; diff --git a/org.adempiere.base/src/org/compiere/model/X_I_GLJournal.java b/org.adempiere.base/src/org/compiere/model/X_I_GLJournal.java index 5b1029f053..29b51cc5ef 100644 --- a/org.adempiere.base/src/org/compiere/model/X_I_GLJournal.java +++ b/org.adempiere.base/src/org/compiere/model/X_I_GLJournal.java @@ -33,7 +33,7 @@ public class X_I_GLJournal extends PO implements I_I_GLJournal, I_Persistent /** * */ - private static final long serialVersionUID = 20121031L; + private static final long serialVersionUID = 20121226L; /** Standard Constructor */ public X_I_GLJournal (Properties ctx, int I_GLJournal_ID, String trxName) @@ -136,6 +136,20 @@ public class X_I_GLJournal extends PO implements I_I_GLJournal, I_Persistent return (String)get_Value(COLUMNNAME_AcctSchemaName); } + /** Set Activity Value. + @param ActivityValue Activity Value */ + public void setActivityValue (String ActivityValue) + { + set_Value (COLUMNNAME_ActivityValue, ActivityValue); + } + + /** Get Activity Value. + @return Activity Value */ + public String getActivityValue () + { + return (String)get_Value(COLUMNNAME_ActivityValue); + } + /** Set Document Org. @param AD_OrgDoc_ID Document Organization (independent from account organization) @@ -369,6 +383,20 @@ public class X_I_GLJournal extends PO implements I_I_GLJournal, I_Persistent return ii.intValue(); } + /** Set CampaignValue. + @param CampaignValue CampaignValue */ + public void setCampaignValue (String CampaignValue) + { + set_Value (COLUMNNAME_CampaignValue, CampaignValue); + } + + /** Get CampaignValue. + @return CampaignValue */ + public String getCampaignValue () + { + return (String)get_Value(COLUMNNAME_CampaignValue); + } + /** Set Category Name. @param CategoryName Name of the Category @@ -1346,6 +1374,23 @@ public class X_I_GLJournal extends PO implements I_I_GLJournal, I_Persistent return bd; } + /** Set Sales Region Value. + @param SalesRegionValue + Key of the Sales Region + */ + public void setSalesRegionValue (String SalesRegionValue) + { + set_Value (COLUMNNAME_SalesRegionValue, SalesRegionValue); + } + + /** Get Sales Region Value. + @return Key of the Sales Region + */ + public String getSalesRegionValue () + { + return (String)get_Value(COLUMNNAME_SalesRegionValue); + } + /** Set SKU. @param SKU Stock Keeping Unit