Author: jleroux
Date: Thu Oct 22 15:16:26 2009
New Revision: 828740
URL: http://svn.apache.org/viewvc?rev=828740&view=rev
Log:
Add the possibility to search exact names or names contained in
Modified:
ofbiz/trunk/specialpurpose/pos/config/PosUiLabels.xml
ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties
ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties
ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/ClientProfile.xml
ofbiz/trunk/specialpurpose/pos/screens/default/dialog/ClientProfile.xml
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/config/PosUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/PosUiLabels.xml?rev=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/config/PosUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/pos/config/PosUiLabels.xml Thu Oct 22 15:16:26
2009
@@ -457,6 +457,14 @@
<value xml:lang="ro">Term:</value>
<value xml:lang="zh">ç»ç«¯:</value>
</property>
+ <property key="PosTipNameRadioContains">
+ <value xml:lang="en">To look for names which contain the name
entered</value>
+ <value xml:lang="fr">Pour rechercher des noms contenant celui
entré</value>
+ </property>
+ <property key="PosTipNameRadioEquals">
+ <value xml:lang="en">To look for names strictly equals to the name
entered</value>
+ <value xml:lang="fr">Pour rechercher des noms exactement égaux Ã
celui entré</value>
+ </property>
<property key="PosTotal">
<value xml:lang="en">TOTAL</value>
<value xml:lang="es">Total</value>
Modified: ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties?rev=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties (original)
+++ ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties Thu Oct 22
15:16:26 2009
@@ -99,6 +99,8 @@
item_not_configurable=The selected item is not configurable.
listClient=Clients list
nameClient=Name
+nameContains=Contains
+nameEquals=Equals
no_sales=No sales saved
order_not_found=ORDER NOT FOUND
phoneClient=Phone number
Modified: ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties?rev=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties (original)
+++ ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties Thu Oct 22
15:16:26 2009
@@ -99,6 +99,8 @@
item_not_configurable=Article non configurable
listClient=Liste des clients
nameClient=Nom
+nameContains=Contient
+nameEquals=Egal
no_sales=Aucune vente sauv\u00e9e
order_not_found=N\u00b0 de transaction inconnu !
phoneClient=N\u00b0 de t\u00e9l\u00e9phone
Modified:
ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/ClientProfile.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/ClientProfile.xml?rev=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/ClientProfile.xml
(original)
+++ ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/ClientProfile.xml Thu
Oct 22 15:16:26 2009
@@ -20,8 +20,11 @@
<XPage class="net.xoetrope.swing.XDialog" resource="">
<Components>
<Panel name="ClientPanel" x="0" y="0" w="680" h="400" style="menu">
- <Label name="nameLabel" x="20" y="30" w="100" h="40"
content="nameClient" style="editAndList"/>
+ <Label name="nameLabel" x="37" y="5" w="100" h="40"
content="nameClient" style="editAndList"/>
<Edit name="nameEdit" x="120" y="20" w="300" h="40"
style="editAndList"/>
+ <RadioButton name="NameRadioEquals" x="20" y="20" w="100" h="20"
style="dialogButton" content="nameEquals" selected="true" alignment="left"
image="xui_icon.png" tooltip="tipNameRadioEquals"/>
+ <RadioButton name="NameRadioContain" x="20" y="40" w="100" h="20"
style="dialogButton" content="nameContains" selected="false" alignment="left"
image="xui_icon.png" tooltip="tipNameRadioContain"/>
+
<Label name="emailLabel" x="20" y="90" w="100" h="40"
content="emailClient" style="editAndList"/>
<Edit name="emailEdit" x="120" y="80" w="300" h="40"
style="editAndList"/>
<Label name="phoneLabel" x="20" y="150" w="100" h="40"
content="phoneClient" style="editAndList"/>
Modified:
ofbiz/trunk/specialpurpose/pos/screens/default/dialog/ClientProfile.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/default/dialog/ClientProfile.xml?rev=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/screens/default/dialog/ClientProfile.xml
(original)
+++ ofbiz/trunk/specialpurpose/pos/screens/default/dialog/ClientProfile.xml Thu
Oct 22 15:16:26 2009
@@ -20,8 +20,11 @@
<XPage class="net.xoetrope.swing.XDialog" resource="">
<Components>
<Panel name="ClientPanel" x="0" y="0" w="680" h="400" style="menu">
- <Label name="nameLabel" x="20" y="30" w="100" h="40"
content="nameClient" style="editAndList"/>
+ <Label name="nameLabel" x="37" y="5" w="100" h="40"
content="nameClient" style="editAndList"/>
<Edit name="nameEdit" x="120" y="20" w="300" h="40"
style="editAndList"/>
+ <RadioButton name="NameRadioEquals" x="20" y="20" w="100" h="20"
style="dialogButton" content="nameEquals" selected="true" alignment="left"
image="xui_icon.png" tooltip="tipNameRadioEquals"/>
+ <RadioButton name="NameRadioContain" x="20" y="40" w="100" h="20"
style="dialogButton" content="nameContains" selected="false" alignment="left"
image="xui_icon.png" tooltip="tipNameRadioContain"/>
+
<Label name="emailLabel" x="20" y="90" w="100" h="40"
content="emailClient" style="editAndList"/>
<Edit name="emailEdit" x="120" y="80" w="300" h="40"
style="editAndList"/>
<Label name="phoneLabel" x="20" y="150" w="100" h="40"
content="phoneClient" style="editAndList"/>
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=828740&r1=828739&r2=828740&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
(original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Thu
Oct 22 15:16:26 2009
@@ -1535,7 +1535,7 @@
}
- public List<Map<String, String>> searchClientProfile(String name, String
email, String phone, String card, PosScreen pos) {
+ public List<Map<String, String>> searchClientProfile(String name, String
email, String phone, String card, PosScreen pos, Boolean equalsName) {
Delegator delegator = this.session.getDelegator();
List<GenericValue> partyList = null;
@@ -1597,10 +1597,12 @@
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...
if (UtilValidate.isNotEmpty(name)) {
- andExprs.add(EntityCondition.makeCondition("lastName",
EntityOperator.EQUALS, name)); // Plain name
- // andExprs.add(EntityCondition.makeCondition("lastName",
EntityOperator.LIKE, "%"+name+"%")); // Less restrictive
- //
andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"),
EntityOperator.LIKE, EntityFunction.UPPER("%"+name+"%"))); // Even less
restrictive
-
+ if (equalsName) {
+ andExprs.add(EntityCondition.makeCondition("lastName",
EntityOperator.EQUALS, name)); // Plain name
+ } else {
+ // andExprs.add(EntityCondition.makeCondition("lastName",
EntityOperator.LIKE, "%"+name+"%")); // Less restrictive
+
andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"),
EntityOperator.LIKE, EntityFunction.UPPER("%"+name+"%"))); // Even less
restrictive
+ }
}
if (UtilValidate.isNotEmpty(card)) {
andExprs.add(EntityCondition.makeCondition("cardId",
EntityOperator.EQUALS, card));
@@ -1921,7 +1923,7 @@
return null;
} finally {
// Put back passwordAcceptEncryptedAndPlain
value in memory
-
UtilProperties.setPropertyValueInMemory("security.properties",
"password.accept.encrypted.and.plain", passwordAcceptEncryptedAndPlain);
+
UtilProperties.setPropertyValueInMemory("security.properties",
"password.accept.encrypted.and.plain", passwordAcceptEncryptedAndPlain);
}
if (ServiceUtil.isError(svcRes)) {
pos.showDialog("dialog/error/exception",
ServiceUtil.getErrorMessage(svcRes));
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=828740&r1=828739&r2=828740&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
Thu Oct 22 15:16:26 2009
@@ -32,6 +32,7 @@
import net.xoetrope.swing.XDialog;
import net.xoetrope.swing.XEdit;
import net.xoetrope.swing.XLabel;
+import net.xoetrope.swing.XRadioButton;
import net.xoetrope.xui.XPage;
import net.xoetrope.xui.events.XEventHelper;
@@ -56,6 +57,8 @@
protected XDialog m_dialog = null;
protected XLabel m_nameLabel = null;
protected XEdit m_nameEdit = null;
+ protected XRadioButton m_nameRadioEquals = null;
+ protected XRadioButton m_nameRadioContains = null;
protected XLabel m_emailLabel = null;
protected XEdit m_emailEdit = null;
protected XLabel m_phoneLabel = null;
@@ -93,6 +96,11 @@
m_nameEdit = (XEdit) m_dialog.findComponent("nameEdit"); // 1st for
focus (still does not work)
m_nameLabel = (XLabel) m_dialog.findComponent("nameLabel");
+ m_nameRadioEquals = (XRadioButton)
m_dialog.findComponent("NameRadioEquals");
+
m_nameRadioEquals.setToolTipText(UtilProperties.getMessage(PosTransaction.resource,
"PosTipNameRadioEquals", locale));
+ m_nameRadioContains = (XRadioButton)
m_dialog.findComponent("NameRadioContain");
+
m_nameRadioContains.setToolTipText(UtilProperties.getMessage(PosTransaction.resource,
"PosTipNameRadioContains", locale));
+
m_emailLabel = (XLabel) m_dialog.findComponent("emailLabel");
m_emailEdit = (XEdit) m_dialog.findComponent("emailEdit");
m_phoneLabel = (XLabel) m_dialog.findComponent("phoneLabel");
@@ -250,7 +258,8 @@
private void searchClientProfile(String name, String email, String phone,
String card) {
final ClassLoader cl = this.getClassLoader(m_pos);
Thread.currentThread().setContextClassLoader(cl);
- List<Map<String, String>> partyList =
m_trans.searchClientProfile(name, email, phone, card, m_pos);
+ Boolean equalsName = m_nameRadioEquals.isSelected();
+ List<Map<String, String>> partyList =
m_trans.searchClientProfile(name, email, phone, card, m_pos, equalsName);
boolean first = true;
m_clientListCombo.removeAll();
m_clientListBidingCombo.clear();