[OFBiz] SVN: r6734 - in trunk/applications/order: . data entitydef script/org/ofbiz/order script/org/ofbiz/order/opportunity servicedef

sichen@svn.ofbiz.org sichen at svn.ofbiz.org
Tue Feb 14 11:32:45 CST 2006


Author: sichen
Date: 2006-02-14 11:32:36 -0600 (Tue, 14 Feb 2006)
New Revision: 6734

Added:
   trunk/applications/order/script/org/ofbiz/order/opportunity/
   trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
   trunk/applications/order/servicedef/services_opportunity.xml
Modified:
   trunk/applications/order/data/OrderSecurityData.xml
   trunk/applications/order/entitydef/entitygroup.xml
   trunk/applications/order/entitydef/entitymodel.xml
   trunk/applications/order/ofbiz-component.xml
Log:
Added SalesForecast entity, a history entity, service definitions, 
initial create/update services, and new securities ORDERMGR_4C_CREATE
and _UPDATE.


Modified: trunk/applications/order/data/OrderSecurityData.xml
===================================================================
--- trunk/applications/order/data/OrderSecurityData.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/data/OrderSecurityData.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -21,6 +21,8 @@
     <SecurityPermission description="Send order confirmation notification." permissionId="ORDERMGR_SEND_CONFIRMATION"/>
     <SecurityPermission description="Quote price manager in the Order Manager." permissionId="ORDERMGR_QUOTE_PRICE"/>
     <SecurityPermission description="Create Customer Requests in the Order Manager." permissionId="ORDERMGR_CRQ_CREATE"/>
+    <SecurityPermission description="Create sales forecasts in the Order Manager." permissionId="ORDERMGR_4C_CREATE"/>
+    <SecurityPermission description="Update sales forecasts in the Order Manager." permissionId="ORDERMGR_4C_UPDATE"/>
     
     <SecurityGroup description="Admin group for restricted order processing." groupId="ORDERPROC"/>
     <SecurityGroup description="Order Entry Admin group; permissions for creating orders." groupId="ORDERENTRY"/>
@@ -77,6 +79,8 @@
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="ORDERMGR_VIEW"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="ORDERMGR_QUOTE_PRICE"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="ORDERMGR_CRQ_CREATE"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="ORDERMGR_4C_CREATE"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="ORDERMGR_4C_UPDATE"/>
 
     <SecurityGroupPermission groupId="VIEWADMIN" permissionId="ORDERMGR_VIEW"/>
     <SecurityGroupPermission groupId="VIEWADMIN" permissionId="ORDERMGR_NOTE"/>

Modified: trunk/applications/order/entitydef/entitygroup.xml
===================================================================
--- trunk/applications/order/entitydef/entitygroup.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/entitydef/entitygroup.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -187,5 +187,7 @@
     <entity-group group="org.ofbiz" entity="SalesOpportunityRole" />
     <entity-group group="org.ofbiz" entity="SalesOpportunityStage" />
     <entity-group group="org.ofbiz" entity="SalesOpportunityWorkEffort" />
+    <entity-group group="org.ofbiz" entity="SalesForecast" />
+    <entity-group group="org.ofbiz" entity="SalesForecastHistory" />
     
 </entitygroup>

Modified: trunk/applications/order/entitydef/entitymodel.xml
===================================================================
--- trunk/applications/order/entitydef/entitymodel.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/entitydef/entitymodel.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -2516,5 +2516,67 @@
             <key-map field-name="workEffortId"/>
         </relation>            
     </entity>
