IDEMPIERE-2305 Cash/Check Payment button is ignoring amount entered
This commit is contained in:
parent
3be24c717b
commit
0e03505f52
|
@ -83,7 +83,7 @@ public class MPayment extends X_C_Payment
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3426445843281140181L;
|
private static final long serialVersionUID = -7646717328867858897L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Payments Of BPartner
|
* Get Payments Of BPartner
|
||||||
|
@ -654,6 +654,22 @@ public class MPayment extends X_C_Payment
|
||||||
*/
|
*/
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
|
if (isComplete() &&
|
||||||
|
( is_ValueChanged(COLUMNNAME_C_BankAccount_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_BPartner_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_Charge_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_Currency_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_DocType_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_Invoice_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_C_Order_ID)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_DateAcct)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_DateTrx)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_DiscountAmt)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_PayAmt)
|
||||||
|
|| is_ValueChanged(COLUMNNAME_WriteOffAmt))) {
|
||||||
|
log.saveError("PaymentAlreadyProcessed", Msg.translate(getCtx(), "C_Payment_ID"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// @Trifon - CashPayments
|
// @Trifon - CashPayments
|
||||||
//if ( getTenderType().equals("X") ) {
|
//if ( getTenderType().equals("X") ) {
|
||||||
if ( isCashbookTrx()) {
|
if ( isCashbookTrx()) {
|
||||||
|
@ -782,6 +798,18 @@ public class MPayment extends X_C_Payment
|
||||||
return true;
|
return true;
|
||||||
} // beforeSave
|
} // beforeSave
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Status is Complete or Closed
|
||||||
|
* @return true if CO, CL or RE
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
String ds = getDocStatus();
|
||||||
|
return DOCSTATUS_Completed.equals(ds)
|
||||||
|
|| DOCSTATUS_Closed.equals(ds)
|
||||||
|
|| DOCSTATUS_Reversed.equals(ds);
|
||||||
|
} // isComplete
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Allocated Amt in Payment Currency
|
* Get Allocated Amt in Payment Currency
|
||||||
* @return amount or null
|
* @return amount or null
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -5043918406658386237L;
|
private static final long serialVersionUID = 8965976274227777648L;
|
||||||
|
|
||||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||||
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||||
|
@ -78,6 +78,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME";
|
public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME";
|
||||||
public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount";
|
public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount";
|
||||||
public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule";
|
public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule";
|
||||||
|
public static final String ENABLE_PAYMENTBOX_BUTTON = "ENABLE_PAYMENTBOX_BUTTON";
|
||||||
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
||||||
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
|
||||||
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
|
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.grid.PaymentFormCash;
|
import org.compiere.grid.PaymentFormCash;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.MConversionRate;
|
import org.compiere.model.MConversionRate;
|
||||||
import org.compiere.model.MInvoice;
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
|
|
@ -17,6 +17,8 @@ import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
|
import org.compiere.util.Env;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zul.Comboitem;
|
import org.zkoss.zul.Comboitem;
|
||||||
|
@ -77,6 +79,8 @@ public class Paymentbox extends Div {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) {
|
public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) {
|
||||||
|
if (! MSysConfig.getBooleanValue(MSysConfig.ENABLE_PAYMENTBOX_BUTTON, true, Env.getAD_Client_ID(Env.getCtx())))
|
||||||
|
isBtnEnabled = false;
|
||||||
combo.setEnabled(isComboEnabled);
|
combo.setEnabled(isComboEnabled);
|
||||||
combo.setButtonVisible(isComboEnabled);
|
combo.setButtonVisible(isComboEnabled);
|
||||||
btn.setEnabled(isBtnEnabled);
|
btn.setEnabled(isBtnEnabled);
|
||||||
|
|
|
@ -181,6 +181,8 @@ public class WPaymentEditor extends WEditor implements ListDataListener {
|
||||||
if (!m_onlyRule // Only order has Warehouse
|
if (!m_onlyRule // Only order has Warehouse
|
||||||
&& !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null)
|
&& !m_isSOTrx && m_mTab.getValue("M_Warehouse_ID") != null)
|
||||||
m_onlyRule = true;
|
m_onlyRule = true;
|
||||||
|
if (!m_onlyRule && m_mTab.needSave(true, false)) // don't show button until change on payment rule is saved
|
||||||
|
m_onlyRule = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponent().setEnabled(readWrite, readWrite && !m_onlyRule);
|
getComponent().setEnabled(readWrite, readWrite && !m_onlyRule);
|
||||||
|
|
|
@ -208,11 +208,11 @@ public abstract class PaymentFormCheck extends PaymentForm {
|
||||||
if (invoice == null && C_Order_ID != 0)
|
if (invoice == null && C_Order_ID != 0)
|
||||||
order = new MOrder (Env.getCtx(), C_Order_ID, null);
|
order = new MOrder (Env.getCtx(), C_Order_ID, null);
|
||||||
|
|
||||||
BigDecimal payAmount = m_Amount;
|
BigDecimal payAmount = amount;
|
||||||
|
|
||||||
|
|
||||||
if (negateAmt)
|
if (negateAmt)
|
||||||
payAmount = m_Amount.negate();
|
payAmount = amount.negate();
|
||||||
// Info
|
// Info
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt);
|
if (log.isLoggable(Level.CONFIG)) log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue