svn commit: r703659 - in /ofbiz/trunk: framework/common/config/ specialpurpose/pos/screens/default/dialog/ specialpurpose/pos/src/org/ofbiz/pos/ specialpurpose/pos/src/org/ofbiz/pos/event/ specialpurpose/pos/src/org/ofbiz/pos/screen/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r703659 - in /ofbiz/trunk: framework/common/config/ specialpurpose/pos/screens/default/dialog/ specialpurpose/pos/src/org/ofbiz/pos/ specialpurpose/pos/src/org/ofbiz/pos/event/ specialpurpose/pos/src/org/ofbiz/pos/screen/

jleroux@apache.org
Author: jleroux
Date: Sat Oct 11 06:28:50 2008
New Revision: 703659

URL: http://svn.apache.org/viewvc?rev=703659&view=rev
Log:
The POS part and i18n of " Add a new "paymentReasonId" on PosTerminalInternTx entity and store payment reason id during Pos Paid IN/OUT" (https://issues.apache.org/jira/browse/OFBIZ-1991) - OFBIZ-1991
I just wonder if we should keep reasonComment as in POS it's redundant. I keep it for now and ask in Jira issue since I don't know how Marco want to use it in WebPos

Removed:
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/PaidIn.properties
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/PaidIn_fr.properties
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/PaidOut.properties
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/PaidOut_fr.properties
Modified:
    ofbiz/trunk/framework/common/config/CommonEntityLabels.xml
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java

Modified: ofbiz/trunk/framework/common/config/CommonEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonEntityLabels.xml?rev=703659&r1=703658&r2=703659&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonEntityLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonEntityLabels.xml Sat Oct 11 06:28:50 2008
@@ -132,6 +132,26 @@
         <value xml:lang="th">ช่องทางติดต่อ</value>
         <value xml:lang="zh">从属渠道</value>
     </property>
+    <property key="Enumeration.description.BANKING_IN_REASON">
+        <value xml:lang="en">Banking during the day</value>
+        <value xml:lang="fr">Opération banquaire</value>
+    </property>    
+    <property key="Enumeration.description.BANKING_OUT_REASON">
+        <value xml:lang="en">Banking during the day</value>
+        <value xml:lang="fr">Opération banquaire</value>
+    </property>
+    <property key="Enumeration.description.CASH_IN_REASON">
+        <value xml:lang="en">Petty Cash Paid into Till</value>
+        <value xml:lang="fr">Entrée d'espèces dans la caisse</value>
+    </property>    
+    <property key="Enumeration.description.CASH_OUT_REASON">
+        <value xml:lang="en">Petty Cash out</value>
+        <value xml:lang="fr">Sortie d'espèces de la caisse</value>
+    </property>    
+    <property key="Enumeration.description.CHANGE_IN_REASON">
+        <value xml:lang="en">Change added to Till's float</value>
+        <value xml:lang="fr">Monnaie ajoutée à l'encours de caisse</value>
+    </property>    
     <property key="Enumeration.description.CNT_PRV_BRONZE">
         <value xml:lang="en">CNT_PRV_BRONZE</value>
         <value xml:lang="fr">Niveau Bronze</value>

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=703659&r1=703658&r2=703659&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Sat Oct 11 06:28:50 2008
@@ -143,6 +143,10 @@
         trace("transaction created");
     }
 
+    public XuiSession getSession() {
+        return session;
+    }
+
     public String getUserId() {
         return session.getUserId();
     }

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java?rev=703659&r1=703658&r2=703659&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java Sat Oct 11 06:28:50 2008
@@ -445,6 +445,7 @@
                 return;
             }
             internTx.set("reasonComment", mapInOut.get("reason"));
