svn commit: r1761233 - in /ofbiz/trunk/applications/workeffort: config/ minilang/workeffort/ servicedef/ template/workeffort/ webapp/workeffort/WEB-INF/ widget/

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

svn commit: r1761233 - in /ofbiz/trunk/applications/workeffort: config/ minilang/workeffort/ servicedef/ template/workeffort/ webapp/workeffort/WEB-INF/ widget/

nmalin
Author: nmalin
Date: Sat Sep 17 13:34:47 2016
New Revision: 1761233

URL: http://svn.apache.org/viewvc?rev=1761233&view=rev
Log:
Implemented : Enable the status selection for WorkEffort duplication
(OFBIZ-7959)

When duplicate a workEffort, if a status is given, initialize on this or check the first status sequence on the same statusType from the duplicate workEffort
Convert the ftl form EditWorkEffortDupForm to sreen engine form EditWorkEffortDuplicate

Thanks : Montalbano Florian for the contribution.

Removed:
    ofbiz/trunk/applications/workeffort/template/workeffort/EditWorkEffortDupForm.ftl
Modified:
    ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.xml
    ofbiz/trunk/applications/workeffort/minilang/workeffort/WorkEffortSimpleServices.xml
    ofbiz/trunk/applications/workeffort/servicedef/services.xml
    ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
    ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
    ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml

Modified: ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.xml (original)
+++ ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.xml Sat Sep 17 13:34:47 2016
@@ -341,6 +341,10 @@
         <value xml:lang="zh">必须回复</value>
         <value xml:lang="zh-TW">必須回複</value>
     </property>
+    <property key="FormFieldTitle_newWorkEffortId">
+        <value xml:lang="en">New WorkEffort Id</value>
+        <value xml:lang="fr">Nvlle réf de tâche</value>
+    </property>
     <property key="FormFieldTitle_orderTypeDescription">
         <value xml:lang="en">Order Type Description</value>
         <value xml:lang="fr">Description de type de commande</value>

Modified: ofbiz/trunk/applications/workeffort/minilang/workeffort/WorkEffortSimpleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/minilang/workeffort/WorkEffortSimpleServices.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/minilang/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/minilang/workeffort/WorkEffortSimpleServices.xml Sat Sep 17 13:34:47 2016
@@ -1290,13 +1290,32 @@ under the License.
                 <check-errors />
             </then>
         </if>
-        <set field="workEffortId" from-field="parameters.workEffortId" />
+
+        <!-- Get the old WorkEffort -->
+        <set field="workEffortId" from-field="parameters.workEffortId"/>
         <if-empty field="workEffortId">
-            <sequenced-id sequence-name="WorkEffort" field="workEffortId" />
+            <sequenced-id sequence-name="WorkEffort" field="workEffortId"/>
         </if-empty>
         <entity-one entity-name="WorkEffort" value-field="oldWorkEffort">
-            <field-map field-name="workEffortId" from-field="parameters.oldWorkEffortId" />
+            <field-map field-name="workEffortId" from-field="parameters.oldWorkEffortId"/>
         </entity-one>
+
+        <!-- Check the status to give to the new WorkEffort -->
+        <if-empty field="parameters.statusId">
+            <entity-one entity-name="StatusItem" value-field="oldStatus">
+                <field-map field-name="statusId" from-field="oldWorkEffort.currentStatusId"/>
+            </entity-one>
+            <entity-and entity-name="StatusItem" list="statusList">
+                <field-map field-name="statusTypeId" from-field="oldStatus.statusTypeId"/>
+                <order-by field-name="sequenceId"/>
+            </entity-and>
+            <set field="oldWorkEffort.currentStatusId" from-field="statusList[0].statusId"/>
+            <else>
+                <set field="oldWorkEffort.currentStatusId" from-field="parameters.statusId"/>
+            </else>
+        </if-empty>
+
+        <!-- Create the new WorkEffort from the old one and the status -->
         <set-service-fields service-name="createWorkEffort" to-map="createWorkEffortCtx" map="oldWorkEffort"/>
         <set field="createWorkEffortCtx.workEffortId" from-field="workEffortId"/>
         <set field="createWorkEffortCtx.userLogin" from-field="parameters.userLogin"/>

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Sat Sep 17 13:34:47 2016
@@ -116,7 +116,9 @@ under the License.
 
     <service name="duplicateWorkEffort" engine="simple"
         location="component://workeffort/minilang/workeffort/WorkEffortSimpleServices.xml" invoke="duplicateWorkEffort" auth="true">
