diff --git a/migration/i2.0/oracle/201403131604_IDEMPIERE-1742.sql b/migration/i2.0/oracle/201403131604_IDEMPIERE-1742.sql new file mode 100644 index 0000000000..6bad740014 --- /dev/null +++ b/migration/i2.0/oracle/201403131604_IDEMPIERE-1742.sql @@ -0,0 +1,8 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 13, 2014 3:37:35 AM ICT +UPDATE AD_Field SET DisplayLogic='@Processed@=Y & @M_Product_ID.IsBOM@=Y',Updated=TO_DATE('2014-03-13 03:37:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200271 +; +SELECT register_migration_script('201403131604_IDEMPIERE-1742.sql') FROM dual +; diff --git a/migration/i2.0/oracle/201403242011_IDEMPIERE-1852.sql b/migration/i2.0/oracle/201403242011_IDEMPIERE-1852.sql new file mode 100644 index 0000000000..b946502b18 --- /dev/null +++ b/migration/i2.0/oracle/201403242011_IDEMPIERE-1852.sql @@ -0,0 +1,19 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 24, 2014 8:09:18 PM COT +-- IDEMPIERE-1852 Translation: Accounting Fact Reconcilation (manual) +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR',200260,'D','40c2b5df-fe62-4d94-9376-fa82bfe99969','DR','Y',TO_DATE('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Mar 24, 2014 8:09:35 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','CR',200261,'D','c4c434ec-7516-46c0-ad29-122c2b871b04','CR','Y',TO_DATE('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Mar 24, 2014 8:10:25 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR/CR',200262,'D','41ceddd4-a1d0-4387-8d64-f10391a9badf','DR/CR','Y',TO_DATE('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +SELECT register_migration_script('201403242011_IDEMPIERE-1852.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201403131604_IDEMPIERE-1742.sql b/migration/i2.0/postgresql/201403131604_IDEMPIERE-1742.sql new file mode 100644 index 0000000000..4be89e5cee --- /dev/null +++ b/migration/i2.0/postgresql/201403131604_IDEMPIERE-1742.sql @@ -0,0 +1,5 @@ +-- Mar 13, 2014 3:37:35 AM ICT +UPDATE AD_Field SET DisplayLogic='@Processed@=Y & @M_Product_ID.IsBOM@=Y',Updated=TO_TIMESTAMP('2014-03-13 03:37:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200271 +; +SELECT register_migration_script('201403131604_IDEMPIERE-1742.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201403242011_IDEMPIERE-1852.sql b/migration/i2.0/postgresql/201403242011_IDEMPIERE-1852.sql new file mode 100644 index 0000000000..6be9934eb1 --- /dev/null +++ b/migration/i2.0/postgresql/201403242011_IDEMPIERE-1852.sql @@ -0,0 +1,16 @@ +-- Mar 24, 2014 8:09:18 PM COT +-- IDEMPIERE-1852 Translation: Accounting Fact Reconcilation (manual) +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR',200260,'D','40c2b5df-fe62-4d94-9376-fa82bfe99969','DR','Y',TO_TIMESTAMP('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Mar 24, 2014 8:09:35 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','CR',200261,'D','c4c434ec-7516-46c0-ad29-122c2b871b04','CR','Y',TO_TIMESTAMP('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Mar 24, 2014 8:10:25 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR/CR',200262,'D','41ceddd4-a1d0-4387-8d64-f10391a9badf','DR/CR','Y',TO_TIMESTAMP('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +SELECT register_migration_script('201403242011_IDEMPIERE-1852.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultLookupFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultLookupFactory.java index d9c5927177..2570b64379 100644 --- a/org.adempiere.base/src/org/adempiere/base/DefaultLookupFactory.java +++ b/org.adempiere.base/src/org/adempiere/base/DefaultLookupFactory.java @@ -54,7 +54,7 @@ public class DefaultLookupFactory implements ILookupFactory{ } else if (gridFieldVO.displayType == Payment) { - lookup = new MPaymentLookup (gridFieldVO.ctx, gridFieldVO.WindowNo, gridFieldVO.AD_Column_ID); + lookup = new MPaymentLookup (gridFieldVO.ctx, gridFieldVO.WindowNo, gridFieldVO.ValidationCode); } else if (DisplayType.isLookup(gridFieldVO.displayType) && gridFieldVO.lookupInfo != null) { diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index 2f0b047674..f233957fe9 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -437,6 +437,20 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction m_processMsg = "No Business Partner"; return DocAction.STATUS_Invalid; } + + // IDEMPIERE-1850 - validate date against related docs + if (line.getC_Invoice_ID() > 0) { + if (line.getC_Invoice().getDateAcct().after(getDateAcct())) { + m_processMsg = "Wrong allocation date"; + return DocAction.STATUS_Invalid; + } + } + if (line.getC_Payment_ID() > 0) { + if (line.getC_Payment().getDateAcct().after(getDateAcct())) { + m_processMsg = "Wrong allocation date"; + return DocAction.STATUS_Invalid; + } + } } setApprovalAmt(approval); // diff --git a/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java b/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java index afcbf43418..daf6389e2a 100644 --- a/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java +++ b/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java @@ -27,6 +27,7 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.NamePair; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; /** @@ -35,24 +36,23 @@ import org.compiere.util.ValueNamePair; * */ public class MPaymentLookup extends Lookup implements Serializable { - /** * */ - private static final long serialVersionUID = -6863672221350217533L; - + private static final long serialVersionUID = 6505672741140583659L; + /** Context */ private Properties m_ctx; /** IsSOTrx */ private boolean m_isSOTrx = false; - /** AD_Column_ID */ - private int m_AD_Column_ID; + /** Validation Code */ + private String m_validationCode; - public MPaymentLookup(Properties ctx, int windowNo, int columnID) { + public MPaymentLookup(Properties ctx, int windowNo, String validationCode) { super(DisplayType.TableDir, windowNo); m_ctx = ctx; - m_AD_Column_ID = columnID; m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), windowNo, "IsSOTrx")); + m_validationCode = validationCode; } @Override @@ -159,15 +159,9 @@ public class MPaymentLookup extends Lookup implements Serializable { public String getValidation() { - StringBuilder sb = new StringBuilder(); - sb.append("SELECT vr.Code "); - sb.append("FROM AD_Column c"); - sb.append(" LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) "); - sb.append("WHERE c.AD_Column_ID=?"); - String validation = DB.getSQLValueString(null, sb.toString(), m_AD_Column_ID); - if (validation == null) + if (Util.isEmpty(m_validationCode, true)) return ""; - return validation.trim(); + return m_validationCode.trim(); } private String getWhereClause() diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java b/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java index cb7eb08891..8035008339 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java @@ -625,9 +625,6 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem */ protected boolean beforeSave (boolean newRecord) { - if (!isPrinted()) { - setIsOrderBy(false); - } // Order if (!isOrderBy()) { diff --git a/org.adempiere.base/src/org/idempiere/broadcast/BroadcastMsgUtil.java b/org.adempiere.base/src/org/idempiere/broadcast/BroadcastMsgUtil.java index ed261907fa..ce2c0197f1 100644 --- a/org.adempiere.base/src/org/idempiere/broadcast/BroadcastMsgUtil.java +++ b/org.adempiere.base/src/org/idempiere/broadcast/BroadcastMsgUtil.java @@ -78,8 +78,7 @@ public class BroadcastMsgUtil if (! user.isActive()) continue; MNote note = new MNote(Env.getCtx(), 0, trxName); - if (MBroadcastMessage.TARGET_Everybody.equals(mbMessage.getTarget())) - note.setClientOrg(user.getAD_Client_ID(), 0); + note.setClientOrg(user.getAD_Client_ID(), 0); note.setAD_BroadcastMessage_ID(messageID); note.setAD_User_ID(userID); note.setAD_Message_ID(0); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java index 2bbe9029fc..d6fb4c02af 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessModalDialog.java @@ -505,7 +505,9 @@ public class ProcessModalDialog extends Window implements EventListener, if (log.isLoggable(Level.INFO))log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx())); WProcessCtl.process(ProcessModalDialog.this, m_WindowNo, parameterPanel, m_pi, null); } catch (Exception ex) { - FDialog.error(m_WindowNo, ex.getLocalizedMessage()); + m_pi.setError(true); + m_pi.setSummary(ex.getLocalizedMessage()); + log.log(Level.SEVERE, ex.getLocalizedMessage(), ex); } finally { Executions.schedule(getDesktop(), ProcessModalDialog.this, new Event(ON_COMPLETE, ProcessModalDialog.this, null)); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java index 38ed19fc41..9964c940f7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java @@ -26,6 +26,7 @@ import org.adempiere.webui.part.AbstractUIPart; import org.compiere.model.MMenu; import org.compiere.util.CLogger; import org.compiere.util.Env; +import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.event.Event; @@ -122,7 +123,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop */ public void unregisterWindow(int WindowNo) { List windows = getWindows(); - if (WindowNo < windows.size()) + if (windows != null && WindowNo < windows.size()) windows.set(WindowNo, null); Env.clearWinContext(WindowNo); } @@ -134,7 +135,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop */ public Object findWindow(int WindowNo) { List windows = getWindows(); - if (WindowNo < windows.size()) + if (windows != null && WindowNo < windows.size()) return windows.get(WindowNo); else return null; @@ -299,14 +300,19 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop } protected List getWindows(){ - Session session = getComponent().getDesktop().getSession(); - @SuppressWarnings("unchecked") - List list = (List) session.getAttribute("windows.list"); - if (list == null) { - list = new ArrayList(); - session.setAttribute("windows.list", list); + Desktop desktop = getComponent().getDesktop(); + if (desktop != null) { + Session session = desktop.getSession(); + @SuppressWarnings("unchecked") + List list = (List) session.getAttribute("windows.list"); + if (list == null) { + list = new ArrayList(); + session.setAttribute("windows.list", list); + } + return Collections.synchronizedList(list); + } else { + return null; } - return Collections.synchronizedList(list); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 53c1a129a1..0f9f0128e8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -190,6 +190,8 @@ public class LoginPanel extends Window implements EventListener }); // Make the default language the language of client System + // TODO: possible improvement to check if the first default browser language is supported and default to it + // Executions.getCurrent().getHeader("accept-language"); String defaultLanguage = MClient.get(ctx, 0).getAD_Language(); for(int i = 0; i < lstLanguage.getItemCount(); i++) { @@ -414,6 +416,7 @@ public class LoginPanel extends Window implements EventListener { btnResetPasswordClicked(); } + /* code below commented per security issue IDEMPIERE-1797 reported // Elaine 2009/02/06 - initial language else if (event.getName().equals(Events.ON_CHANGE)) { @@ -422,6 +425,7 @@ public class LoginPanel extends Window implements EventListener onUserIdChange(-1); } } + */ else if (event.getName().equals(ON_LOAD_TOKEN)) { BrowserToken.load(txtUserId); diff --git a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java index 4eb1bbf4ce..a07b3f11ee 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java @@ -55,8 +55,8 @@ public class FactReconcile { Vector columnNames = new Vector(); columnNames.add(Msg.translate(Env.getCtx(), "Amt")); //columnNames.add(Msg.translate(Env.getCtx(), "AmtAcct")); - columnNames.add("DR/CR"); - columnNames.add("Fact Acct"); + columnNames.add(Msg.translate(Env.getCtx(), "DR/CR")); + columnNames.add(Msg.translate(Env.getCtx(), "Selected")); columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID")); columnNames.add(Msg.translate(Env.getCtx(), "DateAcct")); columnNames.add(Msg.translate(Env.getCtx(), "GL_Category_ID")); @@ -74,16 +74,20 @@ public class FactReconcile { Vector> data = new Vector>(); - StringBuilder sql = new StringBuilder("SELECT abs(fa.amtacctdr-fa.amtacctcr), (fa.amtacctdr-fa.amtacctcr)," // 1-2 - + " (CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN 'CR' ELSE 'DR' END), fa.Fact_Acct_ID, bp.name, DateAcct," - + " glc.name, p.name, Qty, fa.Description, r.MatchCode, fa.DateTrx, o.value" - + " FROM Fact_Acct fa" - + " LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)" - + " LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)" - + " LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)" - + " LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)" - + " LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)" - + " WHERE fa.AD_Client_ID=?"); + StringBuilder sql = new StringBuilder("SELECT abs(fa.amtacctdr-fa.amtacctcr), (fa.amtacctdr-fa.amtacctcr),") // 1-2 + .append(" (CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN ") + .append(DB.TO_STRING(Msg.translate(Env.getCtx(), "CR"))) + .append(" ELSE ") + .append(DB.TO_STRING(Msg.translate(Env.getCtx(), "DR"))) + .append(" END), fa.Fact_Acct_ID, bp.name, DateAcct,") + .append(" glc.name, p.name, Qty, fa.Description, r.MatchCode, fa.DateTrx, o.value") + .append(" FROM Fact_Acct fa") + .append(" LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)") + .append(" LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)") + .append(" LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)") + .append(" LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)") + .append(" LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)") + .append(" WHERE fa.AD_Client_ID=?"); // role security sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "fa", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) ); diff --git a/org.idempiere.webservices/.project b/org.idempiere.webservices/.project index 06105d6c9b..a425c78d34 100644 --- a/org.idempiere.webservices/.project +++ b/org.idempiere.webservices/.project @@ -1,28 +1,33 @@ - - - org.idempiere.webservices - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - + + + org.idempiere.webservices + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.idempiere.webservices/META-INF/MANIFEST.MF b/org.idempiere.webservices/META-INF/MANIFEST.MF index 5e220afd19..a7a41111a6 100644 --- a/org.idempiere.webservices/META-INF/MANIFEST.MF +++ b/org.idempiere.webservices/META-INF/MANIFEST.MF @@ -5,6 +5,7 @@ Bundle-SymbolicName: org.idempiere.webservices;singleton:=true Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.idempiere.webservices.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Service-Component: OSGI-INF/ws_modelfactory.xml Import-Package: javax.activation;version="1.1.1", javax.mail.internet;version="1.4.5", javax.servlet;version="3.0.0", diff --git a/org.idempiere.webservices/OSGI-INF/ws_modelfactory.xml b/org.idempiere.webservices/OSGI-INF/ws_modelfactory.xml new file mode 100644 index 0000000000..6e9e86fe71 --- /dev/null +++ b/org.idempiere.webservices/OSGI-INF/ws_modelfactory.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebServicePara.java b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebServicePara.java new file mode 100644 index 0000000000..e462453d66 --- /dev/null +++ b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebServicePara.java @@ -0,0 +1,85 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Bazaar * + * http://www.idempiere.org * + * * + * Copyright (C) Carlos Ruiz - globalqss * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * 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., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Carlos Ruiz (globalqss@users.sourceforge.net) * + * * + * Sponsors: * + * - GlobalQSS (http://www.globalqss.com) * + ***********************************************************************/ + +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** + * Web Services Parameters Model + * + * @author Carlos Ruiz + */ +public class MWebServicePara extends X_WS_WebService_Para +{ + /** + * + */ + private static final long serialVersionUID = 3561409141850981248L; + + /************************************************************************** + * Standard Constructor + * @param ctx context + * @param WS_WebService_Para_ID + * @param trxName transaction + */ + public MWebServicePara (Properties ctx, int WS_WebService_Para_ID, String trxName) + { + super (ctx, WS_WebService_Para_ID, trxName); + /** if (WS_WebService_Para_ID == 0) + { + setName (null); + setValue (null); + WS_WebService_Para_ID (0); + } */ + } // MWebServicePara + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MWebServicePara (Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } // MWebServicePara + + @Override + protected boolean beforeSave(boolean newRecord) { + if ( "Filter".equalsIgnoreCase(getParameterName()) + && PARAMETERTYPE_Free.equals(getParameterType())) { + log.saveError("Error", "Type Free not allowed for parameter Filter (security issue)"); // IDEMPIERE-1784 + return false; + } + return true; + } + +} // MWebServicePara diff --git a/org.idempiere.webservices/WEB-INF/src/org/compiere/model/WS_ModelFactory.java b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/WS_ModelFactory.java new file mode 100644 index 0000000000..c6717de2de --- /dev/null +++ b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/WS_ModelFactory.java @@ -0,0 +1,69 @@ +/********************************************************************** +* This file is part of iDempiere ERP Open Source * +* http://www.idempiere.org * +* * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* 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., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Carlos Ruiz - globalqss * +**********************************************************************/ + +package org.compiere.model; + +import java.sql.ResultSet; + +import org.adempiere.base.IModelFactory; +import org.compiere.model.PO; +import org.compiere.util.Env; + +public class WS_ModelFactory implements IModelFactory { + + @Override + public Class getClass(String tableName) { + if (X_WS_WebService_Para.Table_Name.equals(tableName)) + return MWebServicePara.class; + if (X_WS_WebServiceType.Table_Name.equals(tableName)) + return MWebServiceType.class; + if (X_WS_WebService.Table_Name.equals(tableName)) + return MWebService.class; + return null; + } + + @Override + public PO getPO(String tableName, int Record_ID, String trxName) { + if (X_WS_WebService_Para.Table_Name.equals(tableName)) + return new MWebServicePara(Env.getCtx(), Record_ID, trxName); + if (X_WS_WebServiceType.Table_Name.equals(tableName)) + return new MWebServiceType(Env.getCtx(), Record_ID, trxName); + if (X_WS_WebService.Table_Name.equals(tableName)) + return new MWebService(Env.getCtx(), Record_ID, trxName); + return null; + } + + @Override + public PO getPO(String tableName, ResultSet rs, String trxName) { + if (X_WS_WebService_Para.Table_Name.equals(tableName)) + return new MWebServicePara(Env.getCtx(), rs, trxName); + if (X_WS_WebServiceType.Table_Name.equals(tableName)) + return new MWebServiceType(Env.getCtx(), rs, trxName); + if (X_WS_WebService.Table_Name.equals(tableName)) + return new MWebService(Env.getCtx(), rs, trxName); + return null; + } + +}