You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2008/09/28 18:45:53 UTC

svn commit: r699861 - in /ofbiz/trunk/specialpurpose/webpos: config/ data/ servicedef/ src/org/ofbiz/webpos/ webapp/webpos/ webapp/webpos/WEB-INF/ webapp/webpos/WEB-INF/actions/ webapp/webpos/WEB-INF/actions/cart/ widget/

Author: mrisaliti
Date: Sun Sep 28 09:45:52 2008
New Revision: 699861

URL: http://svn.apache.org/viewvc?rev=699861&view=rev
Log:
Removed hard-coded posTerminalId pos-1 and add the possibility to select it during login

Modified:
    ofbiz/trunk/specialpurpose/webpos/config/WebPosUiLabels.xml
    ofbiz/trunk/specialpurpose/webpos/data/DemoPosData.xml
    ofbiz/trunk/specialpurpose/webpos/servicedef/services.xml
    ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java
    ofbiz/trunk/specialpurpose/webpos/webapp/webpos/Login.ftl
    ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/Login.groovy
    ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
    ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/webpos/widget/CommonScreens.xml

Modified: ofbiz/trunk/specialpurpose/webpos/config/WebPosUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/config/WebPosUiLabels.xml?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/config/WebPosUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/config/WebPosUiLabels.xml Sun Sep 28 09:45:52 2008
@@ -126,6 +126,11 @@
         <value xml:lang="en">Cart Total</value>
         <value xml:lang="it">Totale carrello</value>
     </property>
+    <property key="WebPosChooseTerminal">
+        <value xml:lang="en">Choose Terminal</value>
+        <value xml:lang="it">Scegli Terminale</value>
+    </property>
+
     <property key="WebPosCompleteSale">
         <value xml:lang="en">Press Finish To Complete Sale</value>
         <value xml:lang="it">Premere TERMINA per completare la vendita</value>
@@ -454,5 +459,4 @@
         <value xml:lang="en">Unit Price</value>
         <value xml:lang="it">Prezzo unitario</value>
     </property>
-
 </resource>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/webpos/data/DemoPosData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/data/DemoPosData.xml?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/data/DemoPosData.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/data/DemoPosData.xml Sun Sep 28 09:45:52 2008
@@ -31,4 +31,7 @@
     <Enumeration description="Petty Cash out" enumCode="CASH_OUT_REASON" enumId="CASH_OUT_REASON" sequenceId="03" enumTypeId="POS_PAID_REASON_OUT"/>
 
     <ProductStorePaymentSetting productStoreId="9100" paymentMethodTypeId="PERSONAL_CHECK" paymentServiceTypeEnumId="PRDS_PAY_EXTERNAL" paymentService=""/>
+
+    <PosTerminal posTerminalId="pos-2" facilityId="MyRetailStore"/>
+    <PosTerminal posTerminalId="pos-3" facilityId="MyRetailStore"/>
 </entity-engine-xml>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/webpos/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/servicedef/services.xml?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/servicedef/services.xml Sun Sep 28 09:45:52 2008
@@ -38,4 +38,10 @@
         <attribute type="java.util.List" mode="OUT" name="productsList" optional="true"/>
         <attribute type="java.util.List" mode="OUT" name="productsId" optional="true"/>
     </service>
+
+    <service name="posLogin" engine="java"
+             location="org.ofbiz.webpos.WebPosEvents" invoke="posLogin">
+        <description>Login for Web Pos</description>
+        <attribute type="String" mode="IN" name="posTerminalId" optional="false"/>
+    </service>
 </services>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java (original)
+++ ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java Sun Sep 28 09:45:52 2008
@@ -31,7 +31,6 @@
 import org.ofbiz.securityext.login.LoginEvents;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.webpos.session.WebPosSession;
-import org.ofbiz.webpos.transaction.WebPosTransaction;
 
 public class WebPosEvents {
     
@@ -74,9 +73,13 @@
                 session.setAttribute("shoppingCart", cart);
             }
             
-            //TODO remove hard-coded value pos-1 and take it from login selecting the PosTerminal.
-            webPosSession = new WebPosSession("pos-1", null, userLogin, request.getLocale(), productStoreId, facilityId, currencyUomId, delegator, dispatcher, cart);
-            session.setAttribute("webPosSession", webPosSession);
+            // get the posTerminalId
+            String posTerminalId = (String) request.getParameter("posTerminalId");
+            
+            if (UtilValidate.isNotEmpty(posTerminalId)) {
+            	webPosSession = new WebPosSession(posTerminalId, null, userLogin, request.getLocale(), productStoreId, facilityId, currencyUomId, delegator, dispatcher, cart);
+                session.setAttribute("webPosSession", webPosSession);
+            }
         }
         return webPosSession;
     }

Modified: ofbiz/trunk/specialpurpose/webpos/webapp/webpos/Login.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/Login.ftl?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/webapp/webpos/Login.ftl (original)
+++ ofbiz/trunk/specialpurpose/webpos/webapp/webpos/Login.ftl Sun Sep 28 09:45:52 2008
@@ -49,6 +49,16 @@
             <td><input type="password" name="PASSWORD" value="" size="20"/></td>
           </tr>
           <tr>