+
+    <entity entity-name="SalesForecast"
+            package-name="org.ofbiz.order.opportunity"
+            title="Stores sales forecast data for sales opportunities.">
+        <field name="salesForecastId" type="id-ne"></field>
+        <field name="internalPartyId" type="id"></field>
+        <field name="customTimePeriodId" type="id"></field>
+        <field name="quotaAmount" type="currency-amount"></field>
+        <field name="forecastAmount" type="currency-amount"></field>
+        <field name="bestCaseAmount" type="currency-amount"></field>
+        <field name="closedAmount" type="currency-amount"/>
+        <field name="percentOfQuotaForecast" type="floating-point"/>
+        <field name="percentOfQuotaClosed" type="floating-point"/>
+        <field name="createdByUserLoginId" type="id-vlong"></field>
+        <field name="modifiedByUserLoginId" type="id-vlong"></field>
+        <prim-key field="salesForecastId"/>
+        <relation type="one" fk-name="SALES4C_INT_PARTY" rel-entity-name="Party">
+            <key-map field-name="internalPartyId" rel-field-name="partyId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4C_TIME_PER" rel-entity-name="CustomTimePeriod">
+            <key-map field-name="customTimePeriodId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4C_CRT_USER" rel-entity-name="UserLogin">
+            <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4C_MOD_USER" rel-entity-name="UserLogin">
+            <key-map field-name="modifiedByUserLogin" rel-field-name="userLoginId"/>
+        </relation>
+    </entity>
+
+    <entity entity-name="SalesForecastHistory"
+            package-name="org.ofbiz.order.opportunity"
+            title="Keeps a record of changes to a sales forecast.">
+        <field name="salesForecastHistoryId" type="id-ne"></field>
+        <field name="salesForecastId" type="id-ne"></field>
+        <field name="internalPartyId" type="id"></field>
+        <field name="customTimePeriodId" type="id"></field>
+        <field name="quotaAmount" type="currency-amount"></field>
+        <field name="forecastAmount" type="currency-amount"></field>
+        <field name="bestCaseAmount" type="currency-amount"></field>
+        <field name="closedAmount" type="currency-amount"/>
+        <field name="percentOfQuotaForecast" type="floating-point"/>
+        <field name="percentOfQuotaClosed" type="floating-point"/>
+        <field name="changeNote" type="very-long">
+            <description>Used to track a reason for this change</description> <!-- maybe one day this should be a link to NoteData -->
+        </field>
+        <field name="modifiedByUserLoginId" type="id-vlong"></field>
+        <field name="modifiedTimestamp" type="date-time"/>
+        <prim-key field="salesForecastHistoryId"/>
+        <relation type="one" fk-name="SALES4CH_SALES4C" rel-entity-name="SalesForecast">
+            <key-map field-name="salesForecastId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4CH_INT_PARTY" rel-entity-name="Party">
+            <key-map field-name="internalPartyId" rel-field-name="partyId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4CH_TIME_PER" rel-entity-name="CustomTimePeriod">
+            <key-map field-name="customTimePeriodId"/>
+        </relation>
+        <relation type="one" fk-name="SALES4CH_MOD_USER" rel-entity-name="UserLogin">
+            <key-map field-name="modifiedByUserLogin" rel-field-name="userLoginId"/>
+        </relation>
+    </entity>
     
 </entitymodel>

Modified: trunk/applications/order/ofbiz-component.xml
===================================================================
--- trunk/applications/order/ofbiz-component.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/ofbiz-component.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -46,6 +46,7 @@
     <service-resource type="model" loader="main" location="servicedef/services_quote.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_requirement.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_return.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services_opportunity.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
     <webapp name="order"
         title="Order"

