Update of /cvsroot/compiere/dbPort/src/org/compiere/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26996/src/org/compiere/model Modified Files: MAccount.java MConversionRate.java MLookup.java MRole.java MTabVO.java M_Table.java Added Files: MSalesRegion.java Log Message: . --- NEW FILE: MSalesRegion.java --- /****************************************************************************** * The contents of this file are subject to the Compiere License Version 1.1 * ("License"); You may not use this file except in compliance with the License * You may obtain a copy of the License at http://www.compiere.org/license.html * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * The Original Code is Compiere ERP & CRM Business Solution * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc. * Portions created by Jorg Janke are Copyright (C) 1999-2004 Jorg Janke, parts * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved. * Contributor(s): ______________________________________. *****************************************************************************/ package org.compiere.model; import java.sql.*; import java.util.*; import org.compiere.util.*; /** * Sales Region Model * * @author Jorg Janke * @version $Id: MSalesRegion.java,v 1.1 2004/07/27 06:55:12 jjanke Exp $ */ public class MSalesRegion extends X_C_SalesRegion { /** * Get SalesRegion from Cache * @param ctx context * @param C_SalesRegion_ID id * @return MSalesRegion */ public static MSalesRegion get (Properties ctx, int C_SalesRegion_ID) { Integer key = new Integer (C_SalesRegion_ID); MSalesRegion retValue = (MSalesRegion) s_cache.get (key); if (retValue != null) return retValue; retValue = new MSalesRegion (ctx, C_SalesRegion_ID); if (retValue.getID () != 0) s_cache.put (key, retValue); return retValue; } // get /** Cache */ private static CCache s_cache = new CCache ("C_SalesRegion", 10); /************************************************************************** * Default Constructor * @param ctx context * @param C_SalesRegion_ID id */ public MSalesRegion (Properties ctx, int C_SalesRegion_ID) { super (ctx, C_SalesRegion_ID); } // MSalesRegion /** * Load Constructor * @param ctx context * @param rs result set */ public MSalesRegion (Properties ctx, ResultSet rs) { super (ctx, rs); } // MSalesRegion } // MSalesRegion Index: MAccount.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/MAccount.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MAccount.java 14 Jun 2004 17:21:46 -0000 1.3 --- MAccount.java 27 Jul 2004 06:55:12 -0000 1.4 *************** *** 28,36 **** { /** ! * Get Account ! * @return account */ public static MAccount get (Properties ctx, ! int AD_Org_ID, int C_AcctSchema_ID, int Account_ID, int M_Product_ID, int C_BPartner_ID, int AD_OrgTrx_ID, int C_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID, --- 28,36 ---- { /** ! * Get existing Account or create it ! * @return account or null */ public static MAccount get (Properties ctx, ! int AD_Client_ID, int AD_Org_ID, int C_AcctSchema_ID, int Account_ID, int M_Product_ID, int C_BPartner_ID, int AD_OrgTrx_ID, int C_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID, *************** *** 38,138 **** int User1_ID, int User2_ID) { ! int C_ValidCombination_ID = 0; try { ! String SQL = "{CALL C_ValidCombination_Get(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?)}"; ! CallableStatement cstmt = DB.prepareCall(SQL); ! // 1 - ID ! cstmt.registerOutParameter(1, Types.NUMERIC); ! // -- Mandatory Accounting fields ! // 2 - AD_Client_ID ! cstmt.setInt(2, Env.getAD_Client_ID(ctx)); ! // 3 - AD_Org_ID ! cstmt.setInt(3, AD_Org_ID); ! // 4- C_AcctSchema_ID ! cstmt.setInt(4, C_AcctSchema_ID); ! // 5 - Account_ID ! cstmt.setInt(5, Account_ID); ! ! // -- Optional ! // 6 - Base C_ValidCombination_ID ! cstmt.setNull(6, Types.NUMERIC); ! // 7 - MustBeFullyQualified ! cstmt.setString(7, "Y"); ! // 8 - Alias ! cstmt.setNull(8, Types.VARCHAR); ! // 9 - CreatedBy ! cstmt.setInt(9, Env.getAD_User_ID(ctx)); ! // -- Optional Accounting fields ! // 10 - M_Product_ID ! if (M_Product_ID != 0) ! cstmt.setInt(10, M_Product_ID); else ! cstmt.setNull(10, Types.NUMERIC); ! // 11 - C_BPartner_ID ! if (C_BPartner_ID != 0) ! cstmt.setInt(11, C_BPartner_ID); else ! cstmt.setNull(11, Types.NUMERIC); ! // 12 - AD_OrgTrx_ID ! if (AD_OrgTrx_ID != 0) ! cstmt.setInt(12, AD_OrgTrx_ID); else ! cstmt.setNull(12, Types.NUMERIC); ! // 13 - C_LocFrom_ID ! if (C_LocFrom_ID != 0) ! cstmt.setInt(13, C_LocFrom_ID); else ! cstmt.setNull(13, Types.NUMERIC); ! // 14 - C_LocTo_ID ! if (C_LocTo_ID != 0) ! cstmt.setInt(14, C_LocTo_ID); else ! cstmt.setNull(14, Types.NUMERIC); ! // 15 - C_SalesRegion_ID ! if (C_SalesRegion_ID != 0) ! cstmt.setInt(15, C_SalesRegion_ID); else ! cstmt.setNull(15, Types.NUMERIC); ! // 16 - C_Project_ID ! if (C_Project_ID != 0) ! cstmt.setInt(16, C_Project_ID); else ! cstmt.setNull(16, Types.NUMERIC); ! // 17 - C_Campaign_ID ! if (C_Campaign_ID != 0) ! cstmt.setInt(17, C_Campaign_ID); else ! cstmt.setNull(17, Types.NUMERIC); ! // 18 - C_Activity_ID ! if (C_Activity_ID != 0) ! cstmt.setInt(18, C_Activity_ID); else ! cstmt.setNull(18, Types.NUMERIC); ! // 19 - User1_ID ! if (User1_ID != 0) ! cstmt.setInt(19, User1_ID); else ! cstmt.setNull(19, Types.NUMERIC); ! // 20 - User2_ID ! if (User2_ID != 0) ! cstmt.setInt(20, User2_ID); else ! cstmt.setNull(20, Types.NUMERIC); ! // ! cstmt.executeUpdate(); ! C_ValidCombination_ID = cstmt.getInt(1); // 1 - ID ! cstmt.close(); } catch(SQLException e) { ! s_log.error("get", e); } ! // ! MAccount acct = new MAccount (ctx, C_ValidCombination_ID); ! return acct; } // get --- 38,203 ---- int User1_ID, int User2_ID) { ! MAccount existingAccount = null; ! MAccount newAccount = new MAccount (ctx, 0); ! StringBuffer info = new StringBuffer(); ! // ! StringBuffer sql = new StringBuffer("SELECT * FROM C_ValidCombination " ! // Mandatory fields ! + "WHERE AD_Client_ID=?" // #1 ! + " AND AD_Org_ID=?" ! + " AND C_AcctSchema_ID=?" ! + " AND Account_ID=?"); // #4 ! // Optional fields ! sql.append(" AND M_Product_ID=?" // #5 ! + " AND C_BPartner_ID=?" ! + " AND AD_OrgTrx_ID=?" ! + " AND C_LocFrom_ID=?" ! + " AND C_LocTo_ID=?" ! + " AND C_SalesRegion_ID=?" // #10 ! + " AND C_Project_ID=?" ! + " AND C_Campaign_ID=?" ! + " AND C_Activity_ID=?" ! + " AND User1_ID=?" ! + " AND User2_ID=?" // #15 ! + " AND IsActive='Y'"); ! // sql.append(" ORDER BY IsFullyQualified DESC"); try { ! PreparedStatement pstmt = DB.prepareStatement(sql.toString()); // -- Mandatory Accounting fields ! pstmt.setInt(1, AD_Client_ID); ! pstmt.setInt(2, AD_Org_ID); ! newAccount.setClientOrg(AD_Client_ID, AD_Org_ID); ! info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID); ! // ! pstmt.setInt(3, C_AcctSchema_ID); ! newAccount.setC_AcctSchema_ID(C_AcctSchema_ID); ! info.append(",C_AcctSchema_ID=").append(C_AcctSchema_ID); ! // ! pstmt.setInt(4, Account_ID); ! newAccount.setAccount_ID(Account_ID); ! info.append(",Account_ID=").append(Account_ID).append(" "); ! // -- Optional Accounting fields ! if (M_Product_ID == 0) ! pstmt.setNull(5, Types.NUMERIC); else ! { ! pstmt.setInt(5, M_Product_ID); ! newAccount.setM_Product_ID(M_Product_ID); ! info.append(",M_Product_ID=").append(M_Product_ID); ! } ! // ! if (C_BPartner_ID == 0) ! pstmt.setNull(6, Types.NUMERIC); else ! { ! pstmt.setInt(6, C_BPartner_ID); ! newAccount.setC_BPartner_ID(C_BPartner_ID); ! info.append(",C_BPartner_ID=").append(C_BPartner_ID); ! } ! // ! if (AD_OrgTrx_ID == 0) ! pstmt.setNull(7, Types.NUMERIC); else ! { ! pstmt.setInt(7, AD_OrgTrx_ID); ! newAccount.setAD_OrgTrx_ID(AD_OrgTrx_ID); ! info.append(",AD_OrgTrx_ID=").append(AD_OrgTrx_ID); ! } ! // ! if (C_LocFrom_ID == 0) ! pstmt.setNull(8, Types.NUMERIC); else ! { ! pstmt.setInt(8, C_LocFrom_ID); ! newAccount.setC_LocFrom_ID(C_LocFrom_ID); ! info.append(",C_LocFrom_ID=").append(C_LocFrom_ID); ! } ! // ! if (C_LocTo_ID == 0) ! pstmt.setNull(9, Types.NUMERIC); else ! { ! pstmt.setInt(9, C_LocTo_ID); ! newAccount.setC_LocTo_ID(C_LocTo_ID); ! info.append(",C_LocTo_ID=").append(C_LocTo_ID); ! } ! // ! if (C_SalesRegion_ID == 0) ! pstmt.setNull(10, Types.NUMERIC); else ! { ! pstmt.setInt(10, C_SalesRegion_ID); ! newAccount.setC_SalesRegion_ID(C_SalesRegion_ID); ! info.append(",C_SalesRegion_ID=").append(C_SalesRegion_ID); ! } ! // ! if (C_Project_ID == 0) ! pstmt.setNull(11, Types.NUMERIC); else ! { ! pstmt.setInt(11, C_Project_ID); ! newAccount.setC_Project_ID(C_Project_ID); ! info.append(",C_Project_ID=").append(C_Project_ID); ! } ! // ! if (C_Campaign_ID == 0) ! pstmt.setNull(12, Types.NUMERIC); else ! { ! pstmt.setInt(12, C_Campaign_ID); ! newAccount.setC_Campaign_ID(C_Campaign_ID); ! info.append(",C_Campaign_ID=").append(C_Campaign_ID); ! } ! // ! if (C_Activity_ID == 0) ! pstmt.setNull(13, Types.NUMERIC); else ! { ! pstmt.setInt(13, C_Activity_ID); ! newAccount.setC_Activity_ID(C_Activity_ID); ! info.append(",C_Activity_ID=").append(C_Activity_ID); ! } ! // ! if (User1_ID == 0) ! pstmt.setNull(14, Types.NUMERIC); else ! { ! pstmt.setInt(14, User1_ID); ! newAccount.setUser1_ID(User1_ID); ! info.append(",User1_ID=").append(User1_ID); ! } ! pstmt.setNull(14, Types.NUMERIC); ! // ! if (User2_ID == 0) ! pstmt.setNull(15, Types.NUMERIC); else ! { ! pstmt.setInt(15, User2_ID); ! newAccount.setUser2_ID(User2_ID); ! info.append(",User2_ID=").append(User2_ID); ! } // ! ResultSet rs = pstmt.executeQuery(); ! if (rs.next()) ! existingAccount = new MAccount (ctx, rs); ! rs.close(); ! pstmt.close(); } catch(SQLException e) { ! s_log.error("get - " + info, e); } ! // Existing ! if (existingAccount != null) ! return existingAccount; ! // New ! if (!newAccount.save()) ! { ! s_log.error("get - could not create new account - " + info); ! return null; ! } ! return newAccount; } // get *************** *** 211,214 **** --- 276,282 ---- } // getAccount + /** Logger */ + private static Logger s_log = Logger.getCLogger (MAccount.class); + /************************************************************************** *************** *** 249,388 **** } // Account ! /** Logger */ ! private static Logger s_log = Logger.getCLogger (MAccount.class); ! ! /** The Natural Account */ ! private MElementValue m_account = null; ! ! ! /** ! * Save ! * @param AD_Client_ID new client ! * @param UpdatedBy updated ! * @return true if saved ! */ ! public boolean save (int AD_Client_ID, int UpdatedBy) ! { ! setAD_Client_ID (AD_Client_ID); ! setUpdatedBy(UpdatedBy); ! return save(); ! } // save ! ! /** ! * Save and reload ! * @return true if saved ! */ ! public boolean save() ! { ! log.debug("save - Client_ID=" ! + getAD_Client_ID() + ", Org_ID=" + getAD_Org_ID() ! + " - AcctSchema_ID=" + getC_AcctSchema_ID() + ", Account_ID=" + getAccount_ID()); ! ! int C_ValidCombination_ID = 0; ! boolean saved = false; ! try ! { ! String SQL = "{CALL C_ValidCombination_Get(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?)}"; ! CallableStatement cstmt = DB.prepareCall(SQL); ! // 1 - ID ! cstmt.registerOutParameter(1, Types.NUMERIC); ! ! // -- Mandatory Accounting fields ! // 2 - AD_Client_ID ! cstmt.setInt(2, getAD_Client_ID()); ! // 3 - AD_Org_ID ! cstmt.setInt(3, getAD_Org_ID()); ! // 4- C_AcctSchema_ID ! cstmt.setInt(4, getC_AcctSchema_ID()); ! // 5 - Account_ID ! cstmt.setInt(5, getAccount_ID()); ! ! // -- Optional ! // 6 - Base C_ValidCombination_ID ! cstmt.setNull(6, Types.NUMERIC); ! // 7 - MustBeFullyQualified ! cstmt.setString(7, "Y"); ! // 8 - Alias ! if (getAlias() != null && getAlias().length() > 0) ! cstmt.setString(8, getAlias()); ! else ! cstmt.setNull(8, Types.VARCHAR); ! // 9 - CreatedBy ! cstmt.setInt(9, getUpdatedBy()); ! ! // -- Optional Accounting fields ! // 10 - M_Product_ID ! if (getM_Product_ID() != 0) ! cstmt.setInt(10, getM_Product_ID()); ! else ! cstmt.setNull(10, Types.NUMERIC); ! // 11 - C_BPartner_ID ! if (getC_BPartner_ID() != 0) ! cstmt.setInt(11, getC_BPartner_ID()); ! else ! cstmt.setNull(11, Types.NUMERIC); ! // 12 - AD_OrgTrx_ID ! if (getAD_OrgTrx_ID() != 0) ! cstmt.setInt(12, getAD_OrgTrx_ID()); ! else ! cstmt.setNull(12, Types.NUMERIC); ! // 13 - C_LocFrom_ID ! if (getC_LocFrom_ID() != 0) ! cstmt.setInt(13, getC_LocFrom_ID()); ! else ! cstmt.setNull(13, Types.NUMERIC); ! // 14 - C_LocTo_ID ! if (getC_LocTo_ID() != 0) ! cstmt.setInt(14, getC_LocTo_ID()); ! else ! cstmt.setNull(14, Types.NUMERIC); ! // 15 - C_SalesRegion_ID ! if (getC_SalesRegion_ID() != 0) ! cstmt.setInt(15, getC_SalesRegion_ID()); ! else ! cstmt.setNull(15, Types.NUMERIC); ! // 16 - C_Project_ID ! if (getC_Project_ID() != 0) ! cstmt.setInt(16, getC_Project_ID()); ! else ! cstmt.setNull(16, Types.NUMERIC); ! // 17 - C_Campaign_ID ! if (getC_Campaign_ID() != 0) ! cstmt.setInt(17, getC_Campaign_ID()); ! else ! cstmt.setNull(17, Types.NUMERIC); ! // 18 - C_Activity_ID ! if (getC_Activity_ID() != 0) ! cstmt.setInt(18, getC_Activity_ID()); ! else ! cstmt.setNull(18, Types.NUMERIC); ! // 19 - User1_ID ! if (getUser1_ID() != 0) ! cstmt.setInt(19, getUser1_ID()); ! else ! cstmt.setNull(19, Types.NUMERIC); ! // 20 - User2_ID ! if (getUser2_ID() != 0) ! cstmt.setInt(20, getUser2_ID()); ! else ! cstmt.setNull(20, Types.NUMERIC); ! ! // ! cstmt.executeUpdate(); ! C_ValidCombination_ID = cstmt.getInt(1); // 1 - ID ! cstmt.close(); ! saved = true; ! } ! catch(SQLException e) ! { ! log.error("save", e); ! } ! ! // ! load(C_ValidCombination_ID); ! return saved; ! } // save - /************************************************************************** * Return String representation --- 317,323 ---- } // Account ! /** Account Segment */ ! private MElementValue m_accountEV = null; /************************************************************************** * Return String representation *************** *** 393,399 **** StringBuffer sb = new StringBuffer("Account=["); sb.append(getC_ValidCombination_ID()) ! .append(",Client=").append(getAD_Client_ID()) ! .append(",Org=").append(getAD_Org_ID()) ! .append(",Acct=").append(getAccount_ID()); sb.append("]"); return sb.toString(); --- 328,358 ---- StringBuffer sb = new StringBuffer("Account=["); sb.append(getC_ValidCombination_ID()) ! .append(",C=").append(getAD_Client_ID()) ! .append(",O=").append(getAD_Org_ID()) ! .append(",AS=").append(getC_AcctSchema_ID()) ! .append(",Acct=").append(getAccount_ID()) ! .append(" "); ! if (getM_Product_ID() == 0) ! sb.append(",M_Product_ID=").append(getM_Product_ID()); ! if (getC_BPartner_ID() == 0) ! sb.append(",C_BPartner_ID=").append(getC_BPartner_ID()); ! if (getAD_OrgTrx_ID() == 0) ! sb.append(",AD_OrgTrx_ID=").append(getAD_OrgTrx_ID()); ! if (getC_LocFrom_ID() == 0) ! sb.append(",C_LocFrom_ID=").append(getC_LocFrom_ID()); ! if (getC_LocTo_ID() == 0) ! sb.append(",C_LocTo_ID=").append(getC_LocTo_ID()); ! if (getC_SalesRegion_ID() == 0) ! sb.append(",C_SalesRegion_ID=").append(getC_SalesRegion_ID()); ! if (getC_Project_ID() == 0) ! sb.append(",C_Project_ID=").append(getC_Project_ID()); ! if (getC_Campaign_ID() == 0) ! sb.append(",C_Campaign_ID=").append(getC_Campaign_ID()); ! if (getC_Activity_ID() == 0) ! sb.append(",C_Activity_ID=").append(getC_Activity_ID()); ! if (getUser1_ID() == 0) ! sb.append(",User1_ID=").append(getUser1_ID()); ! if (getUser2_ID() == 0) ! sb.append(",User2_ID=").append(getUser2_ID()); sb.append("]"); return sb.toString(); *************** *** 405,409 **** public void setAccount_ID (int Account_ID) { ! m_account = null; // reset super.setAccount_ID(Account_ID); } // setAccount --- 364,368 ---- public void setAccount_ID (int Account_ID) { ! m_accountEV = null; // reset super.setAccount_ID(Account_ID); } // setAccount *************** *** 414,423 **** public MElementValue getAccount () { ! if (m_account == null) { if (getAccount_ID() != 0) ! m_account = new MElementValue(getCtx(), getAccount_ID()); } ! return m_account; } // setAccount --- 373,382 ---- public MElementValue getAccount () { ! if (m_accountEV == null) { if (getAccount_ID() != 0) ! m_accountEV = new MElementValue(getCtx(), getAccount_ID()); } ! return m_accountEV; } // setAccount *************** *** 429,439 **** public String getAccountType() { ! MElementValue ev = getAccount(); ! if (ev == null) { log.error("getAccountType - no ElementValue for Account_ID=" + getAccount_ID()); return ""; } ! return ev.getAccountType(); } // getAccountType --- 388,399 ---- public String getAccountType() { ! if (m_accountEV == null) ! getAccount(); ! if (m_accountEV == null) { log.error("getAccountType - no ElementValue for Account_ID=" + getAccount_ID()); return ""; } ! return m_accountEV.getAccountType(); } // getAccountType *************** *** 470,473 **** --- 430,664 ---- } // isPassiva + /** + * Set Value and Description and Fully Qualified Flag for Combination + */ + public void setValueDescription() + { + StringBuffer combi = new StringBuffer(); + StringBuffer descr = new StringBuffer(); + boolean fullyQualified = true; + // + MAcctSchema as = MAcctSchema.get(getCtx(), getC_AcctSchema_ID()); + MAcctSchemaElement[] elements = MAcctSchemaElement.getAcctSchemaElements(getCtx(), getC_AcctSchema_ID()); + for (int i = 0; i < elements.length; i++) + { + if (i > 0) + { + combi.append(as.getSeparator()); + descr.append(as.getSeparator()); + } + MAcctSchemaElement element = elements[i]; + String combiStr = "_"; // not defined + String descrStr = "_"; + + if (MAcctSchemaElement.ELEMENTTYPE_Org.equals(element.getElementType())) + { + if (getAD_Org_ID() != 0) + { + MOrg org = MOrg.get(getCtx(), getAD_Org_ID()); + combiStr = org.getValue(); + descrStr = org.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Org"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_Account.equals(element.getElementType())) + { + if (getAccount_ID() != 0) + { + if (m_accountEV == null) + m_accountEV = new MElementValue(getCtx(), getAccount_ID()); + combiStr = m_accountEV.getValue(); + descrStr = m_accountEV.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Account"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_Product.equals(element.getElementType())) + { + if (getM_Product_ID() != 0) + { + X_M_Product product = new X_M_Product (getCtx(), getM_Product_ID()); + combiStr = product.getValue(); + descrStr = product.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Product"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_BPartner.equals(element.getElementType())) + { + if (getC_BPartner_ID() != 0) + { + X_C_BPartner partner = new X_C_BPartner (getCtx(), getC_BPartner_ID()); + combiStr = partner.getValue(); + descrStr = partner.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Business Partner"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_OrgTrx.equals(element.getElementType())) + { + if (getAD_OrgTrx_ID() != 0) + { + MOrg org = MOrg.get(getCtx(), getAD_OrgTrx_ID()); + combiStr = org.getValue(); + descrStr = org.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Trx Org"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_LocationFrom.equals(element.getElementType())) + { + if (getC_LocFrom_ID() != 0) + { + MLocation loc = MLocation.get(getCtx(), getC_LocFrom_ID()); + combiStr = loc.getPostal(); + descrStr = loc.getCity(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Location From"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_LocationTo.equals(element.getElementType())) + { + if (getC_LocTo_ID() != 0) + { + MLocation loc = MLocation.get(getCtx(), getC_LocTo_ID()); + combiStr = loc.getPostal(); + descrStr = loc.getCity(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Location To"); + fullyQualified = false; + } + + } + else if (MAcctSchemaElement.ELEMENTTYPE_SalesRegion.equals(element.getElementType())) + { + if (getC_SalesRegion_ID() != 0) + { + MSalesRegion loc = MSalesRegion.get(getCtx(), getC_SalesRegion_ID()); + combiStr = loc.getValue(); + descrStr = loc.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: SalesRegion"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_Project.equals(element.getElementType())) + { + if (getC_Project_ID() != 0) + { + X_C_Project project = new X_C_Project (getCtx(), getC_Project_ID()); + combiStr = project.getValue(); + descrStr = project.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Project"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_Campaign.equals(element.getElementType())) + { + if (getC_Campaign_ID() != 0) + { + X_C_Campaign campaign = new X_C_Campaign (getCtx(), getC_Campaign_ID()); + combiStr = campaign.getValue(); + descrStr = campaign.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Campaign"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_Activity.equals(element.getElementType())) + { + if (getC_Activity_ID() != 0) + { + X_C_Activity act = new X_C_Activity (getCtx(), getC_Activity_ID()); + combiStr = act.getValue(); + descrStr = act.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: Campaign"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_User1.equals(element.getElementType())) + { + if (getUser1_ID() != 0) + { + MElementValue ev = new MElementValue(getCtx(), getUser1_ID()); + combiStr = ev.getValue(); + descrStr = ev.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: User 1"); + fullyQualified = false; + } + } + else if (MAcctSchemaElement.ELEMENTTYPE_User2.equals(element.getElementType())) + { + if (getUser2_ID() != 0) + { + MElementValue ev = new MElementValue(getCtx(), getUser2_ID()); + combiStr = ev.getValue(); + descrStr = ev.getName(); + } + else if (element.isMandatory()) + { + log.warn("setValueDescription - Mandatory Element missing: User 2"); + fullyQualified = false; + } + } + combi.append(combiStr); + descr.append(descrStr); + } + // Set Values + super.setCombination(combi.toString()); + super.setDescription(descr.toString()); + if (fullyQualified != isFullyQualified()) + setIsFullyQualified(fullyQualified); + log.debug("setValueDescription - Combination=" + getCombination() + + " - " + getDescription() + + " - FullyQualified=" + fullyQualified); + } // setValueDescription + + + /** + * Before Save + * @param newRecord new + * @return true + */ + protected boolean beforeSave (boolean newRecord) + { + setValueDescription(); + return true; + } // beforeSave + } // Account Index: MConversionRate.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/MConversionRate.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MConversionRate.java 5 Jul 2004 01:41:39 -0000 1.8 --- MConversionRate.java 27 Jul 2004 06:55:12 -0000 1.9 *************** *** 315,319 **** return false; } ! // Date Range Check Timestamp from = getValidFrom(); --- 315,325 ---- return false; } ! // Nothing to convert ! if (getMultiplyRate().compareTo(Env.ZERO) <= 0) ! { ! Log.saveError("Error", Msg.parseTranslation(getCtx(), "@MultiplyRate@ <= 0")); ! return false; ! } ! // Date Range Check Timestamp from = getValidFrom(); Index: MLookup.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/MLookup.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MLookup.java 3 May 2004 01:53:59 -0000 1.25 --- MLookup.java 27 Jul 2004 06:55:12 -0000 1.26 *************** *** 14,20 **** package org.compiere.model; import java.sql.*; import java.util.*; - import java.io.Serializable; import org.compiere.util.*; --- 14,20 ---- package org.compiere.model; + import java.io.*; import java.sql.*; import java.util.*; import org.compiere.util.*; *************** *** 536,542 **** } // refresh /************************************************************************** - - /** * MLookup Loader */ --- 536,541 ---- } // refresh + /************************************************************************** * MLookup Loader */ *************** *** 565,569 **** if (validation.length() == 0 && m_info.ValidationCode.length() > 0) { ! log.warn(m_info.KeyColumn + ": Loader NOT Validated: " + m_info.ValidationCode); return; } --- 564,568 ---- if (validation.length() == 0 && m_info.ValidationCode.length() > 0) { ! log.debug(m_info.KeyColumn + ": Loader NOT Validated: " + m_info.ValidationCode); return; } Index: MRole.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/MRole.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** MRole.java 24 Jul 2004 05:16:41 -0000 1.24 --- MRole.java 27 Jul 2004 06:55:12 -0000 1.25 *************** *** 1629,1633 **** + getTableLevelString(Env.getAD_Language(ctx), TableLevel) + ") != UserLevel=" + userLevel); ! log.error ("canView - " + toString()); return retValue; } // canView --- 1629,1633 ---- + getTableLevelString(Env.getAD_Language(ctx), TableLevel) + ") != UserLevel=" + userLevel); ! log.info ("canView - " + toString()); return retValue; } // canView Index: MTabVO.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/MTabVO.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MTabVO.java 18 May 2004 05:07:19 -0000 1.13 --- MTabVO.java 27 Jul 2004 06:55:12 -0000 1.14 *************** *** 126,130 **** * @return TabVO */ ! public static MTabVO create (MWindowVO wVO, int TabNo, ResultSet rs, boolean isRO, boolean onlyCurrentRows) { Log.trace(Log.l3_Util, "MTabVO.create #" + TabNo); --- 126,131 ---- * @return TabVO */ ! public static MTabVO create (MWindowVO wVO, int TabNo, ResultSet rs, ! boolean isRO, boolean onlyCurrentRows) { Log.trace(Log.l3_Util, "MTabVO.create #" + TabNo); Index: M_Table.java =================================================================== RCS file: /cvsroot/compiere/dbPort/src/org/compiere/model/M_Table.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** M_Table.java 6 May 2004 23:57:39 -0000 1.8 --- M_Table.java 27 Jul 2004 06:55:12 -0000 1.9 *************** *** 118,122 **** "AD_Column", "org.compiere.model.M_Column", "AD_Element", "org.compiere.model.M_Element", ! "AD_Tree", "org.compiere.model.MTree_Base" }; // AD_Attribute_Value, AD_TreeNode --- 118,123 ---- "AD_Column", "org.compiere.model.M_Column", "AD_Element", "org.compiere.model.M_Element", ! "AD_Tree", "org.compiere.model.MTree_Base", ! "C_ValidCombination", "org.compiere.model.MAccount" }; // AD_Attribute_Value, AD_TreeNode |