hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2014-03-26 21:26:40 -05:00
commit d75a1cb722
18 changed files with 307 additions and 71 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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
;

View File

@ -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)
{

View File

@ -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);
//

View File

@ -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()

View File

@ -625,9 +625,6 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
*/
protected boolean beforeSave (boolean newRecord)
{
if (!isPrinted()) {
setIsOrderBy(false);
}
// Order
if (!isOrderBy())
{

View File

@ -78,7 +78,6 @@ 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.setAD_BroadcastMessage_ID(messageID);
note.setAD_User_ID(userID);

View File

@ -505,7 +505,9 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
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));
}

View File

@ -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<Object> 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<Object> windows = getWindows();
if (WindowNo < windows.size())
if (windows != null && WindowNo < windows.size())
return windows.get(WindowNo);
else
return null;
@ -299,7 +300,9 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
}
protected List<Object> getWindows(){
Session session = getComponent().getDesktop().getSession();
Desktop desktop = getComponent().getDesktop();
if (desktop != null) {
Session session = desktop.getSession();
@SuppressWarnings("unchecked")
List<Object> list = (List<Object>) session.getAttribute("windows.list");
if (list == null) {
@ -307,6 +310,9 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
session.setAttribute("windows.list", list);
}
return Collections.synchronizedList(list);
} else {
return null;
}
}
}

View File

@ -190,6 +190,8 @@ public class LoginPanel extends Window implements EventListener<Event>
});
// 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<Event>
{
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<Event>
onUserIdChange(-1);
}
}
*/
else if (event.getName().equals(ON_LOAD_TOKEN))
{
BrowserToken.load(txtUserId);

View File

@ -55,8 +55,8 @@ public class FactReconcile {
Vector<String> columnNames = new Vector<String>();
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<Vector<Object>> data = new Vector<Vector<Object>>();
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 ) );

View File

@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>

View File

@ -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",

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.model.WS_ModelFactory">
<implementation class="org.compiere.model.WS_ModelFactory"/>
<property name="service.ranking" type="Integer" value="5"/>
<service>
<provide interface="org.adempiere.base.IModelFactory"/>
</service>
</scr:component>

View File

@ -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

View File

@ -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;
}
}