svn commit: r440422 - in /incubator/ofbiz/trunk/applications/order: config/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/requirement/ widget/ordermgr/

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

svn commit: r440422 - in /incubator/ofbiz/trunk/applications/order: config/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/requirement/ widget/ordermgr/

jacopoc
Author: jacopoc
Date: Tue Sep  5 10:56:15 2006
New Revision: 440422

URL: http://svn.apache.org/viewvc?view=rev&rev=440422
Log:
First draft of quick purchase order creation from requirements list.

Added:
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl   (with props)
Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml
    incubator/ofbiz/trunk/applications/order/widget/ordermgr/RequirementScreens.xml

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=440422&r1=440421&r2=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Tue Sep  5 10:56:15 2006
@@ -45,6 +45,7 @@
 OrderAmount=Amount
 OrderApproved=Approved
 OrderApproveOrder = Approve Order
+OrderApprovedProductRequirements=Approved Product Requirements
 OrderApproveRequirements=Approve Requirements
 OrderAutoCreateQuoteAdjustments=Auto Create Adjustments
 OrderAvs=AVS

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?view=diff&rev=440422&r1=440421&r2=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Tue Sep  5 10:56:15 2006
@@ -464,6 +464,31 @@
         }
     }
 
+    public static String quickInitPurchaseOrder(HttpServletRequest request, HttpServletResponse response) {
+        GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
+        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+        HttpSession session = request.getSession();
+        
+        ShoppingCart cart = new WebShoppingCart(request);
+        // TODO: the code below here needs some cleanups
+        cart.setBillToCustomerPartyId(request.getParameter("billToCustomerPartyId_o_0"));
+        cart.setBillFromVendorPartyId(request.getParameter("supplierPartyId_o_0"));
+        cart.setOrderPartyId(request.getParameter("supplierPartyId_o_0"));
+
+        cart.setOrderType("PURCHASE_ORDER");
+        
+        // Set the cart's default checkout options for a quick checkout
+        // TODO: the code below need to be enhanced to handle po
+        //cart.setDefaultCheckoutOptions(dispatcher);
+
+        session.setAttribute("shoppingCart", cart);
+        session.setAttribute("productStoreId", cart.getProductStoreId());
+        session.setAttribute("orderMode", cart.getOrderType());
+        session.setAttribute("orderPartyId", cart.getOrderPartyId());
+
+        return "success";
+    }
+
     /** Adds a set of requirements to the cart
      */
     public static String addToCartBulkRequirements(HttpServletRequest request, HttpServletResponse response) {

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?view=diff&rev=440422&r1=440421&r2=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Tue Sep  5 10:56:15 2006
@@ -1000,6 +1000,16 @@
         <response name="success" type="view" value="ApproveRequirements"/>
         <response name="error" type="view" value="ApproveRequirements"/>
     </request-map>
+    <request-map uri="ApprovedProductRequirements">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ApprovedProductRequirements"/>
+    </request-map>
+    <request-map uri="quickPurchaseOrderEntry">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="quickInitPurchaseOrder"/>
+        <response name="success" type="request" value="addRequirementsToCart"/>
+        <response name="error" type="view" value="ApprovedProductRequirements"/>
+    </request-map>
 
     <request-map uri="RequirementsForSupplier">
         <security https="true" auth="true"/>
@@ -1416,6 +1426,7 @@
     <view-map name="ListRequirementRoles" type="screen" page="component://order/widget/ordermgr/RequirementScreens.xml#ListRequirementRoles"/>
     <view-map name="EditRequirementRole" type="screen" page="component://order/widget/ordermgr/RequirementScreens.xml#EditRequirementRole"/>
     <view-map name="ApproveRequirements" page="component://order/widget/ordermgr/RequirementScreens.xml#ApproveRequirements" type="screen"/>
+    <view-map name="ApprovedProductRequirements" page="component://order/widget/ordermgr/RequirementScreens.xml#ApprovedProductRequirements" type="screen"/>
     <view-map name="RequirementsForSupplier" type="screen" page="component://order/widget/ordermgr/OrderEntryScreens.xml#RequirementsForSupplier"/>
     <view-map name="FindQuoteForCart" type="screen" page="component://order/widget/ordermgr/OrderEntryScreens.xml#FindQuoteForCart"/>
 

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml?view=diff&rev=440422&r1=440421&r2=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementForms.xml Tue Sep  5 10:56:15 2006
@@ -220,4 +220,60 @@
           <submit/>
         </field>
     </form>
+    <form name="FindApprovedProductRequirements" type="single" target="ApprovedProductRequirements" title="" default-title-style="tableheadtext" default-widget-style="tabletext"
+        default-tooltip-style="tabletext">
+        <field name="showList"><hidden value="Y"/></field>
+        <field name="requirementId"><text-find/></field>
+        <field name="partyId" title="${uiLabelMap.PartySupplier}"><lookup target-form-name="LookupPartyName"/></field>
+        <field name="productId" title="${uiLabelMap.ProductProductId}"><lookup target-form-name="LookupProduct"/></field>
+        <field name="requirementByDate"><date-find type="date"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonLookup}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    <form name="ApprovedProductRequirementsList" type="list" title="" list-name="requirementsForSupplier"
+        paginate-target="RequirementsForSupplier" default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
+        <actions>
+            <service service-name="prepareFind" result-map-name="resultConditions">
+                <field-map field-name="inputFields" env-name="requestParameters"/>
+                <field-map field-name="entityName" value="Requirement"/>
+            </service>
+            <service service-name="getRequirementsForSupplier" result-map-name="result" result-map-list-name="requirementsForSupplier">
+                <!--<field-map field-name="orderByList" env-name="resultConditions.orderByList"/>-->
+                <field-map field-name="requirementConditions" env-name="resultConditions.entityConditionList"/>
+                <field-map field-name="partyId" env-name="parameters.partyId"/>
+            </service>
+        </actions>
+        <field name="requirementId"><display/></field>
+        <field name="productId"><hidden value="${productId}"/></field>
+        <field name="productId">
+            <display-entity entity-name="Product" key-field-name="productId" description="${productId} - ${internalName}"/>
+        </field>
+        <field name="requiredByDate"><display/></field>
+        <field name="quantity"><display/></field>
+    </form>
+    <form name="ApprovedProductRequirements" type="multi" use-row-submit="true" target="quickPurchaseOrderEntry" title="" list-name="requirementsForSupplier"
+        paginate-target="RequirementsForSupplier" default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
+        <actions>
+            <service service-name="prepareFind" result-map-name="resultConditions">
+                <field-map field-name="inputFields" env-name="requestParameters"/>
+                <field-map field-name="entityName" value="Requirement"/>
+            </service>
+            <service service-name="getRequirementsForSupplier" result-map-name="result" result-map-list-name="requirementsForSupplier">
+                <!--<field-map field-name="orderByList" env-name="resultConditions.orderByList"/>-->
+                <field-map field-name="requirementConditions" env-name="resultConditions.entityConditionList"/>
+                <field-map field-name="partyId" env-name="parameters.partyId"/>
+            </service>
+        </actions>
+        <field name="billToCustomerPartyId"><hidden value="Company"/></field>
+        <field name="supplierPartyId"><hidden value="${parameters.partyId}"/></field>
+        <field name="requirementId"><display/></field>
+        <field name="productId"><hidden value="${productId}"/></field>
+        <field name="productId">
+            <display-entity entity-name="Product" key-field-name="productId" description="${productId} - ${internalName}"/>
+        </field>
+
+        <field name="requiredByDate"><display/></field>
+        <field name="quantity"><text/></field>
+        <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><check/></field>
+        <field name="submitButton" title="${uiLabelMap.OrderInputQuickPurchaseOrder}" widget-style="smallSubmit"><submit/></field>
+    </form>
 </forms>

