[OFBiz] SVN: r6877 - in trunk/applications/product: . script/org/ofbiz/product script/org/ofbiz/product/cost servicedef webapp/catalog/WEB-INF webapp/catalog/product widget/catalog

jacopo@svn.ofbiz.org jacopo at svn.ofbiz.org
Wed Mar 1 15:02:27 CST 2006


Author: jacopo
Date: 2006-03-01 15:02:03 -0600 (Wed, 01 Mar 2006)
New Revision: 6877

Added:
   trunk/applications/product/script/org/ofbiz/product/cost/
   trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
   trunk/applications/product/servicedef/services_cost.xml
Modified:
   trunk/applications/product/ofbiz-component.xml
   trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
   trunk/applications/product/webapp/catalog/product/ProductForms.xml
   trunk/applications/product/widget/catalog/ProductScreens.xml
Log:
Implemented services and ui to manage CostComponents.


Modified: trunk/applications/product/ofbiz-component.xml
===================================================================
--- trunk/applications/product/ofbiz-component.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/ofbiz-component.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -51,6 +51,7 @@
     <service-resource type="model" loader="main" location="servicedef/services_shipment.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_store.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_view.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services_cost.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas_shipment.xml"/>
     <service-resource type="group" loader="main" location="servicedef/groups_shipment.xml"/>

Added: trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
===================================================================
--- trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+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.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
+    <!-- CostComponent services -->
+    <simple-method method-name="createCostComponent" short-description="Create a CostComponent">
+        <make-value value-name="newEntity" entity-name="CostComponent"/>
+        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <sequenced-id-to-env sequence-name="CostComponent" env-name="newEntity.costComponentId"/>
+        <field-to-result field-name="costComponentId" map-name="newEntity"/>
+        <if-empty field-name="newEntity.fromDate">
+            <now-timestamp-to-env env-name="newEntity.fromDate"/>
+        </if-empty>
+        <create-value value-name="newEntity"/>
+    </simple-method>
+    <simple-method method-name="updateCostComponent" short-description="Update a CostComponent">
+        <entity-one entity-name="CostComponent" value-name="costComponent"/>
+        <set-nonpk-fields map-name="parameters" value-name="costComponent"/>
+        <store-value value-name="costComponent"/>
+    </simple-method>
+    <simple-method method-name="deleteCostComponent" short-description="Delete a CostComponent">
+        <entity-one entity-name="CostComponent" value-name="costComponent"/>
+        <remove-value value-name="costComponent"/>
+    </simple-method>
+</simple-methods>


Property changes on: trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native

Added: trunk/applications/product/servicedef/services_cost.xml
===================================================================
--- trunk/applications/product/servicedef/services_cost.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/servicedef/services_cost.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">
+    <description>Product Costing Services</description>
+    <vendor>OFBiz</vendor>
+    <version>1.0</version>
+
+    <service name="createCostComponent" default-entity-name="CostComponent" engine="simple"
+                location="org/ofbiz/product/cost/CostServices.xml" invoke="createCostComponent" auth="true">
+        <description>Create a CostComponent</description>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+        <!--<override name="costComponentTypeId" optional="false"/>-->
+    </service>
+    <service name="updateCostComponent" default-entity-name="CostComponent" engine="simple"
+                location="org/ofbiz/product/cost/CostServices.xml" invoke="updateCostComponent" auth="true">
+        <description>Update a CostComponent</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="deleteCostComponent" default-entity-name="CostComponent" engine="simple"
+                location="org/ofbiz/product/cost/CostServices.xml" invoke="deleteCostComponent" auth="true">
+        <description>Delete a CostComponent</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+</services>


Property changes on: trunk/applications/product/servicedef/services_cost.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native

Modified: trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
===================================================================
--- trunk/applications/product/webapp/catalog/WEB-INF/controller.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/webapp/catalog/WEB-INF/controller.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -765,6 +765,24 @@
 
     <!-- ================ Product Costs Requests ================= -->
     <request-map uri="EditProductCosts"><security https="true" auth="true"/><response name="success" type="view" value="EditProductCosts"/></request-map>