Added: trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
===================================================================
--- trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *  Copyright (c) 2002-2004 The Open For Business Project - www.ofbiz.org
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included
+ *  in all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * @author    Leon Torres (leon at opensourcestrategies.com)
+-->
+
+<!--
+This file contains basic services for SalesOpportunity and SalesForecast.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="createSalesForecast" short-description="Creates a sales forecast and stores a copy in sales forecast history.">
+
+        <!-- make the value and set the fields from the parameters -->
+        <make-value value-name="salesForecast" entity-name="SalesForecast"/>
+        <sequenced-id-to-env sequence-name="SalesForecast" env-name="salesForecastId"/>
+        <set field="salesForecast.salesForecastId" from-field="salesForecastId"/> 
+        <set-nonpk-fields map-name="parameters" value-name="salesForecast"/>
+        
+        <!-- set the creation info -->
+        <set field="salesForecast.createdByUserLoginId" from-field="userLogin.userLoginId"/>
+        <set field="salesForecast.modifiedByUserLoginId" from-field="userLogin.userLoginId"/>
+
+        <!-- create the value -->
+        <create-value value-name="salesForecast"/>
+
+        <!-- save the value in the history (this method expects a salesForecast map) -->
+        <call-simple-method method-name="saveSalesForecastHistory">
+
+        <!-- return the ID -->
+        <field-to-result result-name="salesForecastId" field-name="salesForecastId"/>
+    </simple-method>
+
+    <simple-method method-name="updateSalesForecast" short-description="Updates a sales forecast and stores a copy in sales forecast history.">
+
+        <!-- get the forecast and save a copy to history -->
+        <entity-one entity-name="SalesForecast" auto-field-map="true" value-name="salesForecast"/>
+        <call-simple-method method-name="saveSalesForecastHistory"/>
+
+        <!-- set the fields from the parameters -->
+        <set-nonpk-fields map-name="parameters" value-name="salesForecast"/>
+        
+        <!-- store the value -->
+        <store-value value-name="salesForecast"/>
+    </simple-method>
+
+    <simple-method method-name="saveSalesForecastHistory" short-description="Given a salesForecast map, saves the data in the history.">
+
+        <!-- make the value and set the fields from the salesForecast map -->
+        <make-value value-name="salesForecastHistory" entity-name="SalesForecastHistory"/>
+        <sequenced-id-to-env sequence-name="SalesForecastHistory" env-name="salesForecastHistoryId"/>
+        <set field="salesForecastHistory.salesForecastHistoryId" from-field="salesForecastHistoryId"/> 
+        <set-nonpk-fields value-name="salesForecastHistory" map-name="salesForecast"/>
+
+        <!-- get the change note from the parameters -->
+        <set field="salesForecastHsitory.changeNote" from-field="parameters.changeNote"/>
+
+        <!-- set the modified info -->
+        <now-timestamp-to-env env-name="nowTimestamp"/>
+        <set field="salesForecastHistory.modifiedTimestamp" from-field="nowTimestamp"/>
+        <set field="salesForecast.modifiedByUserLoginId" from-field="userLogin.userLoginId"/>
+
+        <!-- create the value -->
+        <create-value value-name="salesForecastHistory"/>
+    </simple-method>
+
+</simple-methods>

Added: trunk/applications/order/servicedef/services_opportunity.xml
===================================================================
--- trunk/applications/order/servicedef/services_opportunity.xml	2006-02-14 15:24:58 UTC (rev 6733)
+++ trunk/applications/order/servicedef/services_opportunity.xml	2006-02-14 17:32:36 UTC (rev 6734)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *  Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included
+ *  in all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *  @author Leon Torres (leon at opensourcestrategies.com)
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">
+    <description>Order Opportunity Services</description>
+    <vendor>OFBiz</vendor>
+
+    <service name="createSalesForecast" engine="simple" auth="true" default-entity-name="SalesForecast"
+            location="org/ofbiz/order/opportunity/OpportunityServices.xml" invoke="createSalesForecast">
+       <description>Creates a Sales Forecast for the userLogin. Requires ORDERMGR_4C_CREATE permission. 
+            This will save the forecast into the history as well. Note that this service does not compute 
+            the forecast. That must be done in a higher level service.</description>
+        <required-permissions join-type="AND">
+            <check-permission permission="ORDERMGR" action="_4C_CREATE"/>
+        </required-permissions>
+        <auto-attributes mode="OUT" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+    </service>
+
+    <service name="updateSalesForecast" engine="simple" auth="true" default-entity-name="SalesForecast"
+            location="org/ofbiz/order/opportunity/OpportunityServices.xml" invoke="updateSalesForecast">
+       <description>Updates a Sales Forecast and marks it as modified by the userLogin. Requires ORDERMGR_4C_UPDATE
+            permission. This will save the current forecast into the history before overwritting it.
+            Note that this service does not compute the forecast. That must be done in a higher level service.</description>
+        <required-permissions join-type="AND">
+            <check-permission permission="ORDERMGR" action="_4C_UPDATE"/>
+        </required-permissions>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+    </service>
+
+</services>



More information about the Svn mailing list