IDEMPIERE-236 Centralization of hardcoded IDs

This commit is contained in:
Nicolas Micoud 2012-04-18 10:15:56 -05:00
parent 98712527bd
commit a5fda83899
3 changed files with 499 additions and 466 deletions

View File

@ -0,0 +1,31 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
/**
* List all hardcoded ID used in the code
* @author Carlos Ruiz, Nicolas Micoud, ...
*/
public class HardCodedIDs {
public static int referencePostingType = 125;
public static int windowMyRequests = 237;
}

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import javax.swing.JComboBox;
import org.compiere.model.HardCodedIDs;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MFactAcct;
@ -172,7 +173,7 @@ class AcctViewerData
*/
protected void fillPostingType (JComboBox cb)
{
int AD_Reference_ID = 125;
int AD_Reference_ID = HardCodedIDs.referencePostingType;
ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true);
for (int i = 0; i < pt.length; i++)
cb.addItem(pt[i]);

View File

@ -58,6 +58,7 @@ import org.compiere.apps.wf.WFActivity;
import org.compiere.apps.wf.WFPanel;
import org.compiere.db.CConnection;
import org.compiere.grid.tree.VTreePanel;
import org.compiere.model.HardCodedIDs;
import org.compiere.model.MRole;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
@ -687,7 +688,7 @@ public final class AMenu extends CFrame
// + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) "
// + "WHERE t.AD_Table_ID=?", 417);
if (m_request_Menu_ID == 0)
m_request_Menu_ID = 237; // My Requests
m_request_Menu_ID = HardCodedIDs.windowMyRequests; // My Requests
(new AMenuStartItem (m_request_Menu_ID, true, Msg.translate(m_ctx, "R_Request_ID"), this)).start(); // async load
} // gotoRequests