+    <request-map uri="createCostComponent">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createCostComponent"/>
+        <response name="success" type="view" value="EditProductCosts"/>
+        <response name="error" type="view" value="EditProductCosts"/>
+    </request-map>
+    <request-map uri="updateCostComponent">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateCostComponent"/>
+        <response name="success" type="view" value="EditProductCosts"/>
+        <response name="error" type="view" value="EditProductCosts"/>
+    </request-map>
+    <request-map uri="deleteCostComponent">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="deleteCostComponent"/>
+        <response name="success" type="view" value="EditProductCosts"/>
+        <response name="error" type="view" value="EditProductCosts"/>
+    </request-map>
     <request-map uri="calculateProductCosts">
         <security https="true" auth="true"/>
         <event type="service" invoke="calculateProductCosts"/>

Modified: trunk/applications/product/webapp/catalog/product/ProductForms.xml
===================================================================
--- trunk/applications/product/webapp/catalog/product/ProductForms.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/webapp/catalog/product/ProductForms.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -918,11 +918,43 @@
             title="" list-name="costs" paginate-target="EditProductCosts"
             default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext">
         <auto-fields-entity entity-name="CostComponent" default-field-type="display"/>
+        <field name="costComponentId" widget-style="buttontext">
+            <hyperlink also-hidden="false" description="${costComponentId}" target="EditProductCosts?productId=${productId}&amp;productCostComponentId=${costComponentId}"/>
+        </field>
         <field name="productId"><hidden value="${productId}"/></field>
         <field name="costComponentTypeId" widget-style="tabletext">
             <display-entity entity-name="CostComponentType"/>
         </field>
+        <field name="deleteCostComponent" entry-name="costComponentId" widget-style="buttontext">
+            <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteCostComponent?productId=${productId}&amp;costComponentId=${costComponentId}"/>
+        </field>
     </form>
+    <form name="EditCostComponent" type="single"
+            target="createCostComponent" title="" default-map-name="costComponent"
+            default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+        <alt-target use-when="costComponent!=null" target="updateCostComponent"/>
+        <auto-fields-service service-name="createCostComponent"/>
+        <field name="productId"><hidden/></field>
+        <field name="costComponentId" use-when="costComponent!=null"><display/></field>
+        <field name="costComponentId" use-when="costComponent==null"><hidden/></field>
+        <field name="costComponentTypeId" widget-style="selectBox">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="CostComponentType" description="${description}">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="costUomId" title="${uiLabelMap.CommonCurrencyUomId}" widget-style="selectBox">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="Uom" key-field-name="uomId" description="${description} [${uomId}]">
+                    <entity-constraint name="uomTypeId" value="CURRENCY_MEASURE"/>
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+
     <form name="CalculateProductCosts" type="single"
             target="calculateProductCosts" title="" 
             default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">

Modified: trunk/applications/product/widget/catalog/ProductScreens.xml
===================================================================
--- trunk/applications/product/widget/catalog/ProductScreens.xml	2006-03-01 17:06:30 UTC (rev 6876)
+++ trunk/applications/product/widget/catalog/ProductScreens.xml	2006-03-01 21:02:03 UTC (rev 6877)
@@ -252,9 +252,14 @@
                 <set field="labelTitleProperty" value="ProductCosts"/>
     
                 <set field="productId" from-field="parameters.productId"/>
+                <set field="productCostComponentId" from-field="parameters.productCostComponentId"/>
                 
                 <entity-one entity-name="Product" value-name="product"/>
-                <entity-and entity-name="CostComponent" list-name="costs" filter-by-date="true">
+                <entity-one entity-name="CostComponent" value-name="costComponent" auto-field-map="false">
+                    <field-map field-name="costComponentId" env-name="productCostComponentId"/>
+                </entity-one>
+                <!--<entity-and entity-name="CostComponent" list-name="costs" filter-by-date="true">-->
+                <entity-and entity-name="CostComponent" list-name="costs">
                     <field-map field-name="productId"/>
                     <order-by field-name="-fromDate"/>
                 </entity-and>
@@ -264,6 +269,9 @@
                     <decorator-section name="body">
                         <container><label style="head2">${uiLabelMap.ProductCosts}</label></container>    
                         <include-form name="ListCostComponents" location="component://product/webapp/catalog/product/ProductForms.xml"/>
+                        <container><label style="head2">${uiLabelMap.ProductEditCostComponent}</label></container>
+                        <include-form name="EditCostComponent" location="component://product/webapp/catalog/product/ProductForms.xml"/>
+                        <container><label style="head2">${uiLabelMap.ProductAutoCreateCosts}</label></container>
                         <include-form name="CalculateProductCosts" location="component://product/webapp/catalog/product/ProductForms.xml"/>
                     </decorator-section>
                 </decorator-screen>



More information about the Svn mailing list