FR [ 2803341 ] - Deprecate Cash Journal

https://sourceforge.net/tracker/index.php?func=detail&aid=2803341&group_id=176962&atid=879335
Modified calls to look SysConfig CASH_AS_PAYMENT to take account of AD_Client_ID
This commit is contained in:
Carlos Ruiz 2009-08-13 19:45:57 +00:00
parent 1250197eef
commit 44f90a4aff
2 changed files with 13 additions and 12 deletions

View File

@ -545,7 +545,7 @@ public final class MPayment extends X_C_Payment
{ {
// @Trifon - CashPayments // @Trifon - CashPayments
//if ( getTenderType().equals("X") ) { //if ( getTenderType().equals("X") ) {
if ( isCashTrx() && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true)) { if ( isCashTrx() && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true, getAD_Client_ID())) {
// Cash Book Is mandatory // Cash Book Is mandatory
if ( getC_CashBook_ID() <= 0 ) { if ( getC_CashBook_ID() <= 0 ) {
log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@"));
@ -1826,7 +1826,7 @@ public final class MPayment extends X_C_Payment
// @Trifon - CashPayments // @Trifon - CashPayments
//if ( getTenderType().equals("X") ) { //if ( getTenderType().equals("X") ) {
if ( isCashTrx() && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true)) { if ( isCashTrx() && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true, getAD_Client_ID())) {
// Create Cash Book entry // Create Cash Book entry
if ( getC_CashBook_ID() <= 0 ) { if ( getC_CashBook_ID() <= 0 ) {
log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@"));

View File

@ -175,6 +175,7 @@ public class VPayment extends CDialog
/** Invoice Currency */ /** Invoice Currency */
private int m_C_Currency_ID = 0; private int m_C_Currency_ID = 0;
private int m_AD_Client_ID = 0; private int m_AD_Client_ID = 0;
private boolean m_Cash_As_Payment = true;
private int m_AD_Org_ID = 0; private int m_AD_Org_ID = 0;
private int m_C_BPartner_ID = 0; private int m_C_BPartner_ID = 0;
private BigDecimal m_Amount = Env.ZERO; // Payment Amount private BigDecimal m_Amount = Env.ZERO; // Payment Amount
@ -410,7 +411,7 @@ public class VPayment extends CDialog
centerLayout.addLayoutComponent(bPanel, "bPanel"); centerLayout.addLayoutComponent(bPanel, "bPanel");
centerPanel.add(bPanel, "bPanel"); centerPanel.add(bPanel, "bPanel");
if(MSysConfig.getBooleanValue("CASH_AS_PAYMENT",true)){ if (m_Cash_As_Payment){
sBankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID")); sBankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
bPanel.add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 bPanel.add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));
@ -511,6 +512,7 @@ public class VPayment extends CDialog
* Get Data from Grid * Get Data from Grid
*/ */
m_AD_Client_ID = ((Integer)m_mTab.getValue("AD_Client_ID")).intValue(); m_AD_Client_ID = ((Integer)m_mTab.getValue("AD_Client_ID")).intValue();
m_Cash_As_Payment = MSysConfig.getBooleanValue("CASH_AS_PAYMENT",true, m_AD_Client_ID);
m_AD_Org_ID = ((Integer)m_mTab.getValue("AD_Org_ID")).intValue(); m_AD_Org_ID = ((Integer)m_mTab.getValue("AD_Org_ID")).intValue();
m_C_BPartner_ID = ((Integer)m_mTab.getValue("C_BPartner_ID")).intValue(); m_C_BPartner_ID = ((Integer)m_mTab.getValue("C_BPartner_ID")).intValue();
m_PaymentRule = (String)m_mTab.getValue("PaymentRule"); m_PaymentRule = (String)m_mTab.getValue("PaymentRule");
@ -963,12 +965,12 @@ public class VPayment extends CDialog
int newC_CashBook_ID = m_C_CashBook_ID; int newC_CashBook_ID = m_C_CashBook_ID;
String newCCType = m_CCType; String newCCType = m_CCType;
int newC_BankAccount_ID = 0; int newC_BankAccount_ID = 0;
String payTypes = MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true) ? "KTSDB" : "KTSD"; String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
// B (Cash) (Currency) // B (Cash) (Currency)
if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash)) if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash))
{ {
if (MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true)){ if (m_Cash_As_Payment){
// get bank account // get bank account
KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem(); KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem();
if (kp != null) if (kp != null)
@ -1028,8 +1030,7 @@ public class VPayment extends CDialog
{ {
log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + newPaymentRule); log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + newPaymentRule);
// We had a CashBook Entry // We had a CashBook Entry
if (m_PaymentRule.equals(X_C_Order.PAYMENTRULE_Cash) if (m_PaymentRule.equals(X_C_Order.PAYMENTRULE_Cash) && !m_Cash_As_Payment)
&& !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true))
{ {
log.fine("Old Cash - " + m_cashLine); log.fine("Old Cash - " + m_cashLine);
if (m_cashLine != null) if (m_cashLine != null)
@ -1103,7 +1104,7 @@ public class VPayment extends CDialog
/*********************** /***********************
* CashBook * CashBook
*/ */
if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash) && !MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true)) if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash) && !m_Cash_As_Payment)
{ {
log.fine("Cash"); log.fine("Cash");
if (C_Invoice_ID == 0 && order == null) if (C_Invoice_ID == 0 && order == null)
@ -1192,7 +1193,7 @@ public class VPayment extends CDialog
* Payments * Payments
*/ */
if (("KS".indexOf(newPaymentRule) != -1) || if (("KS".indexOf(newPaymentRule) != -1) ||
(newPaymentRule.equals(MOrder.PAYMENTRULE_Cash) && MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true))) (newPaymentRule.equals(MOrder.PAYMENTRULE_Cash) && m_Cash_As_Payment))
{ {
log.fine("Payment - " + newPaymentRule); log.fine("Payment - " + newPaymentRule);
// Set Amount // Set Amount
@ -1310,7 +1311,7 @@ public class VPayment extends CDialog
// B (Cash) (Currency) // B (Cash) (Currency)
if (PaymentRule.equals(MOrder.PAYMENTRULE_Cash)) if (PaymentRule.equals(MOrder.PAYMENTRULE_Cash))
{ {
if (MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true)) if (m_Cash_As_Payment)
{ {
KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem(); KeyNamePair kp = (KeyNamePair)sBankAccountCombo.getSelectedItem();
if (kp != null) if (kp != null)
@ -1405,12 +1406,12 @@ public class VPayment extends CDialog
// find Bank Account if not qualified yet // find Bank Account if not qualified yet
if (("KTSD".indexOf(PaymentRule) != -1 || if (("KTSD".indexOf(PaymentRule) != -1 ||
(PaymentRule.equals(MOrder.PAYMENTRULE_Cash) && MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true))) (PaymentRule.equals(MOrder.PAYMENTRULE_Cash) && m_Cash_As_Payment))
&& C_BankAccount_ID == 0) && C_BankAccount_ID == 0)
{ {
// Check & Cash (Payment) must have a bank account // Check & Cash (Payment) must have a bank account
if (C_BankAccount_ID == 0 && (PaymentRule.equals(MOrder.PAYMENTRULE_Check)) || if (C_BankAccount_ID == 0 && (PaymentRule.equals(MOrder.PAYMENTRULE_Check)) ||
(PaymentRule.equals(MOrder.PAYMENTRULE_Cash) && MSysConfig.getBooleanValue("CASH_AS_PAYMENT", true) )) (PaymentRule.equals(MOrder.PAYMENTRULE_Cash) && m_Cash_As_Payment))
{ {
ADialog.error(m_WindowNo, this, "PaymentNoProcessor"); ADialog.error(m_WindowNo, this, "PaymentNoProcessor");
dataOK = false; dataOK = false;