Added: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl?view=auto&rev=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl (added)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl Tue Sep  5 10:56:15 2006
@@ -0,0 +1,25 @@
+<#--
+
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations
+under the License.
+-->
+
+<#assign unselectedClassName = "tabButton">
+<#assign selectedClassMap = {page.tabButtonItem?default("void") : "tabButtonSelected"}>
+
+<div class='tabContainer'>
+    <a href="<@ofbizUrl>FindRequirements</@ofbizUrl>" class="${selectedClassMap.FindRequirements?default(unselectedClassName)}">${uiLabelMap.OrderRequirements}</a>
+    <a href="<@ofbizUrl>ApproveRequirements</@ofbizUrl>" class="${selectedClassMap.ApproveRequirements?default(unselectedClassName)}">${uiLabelMap.OrderApproveRequirements}</a>
+    <a href="<@ofbizUrl>ApprovedProductRequirements</@ofbizUrl>" class="${selectedClassMap.ApprovedProductRequirements?default(unselectedClassName)}">${uiLabelMap.OrderApprovedProductRequirements}</a>
+</div>

Propchange: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/requirement/RequirementsTabBar.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/applications/order/widget/ordermgr/RequirementScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/widget/ordermgr/RequirementScreens.xml?view=diff&rev=440422&r1=440421&r2=440422
==============================================================================
--- incubator/ofbiz/trunk/applications/order/widget/ordermgr/RequirementScreens.xml (original)
+++ incubator/ofbiz/trunk/applications/order/widget/ordermgr/RequirementScreens.xml Tue Sep  5 10:56:15 2006
@@ -50,25 +50,51 @@
             </widgets>
         </section>
     </screen>