+            internTx.set("reasonEnumId", mapInOut.get("reason"));
             try {
                 internTx.create();
             } catch (GenericEntityException e) {

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java?rev=703659&r1=703658&r2=703659&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java Sat Oct 11 06:28:50 2008
@@ -19,28 +19,31 @@
 package org.ofbiz.pos.screen;
 
 import java.util.HashMap;
-import java.util.ResourceBundle;
-import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
 import javax.swing.DefaultComboBoxModel;
 
+import javolution.util.FastList;
 import net.xoetrope.swing.XButton;
+import net.xoetrope.swing.XComboBox;
 import net.xoetrope.swing.XDialog;
 import net.xoetrope.swing.XEdit;
 import net.xoetrope.swing.XLabel;
-import net.xoetrope.swing.XComboBox;
 import net.xoetrope.xui.XPage;
 import net.xoetrope.xui.events.XEventHelper;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
 import org.ofbiz.pos.PosTransaction;
 
 
+@SuppressWarnings("serial")
 public class PaidInOut extends XPage {
 
     /**
@@ -53,7 +56,6 @@
     protected XLabel m_amoutLabel = null;
     protected XEdit m_amountEdit = null;
     protected XLabel m_reasonLabel = null;
-    static protected Hashtable m_reasonMap = new Hashtable();
     protected XComboBox m_reasonsCombo = null;
     protected XButton m_cancel = null;
     protected XButton m_ok = null;
@@ -71,7 +73,7 @@
         m_type = type;
     }
 
-    public Map openDlg() {
+    public Map<String, String> openDlg() {
         m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/PaidInOut");
         m_amountEdit = (XEdit) m_dialog.findComponent("amountEdit");
         m_reasonsCombo = (XComboBox) m_dialog.findComponent("ReasonsCombo");
@@ -80,33 +82,33 @@
         m_ok = (XButton) m_dialog.findComponent("BtnOk");
         m_amoutLabel = (XLabel) m_dialog.findComponent("amoutLabel");
         m_reasonLabel = (XLabel) m_dialog.findComponent("reasonLabel");
+        Locale locale = Locale.getDefault();
 
         XEventHelper.addMouseHandler(this, m_cancel, "cancel");
         XEventHelper.addMouseHandler(this, m_ok, "verify");
         XEventHelper.addMouseHandler(this, m_amountEdit, "editAmount");
 
         m_comboModel = new DefaultComboBoxModel();
-        ResourceBundle reasons = null;
-        Enumeration reasonsKeys = null;
-
-        if (m_type.equals("IN")) {
-            m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PaidInTitle", Locale.getDefault()));
-            reasons = ResourceBundle.getBundle(m_pos.getScreenLocation() + "/dialog/PaidIn", Locale.getDefault());
-            reasonsKeys = reasons.getKeys();
-        }
-        else { // OUT
-            m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PaidOutTitle", Locale.getDefault()));
-            reasons = ResourceBundle.getBundle(m_pos.getScreenLocation() + "/dialog/PaidOut", Locale.getDefault());
-            reasonsKeys = reasons.getKeys();
-        }
-
-        while (reasonsKeys.hasMoreElements()) {
-            String key = (String)reasonsKeys.nextElement();
-            String val = reasons.getString(key);
-            m_comboModel.addElement(val);
+        List<GenericValue> posPaidReasons = FastList.newInstance();
+        if (m_type.equals("IN")) {
+            m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PaidInTitle", locale));
+            try {
+                posPaidReasons = m_trans.getSession().getDelegator().findByAndCache("Enumeration", UtilMisc.toMap("enumTypeId", "POS_PAID_REASON_IN"));
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+        } else { // OUT
+            m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PaidOutTitle", locale));
+            try {
+                posPaidReasons = m_trans.getSession().getDelegator().findByAndCache("Enumeration", UtilMisc.toMap("enumTypeId", "POS_PAID_REASON_OUT"));
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);            }                
+        }
+        for (GenericValue reason : posPaidReasons) {
+            m_comboModel.addElement(reason.get("description", locale));
         }
         m_reasonsCombo.setModel(m_comboModel);
-        m_reasonsCombo.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "CreateOrChooseReasonInOut", Locale.getDefault()));
+        m_reasonsCombo.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "CreateOrChooseReasonInOut", locale));
 
         m_dialog.pack();
         m_reasonsCombo.requestFocusInWindow();