IDEMPIERE-4041 Implement some callouts for Bank Transfer process parameters

This commit is contained in:
Carlos Ruiz 2019-08-30 14:36:59 +02:00
parent 865f3f843f
commit 10d5df21b7
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.webui.process.BankTransferParameterListener">
<implementation class="org.adempiere.webui.process.BankTransferParameterListener"/>
<property name="ProcessClass" type="String" value="org.eevolution.process.BankTransfer"/>
<property name="ColumnName" type="String" value="StatementDate,From_C_BankAccount_ID,To_C_BankAccount_ID"/>
<service>
<provide interface="org.adempiere.webui.apps.IProcessParameterListener"/>
</service>
</scr:component>

View File

@ -0,0 +1,57 @@
/**********************************************************************
* 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 *
**********************************************************************/
package org.adempiere.webui.process;
import org.adempiere.webui.apps.IProcessParameterListener;
import org.adempiere.webui.apps.ProcessParameterPanel;
import org.adempiere.webui.editor.WEditor;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.WrongValueException;
public class BankTransferParameterListener implements IProcessParameterListener {
@Override
public void onChange(ProcessParameterPanel parameterPanel, String columnName, WEditor editor) {
if (editor.getValue() != null) {
if ("StatementDate".equals(editor.getColumnName())) {
// set Accounting Date when StatementDate changes
WEditor dateAcctEditor = parameterPanel.getEditor("DateAcct");
dateAcctEditor.setValue(editor.getValue());
} else if ( "From_C_BankAccount_ID".equals(editor.getColumnName())
|| "To_C_BankAccount_ID".equals(editor.getColumnName())) {
WEditor toBankEditor = parameterPanel.getEditor("To_C_BankAccount_ID");
WEditor fromBankEditor = parameterPanel.getEditor("From_C_BankAccount_ID");
if ( toBankEditor.getValue() != null && fromBankEditor.getValue() != null
&& fromBankEditor.getValue().equals(toBankEditor.getValue())) {
editor.setValue(null);
throw new WrongValueException(editor.getComponent(), Msg.getMsg(Env.getCtx(), "BankFromToMustDiffer"));
}
}
}
}
}

View File

@ -27,6 +27,7 @@ bin.includes = META-INF/,\
OSGI-INF/defaultcreatefromfactory.xml,\
OSGI-INF/defaultformfactory.xml,\
OSGI-INF/feedbackservice.xml,\
OSGI-INF/banktransferparameterslistener.xml,\
sessiontimeout.zul,\
*.jsp,\
labelapplet.jar,\