+    <screen name="CommonRequirementsDecorator">
+        <section>
+            <actions>
+                <!-- <set field="leftbarScreenName" value="leftbar"/> -->
+                <!-- <set field="leftbarScreenLocation" value=""/> -->
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section>
+                            <!-- do check for ORDERMGR, _VIEW permission -->
+                            <condition>
+                                <if-has-permission permission="ORDERMGR" action="_VIEW"/>
+                            </condition>
+                            <widgets>
+                                <platform-specific>
+                                    <html><html-template location="component://order/webapp/ordermgr/requirement/RequirementsTabBar.ftl"/></html>
+                                </platform-specific>
+                                <container>
+                                    <link target="EditRequirement" text="${uiLabelMap.OrderNewRequirement}" style="buttontext"/>
+                                </container>
+                                <decorator-section-include name="body"/>
+                            </widgets>
+                            <fail-widgets>
+                                <label style="head3">${uiLabelMap.OrderViewPermissionError}</label>
+                            </fail-widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
     <screen name="FindRequirements">
         <section>
             <actions>
                 <set field="title" value="Find Requirements"/>
                 <set field="titleProperty" value="PageTitleFindRequirements"/>
                 <set field="headerItem" value="requirement"/>
+                <set field="tabButtonItem" value="FindRequirements"/>
                 <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
             </actions>
             <widgets>
-                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                <decorator-screen name="CommonRequirementsDecorator">
                     <decorator-section name="body">
-                        <container>
-                            <label style="head1">${uiLabelMap.OrderRequirements}</label>
-                        </container>
-                        <container>
-                            <link target="EditRequirement" text="${uiLabelMap.OrderNewRequirement}" style="buttontext"/>
-                            <link target="ApproveRequirements" text="${uiLabelMap.OrderApproveRequirements}" style="buttontext"/>
-                        </container>
                         <include-form name="FindRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
                         <include-form name="ListRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
                     </decorator-section>
@@ -82,21 +108,48 @@
                 <set field="title" value="Find Requirements"/>
                 <set field="titleProperty" value="PageTitleFindRequirements"/>
                 <set field="headerItem" value="requirement"/>
+                <set field="tabButtonItem" value="ApproveRequirements"/>
                 <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
             </actions>
             <widgets>
-                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                <decorator-screen name="CommonRequirementsDecorator">
                     <decorator-section name="body">
-                        <container>
-                            <label style="head1">${uiLabelMap.OrderApproveRequirements}</label>
-                        </container>
-                        <container>
-                            <link target="EditRequirement" text="${uiLabelMap.OrderNewRequirement}" style="buttontext"/>
-                            <link target="FindRequirements" text="${uiLabelMap.OrderRequirements}" style="buttontext"/>
-                        </container>
                         <include-form name="FindNotApprovedRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
                         <include-form name="ApproveRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="ApprovedProductRequirements">
+        <section>
+            <actions>
+                <set field="title" value="Approved Product Requirements"/>
+                <set field="titleProperty" value="PageTitleFindRequirements"/>
+                <set field="headerItem" value="requirement"/>
+                <set field="tabButtonItem" value="ApprovedProductRequirements"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonRequirementsDecorator">
+                    <decorator-section name="body">
+                        <include-form name="FindApprovedProductRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
+                        <section>
+                            <condition>
+                                <not><if-empty field-name="parameters.partyId"/></not>
+                            </condition>
+                            <widgets>
+                                <container>
+                                    <label style="head2" text="Requirement List"/>
+                                </container>
+                                <include-form name="ApprovedProductRequirements" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
+                            </widgets>
+                            <fail-widgets>
+                                <include-form name="ApprovedProductRequirementsList" location="component://order/webapp/ordermgr/requirement/RequirementForms.xml"/>
+                            </fail-widgets>
+                        </section>
                     </decorator-section>
                 </decorator-screen>
             </widgets>