merge revision 6484-6485 from branches/adempiere341

This commit is contained in:
Heng Sin Low 2008-09-19 22:25:21 +00:00
parent 0732c490bc
commit ea02e06671
2 changed files with 23 additions and 14 deletions

View File

@ -22,12 +22,12 @@ import java.text.*;
import java.util.*; import java.util.*;
import java.util.logging.*; import java.util.logging.*;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
@ -898,7 +898,8 @@ public class WPayment extends Window
private void onPaymentComboSelection() { private void onPaymentComboSelection() {
// get selection // get selection
ValueNamePair pp = paymentCombo.getSelectedItem().toValueNamePair(); ListItem selectedItem = paymentCombo.getSelectedItem();
ValueNamePair pp = selectedItem != null ? selectedItem.toValueNamePair() : null;
if (pp != null) if (pp != null)
{ {
String s = pp.getValue().toLowerCase(); String s = pp.getValue().toLowerCase();
@ -966,7 +967,8 @@ public class WPayment extends Window
// B (Cash) (Currency) // B (Cash) (Currency)
if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash)) if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Cash))
{ {
KeyNamePair kp = bCashBookCombo.getSelectedItem().toKeyNamePair(); ListItem selected = bCashBookCombo.getSelectedItem();
KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
newC_CashBook_ID = kp.getKey(); newC_CashBook_ID = kp.getKey();
newDateAcct = (Timestamp)bDateField.getValue(); newDateAcct = (Timestamp)bDateField.getValue();
@ -979,7 +981,8 @@ public class WPayment extends Window
// K (CreditCard) Type, Number, Exp, Approval // K (CreditCard) Type, Number, Exp, Approval
else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_CreditCard)) else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_CreditCard))
{ {
vp = kTypeCombo.getSelectedItem().toValueNamePair(); ListItem selected = kTypeCombo.getSelectedItem();
vp = selected != null ? selected.toValueNamePair() : null;
if (vp != null) if (vp != null)
newCCType = vp.getValue(); newCCType = vp.getValue();
} }
@ -994,7 +997,8 @@ public class WPayment extends Window
// P (PaymentTerm) PaymentTerm // P (PaymentTerm) PaymentTerm
else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit)) else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit))
{ {
KeyNamePair kp = pTermCombo.getSelectedItem().toKeyNamePair(); ListItem selected = pTermCombo.getSelectedItem();
KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
newC_PaymentTerm_ID = kp.getKey(); newC_PaymentTerm_ID = kp.getKey();
} }
@ -1002,8 +1006,8 @@ public class WPayment extends Window
// S (Check) (Currency) CheckNo, Routing // S (Check) (Currency) CheckNo, Routing
else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Check)) else if (newPaymentRule.equals(X_C_Order.PAYMENTRULE_Check))
{ {
// sCurrencyCombo.getSelectedItem(); ListItem selected = sBankAccountCombo.getSelectedItem();
KeyNamePair kp = sBankAccountCombo.getSelectedItem().toKeyNamePair(); KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
newC_BankAccount_ID = kp.getKey(); newC_BankAccount_ID = kp.getKey();
} }
@ -1315,7 +1319,8 @@ public class WPayment extends Window
// B (Cash) (Currency) // B (Cash) (Currency)
if (PaymentRule.equals(MOrder.PAYMENTRULE_Cash)) if (PaymentRule.equals(MOrder.PAYMENTRULE_Cash))
{ {
KeyNamePair kp = bCashBookCombo.getSelectedItem().toKeyNamePair(); ListItem selected = bCashBookCombo.getSelectedItem();
KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
C_CashBook_ID = kp.getKey(); C_CashBook_ID = kp.getKey();
DateAcct = (Timestamp)bDateField.getValue(); DateAcct = (Timestamp)bDateField.getValue();
@ -1324,7 +1329,8 @@ public class WPayment extends Window
// K (CreditCard) Type, Number, Exp, Approval // K (CreditCard) Type, Number, Exp, Approval
else if (PaymentRule.equals(MOrder.PAYMENTRULE_CreditCard)) else if (PaymentRule.equals(MOrder.PAYMENTRULE_CreditCard))
{ {
vp = kTypeCombo.getSelectedItem().toValueNamePair(); ListItem selected = kTypeCombo.getSelectedItem();
vp = selected != null ? selected.toValueNamePair() : null;
if (vp != null) if (vp != null)
CCType = vp.getValue(); CCType = vp.getValue();
// //
@ -1354,7 +1360,8 @@ public class WPayment extends Window
else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDeposit) else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDeposit)
|| PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit)) || PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit))
{ {
KeyNamePair bpba = tAccountCombo.getSelectedItem().toKeyNamePair(); ListItem selected = tAccountCombo.getSelectedItem();
KeyNamePair bpba = selected != null ? selected.toKeyNamePair() : null;
if (bpba == null) if (bpba == null)
{ {
@ -1366,7 +1373,8 @@ public class WPayment extends Window
// P (PaymentTerm) PaymentTerm // P (PaymentTerm) PaymentTerm
else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit)) else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit))
{ {
KeyNamePair kp = pTermCombo.getSelectedItem().toKeyNamePair(); ListItem selected = pTermCombo.getSelectedItem();
KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
C_PaymentTerm_ID = kp.getKey(); C_PaymentTerm_ID = kp.getKey();
} }
@ -1374,8 +1382,8 @@ public class WPayment extends Window
// S (Check) (Currency) CheckNo, Routing // S (Check) (Currency) CheckNo, Routing
else if (PaymentRule.equals(MOrder.PAYMENTRULE_Check)) else if (PaymentRule.equals(MOrder.PAYMENTRULE_Check))
{ {
// sCurrencyCombo.getSelectedItem(); ListItem selected = sBankAccountCombo.getSelectedItem();
KeyNamePair kp = sBankAccountCombo.getSelectedItem().toKeyNamePair(); KeyNamePair kp = selected != null ? selected.toKeyNamePair() : null;
if (kp != null) if (kp != null)
C_BankAccount_ID = kp.getKey(); C_BankAccount_ID = kp.getKey();
String error = MPaymentValidate.validateRoutingNo(sRoutingField.getText()); String error = MPaymentValidate.validateRoutingNo(sRoutingField.getText());

View File

@ -126,7 +126,8 @@ ContextMenuListener, IZoomableEditor
if (lookup != null) if (lookup != null)
{ {
lookup.addListDataListener(this); lookup.addListDataListener(this);
lookup.setMandatory(isMandatory()); //always need the empty item for zk to work correctly
lookup.setMandatory(false);
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0) if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0)
|| lookup.getDisplayType() != DisplayType.List) || lookup.getDisplayType() != DisplayType.List)