-        <description>Duplicate a Work Effort. If workEffortId is empty a new workEffortId will be generated.</description>
+        <description>Duplicate a Work Effort. If workEffortId is empty a new workEffortId will be generated.
+            Set the statusId of the new WorkEffort to this status, otherwise, set the status to the first of the
+            sequenceId of the statusTypeId</description>
         <permission-service service-name="workEffortGenericPermission" main-action="CREATE"/>
         <attribute name="workEffortId" type="String" mode="IN" optional="true"/>
         <attribute name="oldWorkEffortId" type="String" mode="IN" optional="false"/>
@@ -129,6 +131,7 @@ under the License.
         <attribute name="removeWorkEffortNotes" type="String" mode="IN" optional="true"/>
         <attribute name="removeWorkEffortAssignmentRates" type="String" mode="IN" optional="true"/>
         <attribute name="workEffortId" type="String" mode="OUT" optional="false"/>
+        <attribute name="statusId" type="String" mode="IN" optional="true"/>
     </service>
 
     <!-- Communication Event WorkEffort -->

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml Sat Sep 17 13:34:47 2016
@@ -612,7 +612,7 @@ under the License.
     </request-map>
     <request-map uri="DuplicateWorkEffort">
         <security https="true" auth="true"/>
-        <event type="service" path="" invoke="duplicateWorkEffort"/>
+        <event type="service" invoke="duplicateWorkEffort"/>
         <response name="success" type="view" value="EditWorkEffort"/>
         <response name="error" type="view" value="EditWorkEffort"/>
     </request-map>

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml Sat Sep 17 13:34:47 2016
@@ -1493,4 +1493,42 @@ under the License.
         <field name="deleteLink"><ignored/></field>
     </form>
 
+    <form name="EditWorkEffortDuplicate" target="DuplicateWorkEffort">
+        <actions>
+            <!-- Retrieving the list of the status available for this type of WorkEffort -->
+            <!-- This list is used for the duplication -->
+            <entity-one entity-name="StatusItem" value-field="workEffortStatus">
+                <field-map field-name="statusId" from-field="workEffort.currentStatusId"/>
+            </entity-one>
+        </actions>
+
+        <field name="oldWorkEffortId" entry-name="workEffortId"><hidden/></field>
+        <field name="newWorkEffortId" parameter-name="workEffortId"><text size="20" maxlength="20"/></field>
+        <field name="statusId">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="StatusItem" key-field-name="statusId">
+                    <entity-constraint name="statusTypeId" value="${workEffortStatus.statusTypeId}"/>
+                    <entity-order-by field-name="sequenceId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+
+        <field name="duplicateTitle" title="${uiLabelMap.CommonDuplicate}" position="1" map-name="dummy">
+            <display description=""/>
+        </field>
+        <field name="duplicateWorkEffortAssignmentRates" title="${uiLabelMap.FormFieldTitle_rate}" position="2"><check all-checked="true"/></field>
+        <field name="duplicateWorkEffortAssocs" title="${uiLabelMap.WorkEffortAssoc}" position="3"><check all-checked="true"/></field>
+        <field name="duplicateWorkEffortContents" title="${uiLabelMap.ProductContent}" position="4"><check all-checked="true"/></field>
+        <field name="duplicateWorkEffortNotes" title="${uiLabelMap.WorkEffortNotes}" position="5"><check all-checked="true"/></field>
+
+        <field name="removeTitle" title="${uiLabelMap.CommonRemove}" position="1" map-name="dummy">
+            <display description=""/>
+        </field>
+        <field name="removeWorkEffortAssignmentRates" title="${uiLabelMap.FormFieldTitle_rate}" separate-column="false" position="2"><check all-checked="false"/></field>
+        <field name="removeWorkEffortAssocs" title="${uiLabelMap.WorkEffortAssoc}" position="3" separate-column="false"><check all-checked="false"/></field>
+        <field name="removeWorkEffortContents" title="${uiLabelMap.ProductContent}" position="4" separate-column="false"><check all-checked="false"/></field>
+        <field name="removeWorkEffortNotes" title="${uiLabelMap.WorkEffortNotes}" position="5" separate-column="false"><check all-checked="false"/></field>
+
+        <field name="submitButton" title="${uiLabelMap.CommonDuplicate}!" widget-style="smallSubmit"><submit /></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?rev=1761233&r1=1761232&r2=1761233&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Sat Sep 17 13:34:47 2016
@@ -121,9 +121,7 @@ under the License.
                             </fail-widgets>
                         </section>
                         <screenlet title="${uiLabelMap.WorkEffortDuplicateWorkEffort}">
-                            <platform-specific>
-                                <html><html-template location="component://workeffort/template/workeffort/EditWorkEffortDupForm.ftl"/></html>
-                            </platform-specific>
+                            <include-form name="EditWorkEffortDuplicate" location="component://workeffort/widget/WorkEffortForms.xml"/>
                         </screenlet>
                     </decorator-section>
                 </decorator-screen>