[OFBiz] SVN: r6023 - in trunk/applications/order: webapp/ordermgr/WEB-INF/actions/request webapp/ordermgr/request widget/ordermgr

jacopo at svn.ofbiz.org jacopo at svn.ofbiz.org
Tue Oct 25 05:19:43 EDT 2005


Author: jacopo
Date: 2005-10-25 04:19:28 -0500 (Tue, 25 Oct 2005)
New Revision: 6023

Added:
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh
Modified:
   trunk/applications/order/webapp/ordermgr/request/RequestForms.xml
   trunk/applications/order/widget/ordermgr/RequestScreens.xml
Log:
Implemented automatic increment of sequenceNum in requests.

Added: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh	2005-10-25 08:20:35 UTC (rev 6022)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh	2005-10-25 09:19:28 UTC (rev 6023)
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (c) 2003 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     Jacopo Cappellato (tiz at sastau.it)
+ *@version    $Rev$
+ */
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.GenericValue;
+
+long nextSequenceNum = 10;
+if (custRequestItem == null && custRequest != null) {
+    List items = custRequest.getRelated("CustRequestItem", UtilMisc.toList("-sequenceNum"));
+    GenericValue lastItem = EntityUtil.getFirst(items);
+    if (lastItem != null && lastItem.get("sequenceNum") != null) {
+        lastSequenceNum = lastItem.getLong("sequenceNum");
+        nextSequenceNum = lastSequenceNum + 10;
+    }
+}	
+context.put("nextSequenceNum", nextSequenceNum);


Property changes on: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native

Modified: trunk/applications/order/webapp/ordermgr/request/RequestForms.xml
===================================================================
--- trunk/applications/order/webapp/ordermgr/request/RequestForms.xml	2005-10-25 08:20:35 UTC (rev 6022)
+++ trunk/applications/order/webapp/ordermgr/request/RequestForms.xml	2005-10-25 09:19:28 UTC (rev 6023)
@@ -222,6 +222,8 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field use-when="custRequestItem==null" name="sequenceNum" entry-name="nextSequenceNum"><text/></field>
+        <field use-when="custRequestItem!=null" name="sequenceNum"><text/></field>
         <field name="priority" widget-style="selectBox">
             <drop-down allow-empty="false">
                 <option key="9"/>

Modified: trunk/applications/order/widget/ordermgr/RequestScreens.xml
===================================================================
--- trunk/applications/order/widget/ordermgr/RequestScreens.xml	2005-10-25 08:20:35 UTC (rev 6022)
+++ trunk/applications/order/widget/ordermgr/RequestScreens.xml	2005-10-25 09:19:28 UTC (rev 6023)
@@ -201,6 +201,7 @@
                 <entity-one entity-name="CustRequestItem" value-name="custRequestItem"/>
                 <set field="statusId" from-field="custRequestItem.statusId"/>
                 <entity-one entity-name="StatusItem" value-name="currentStatus"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/request/getNextSequenceNum.bsh"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonRequestDecorator">



More information about the Svn mailing list