+            <td class="label">${uiLabelMap.WebPosChooseTerminal}</td>
+            <td>
+              <select name="posTerminalId" id="posTerminalId">
+                <#list posTerminals as posTerminal>
+                  <option value="${posTerminal.posTerminalId}">${posTerminal.posTerminalId}</option>
+                </#list>
+              </select>
+            </td>
+          </tr>
+          <tr>
             <td colspan="2" align="center">
               <input type="submit" value="${uiLabelMap.CommonLogin}"/>
             </td>

Modified: ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/Login.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/Login.groovy?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/Login.groovy (original)
+++ ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/Login.groovy Sun Sep 28 09:45:52 2008
@@ -19,6 +19,8 @@
 
 import org.ofbiz.base.util.*;
 import org.ofbiz.common.CommonWorkers;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.webapp.control.*;
 
 context.autoUserLogin = session.getAttribute("autoUserLogin");
@@ -31,4 +33,17 @@
 } else {
     previousParams = "";
 }
-context.previousParams = previousParams;
\ No newline at end of file
+context.previousParams = previousParams;
+
+productStoreId = ProductStoreWorker.getProductStoreId(request);
+productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
+
+if (productStore) {
+	facilityId = productStore.getString("inventoryFacilityId");
+
+    if (facilityId) {	
+	    context.posTerminals = delegator.findList("PosTerminal", EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId), null, ["posTerminalId"], null, false);
+	} else {
+        context.posTerminals = delegator.findList("PosTerminal", null, null, ["posTerminalId"], null, false);
+	}
+}
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy (original)
+++ ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy Sun Sep 28 09:45:52 2008
@@ -32,6 +32,8 @@
     sdf = new SimpleDateFormat(UtilProperties.getMessage(WebPosTransaction.resource, "WebPosTransactionDateFormat", Locale.getDefault()));
     context.transactionDate = sdf.format(new Date());
     context.totalDue = webPosSession.getCurrentTransaction().getTotalDue();
+} else {
+    shoppingCart = null;
 }
 
 // Get the Cart and Prepare Size
@@ -58,10 +60,10 @@
             }
         }
     }
+    context.shoppingCart = shoppingCart;
 } else {
     context.shoppingCartSize = 0;
 }
-context.shoppingCart = shoppingCart;
 
 context.paymentCash   = delegator.findOne("PaymentMethodType", ["paymentMethodTypeId" : "CASH"], true);
 context.paymentCheck  = delegator.findOne("PaymentMethodType", ["paymentMethodTypeId" : "PERSONAL_CHECK"], true);

Modified: ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml Sun Sep 28 09:45:52 2008
@@ -77,8 +77,8 @@
         <security https="true" auth="false"/>
         <event type="java" path="org.ofbiz.webpos.WebPosEvents" invoke="posLogin"/>
         <response name="success" type="view" value="main"/>
-        <response name="requirePasswordChange" type="view" value="requirePasswordChange"/>
-        <response name="error" type="view" value="Login"/>
+        <response name="requirePasswordChange" type="view" value="RequirePasswordChange"/>
+        <response name="error" type="view" value="login"/>
     </request-map>
 
     <request-map uri="logout">
@@ -116,7 +116,7 @@
         <security https="true" auth="false"/>
         <event type="java" path="org.ofbiz.webpos.WebPosEvents" invoke="posLogin"/>
         <response name="success" type="view" value="main"/>
-        <response name="requirePasswordChange" type="view" value="requirePasswordChange"/>
+        <response name="requirePasswordChange" type="view" value="RequirePasswordChange"/>
         <response name="error" type="view" value="Login"/>
     </request-map>
     
@@ -126,7 +126,7 @@
         <response name="success" type="request-redirect" value="main"/>
         <response name="error" type="view" value="main"/>
     </request-map>
-    
+
     <request-map uri="SetSessionLocale">
         <security https="false" auth="false"/>
         <event type="java" path="org.ofbiz.common.CommonEvents" invoke="setSessionLocale"/>
@@ -372,7 +372,7 @@
     <view-map name="main" type="screen" page="component://webpos/widget/WebPosScreens.xml#Main"/>
     <view-map name="login" type="screen" page="component://webpos/widget/CommonScreens.xml#Login"/>
     <view-map name="Login" type="screen" page="component://webpos/widget/CommonScreens.xml#Login"/>
-    <view-map name="requirePasswordChange" type="screen" page="component://webpos/widget/CommonScreens.xml#RequirePasswordChange"/>    
+    <view-map name="RequirePasswordChange" type="screen" page="component://webpos/widget/CommonScreens.xml#RequirePasswordChange"/>
     <view-map name="Manager" type="screen" page="component://webpos/widget/WebPosScreens.xml#Manager"/>
     <view-map name="Payment" type="screen" page="component://webpos/widget/WebPosScreens.xml#Payment"/>
     <view-map name="Promo" type="screen" page="component://webpos/widget/WebPosScreens.xml#Promo"/>

Modified: ofbiz/trunk/specialpurpose/webpos/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/widget/CommonScreens.xml?rev=699861&r1=699860&r2=699861&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/widget/CommonScreens.xml Sun Sep 28 09:45:52 2008
@@ -166,7 +166,7 @@
         <section>
             <actions>
                 <set field="MainColumnStyle" value="leftonly"/>
-                <set field="titleProperty" value="PageTitleLogin"/>
+                <set field="titleProperty" value="WebPosPageTitleLogin"/>
                 <set field="headerItem" value="login"/>
                 <script location="component://webpos/webapp/webpos/WEB-INF/actions/Login.groovy"/>
             </actions>