You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/10/09 18:55:18 UTC
svn commit: r823612 - in /ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos:
PosTransaction.java screen/ClientProfile.java
Author: jleroux
Date: Fri Oct 9 16:55:18 2009
New Revision: 823612
URL: http://svn.apache.org/viewvc?rev=823612&view=rev
Log:
I changed my mind and now accept also any person, even created out of the POS. The only constraint I keep : these persons must have a valid login
Modified:
ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=823612&r1=823611&r2=823612&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Fri Oct 9 16:55:18 2009
@@ -1607,7 +1607,6 @@
andExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")));
andExprs.add(EntityCondition.makeCondition("partyTypeId", EntityOperator.EQUALS, "PERSON")); // Only persons for now...
andExprs.add(EntityCondition.makeCondition("userLoginId", EntityOperator.NOT_EQUAL, null)); // Should have a login
- andExprs.add(EntityCondition.makeCondition("memberId", EntityOperator.NOT_EQUAL, null)); // Should have a card Id (we take into account only the person created here)
if (UtilValidate.isNotEmpty(name)) {
andExprs.add(EntityCondition.makeCondition("lastName", EntityOperator.EQUALS, name));
}
@@ -1786,7 +1785,7 @@
pos.showDialog("dialog/error/exception", e.getMessage());
return result;
}
- GenericValue partyLogin = userLogins.get(0); // We need at least a party's login, we are sure there is one as we keep only users with at least one login
+ GenericValue partyLogin = userLogins.get(0); // We need at least a party's login ...
GenericValue person = null;
try {
person = session.getDelegator().findByPrimaryKey("Person", UtilMisc.toMap("partyId", partyId));
@@ -1911,8 +1910,9 @@
pos.showDialog("dialog/error/exception", e.getMessage());
return result;
}
- GenericValue PartyTelecomNumber = PartyTelecomNumbers.get(0); // we suppose only one phone number (should be ok anyway because of the contactMechPurposeTypeId == "PHONE_HOME")
- if (UtilValidate.isNotEmpty(PartyTelecomNumber)) { // Should not be needed but in case memberId has been used for another purpose avoid an NPE (we test memberId not null initially to keep only POS created users)
+
+ if (UtilValidate.isNotEmpty(PartyTelecomNumbers)) {
+ GenericValue PartyTelecomNumber = PartyTelecomNumbers.get(0); // we suppose only one phone number (should be ok anyway because of the contactMechPurposeTypeId == "PHONE_HOME")
String contactNumber = PartyTelecomNumber.getString("contactNumber");
if (!phone.equals(contactNumber)) {
String newContactMechId = PartyTelecomNumber.getString("contactMechId");
@@ -1936,6 +1936,24 @@
return result;
}
}
+ } else {
+ // createPartyTelecomNumber
+ svcCtx.clear();
+ svcCtx.put("userLogin", partyLogin);
+ svcCtx.put("contactNumber", phone);
+ svcCtx.put("partyId", partyId);
+ svcCtx.put("contactMechPurposeTypeId", "PHONE_HOME");
+ try {
+ svcRes = dispatcher.runSync("createPartyTelecomNumber", svcCtx);
+ } catch (GenericServiceException e) {
+ Debug.logError(e, module);
+ pos.showDialog("dialog/error/exception", e.getMessage());
+ return result;
+ }
+ if (ServiceUtil.isError(svcRes)) {
+ pos.showDialog("dialog/error/exception", ServiceUtil.getErrorMessage(svcRes));
+ return result;
+ }
}
}
}
Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java?rev=823612&r1=823611&r2=823612&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java Fri Oct 9 16:55:18 2009
@@ -283,10 +283,14 @@
String client = (String) clientListCombo.getSelectedItem();
if (UtilValidate.isNotEmpty(client)) {
String[] clientInfos = client.split(" \\| ");
- if (clientInfos.length > 0) m_nameEdit.setText(clientInfos[0]);
- if (clientInfos.length > 1) m_emailEdit.setText(clientInfos[1]);
- if (clientInfos.length > 2) m_phoneEdit.setText(clientInfos[2]);
- if (clientInfos.length > 3) m_cardEdit.setText(clientInfos[3]);
+ String name = clientInfos.length > 0 ? clientInfos[0] : "";
+ String email = clientInfos.length > 1 ? clientInfos[1] : "";
+ String phone = clientInfos.length > 2 ? clientInfos[2] : "";
+ String card = clientInfos.length > 3 ? clientInfos[3] : "";
+ m_nameEdit.setText(name);
+ m_emailEdit.setText(email);
+ m_phoneEdit.setText(phone);
+ m_cardEdit.setText(card);
m_partyId = m_clientListBidingCombo.get(clientListCombo.getSelectedIndex());
}
}