You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/01/23 02:14:28 UTC

svn commit: r498882 - in /ofbiz/trunk/applications/workeffort: config/ script/org/ofbiz/workeffort/workeffort/ servicedef/ webapp/workeffort/WEB-INF/ webapp/workeffort/workeffort/ widget/

Author: jonesde
Date: Mon Jan 22 17:14:26 2007
New Revision: 498882

URL: http://svn.apache.org/viewvc?view=rev&rev=498882
Log:
Applied patch from Anil Patel for the WorkEffort deep copy in Jira #OFBIZ-546

Added:
    ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/
    ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl   (with props)
Modified:
    ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/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/WorkEffortScreens.xml

Modified: ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties?view=diff&rev=498882&r1=498881&r2=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties (original)
+++ ofbiz/trunk/applications/workeffort/config/WorkEffortUiLabels.properties Mon Jan 22 17:14:26 2007
@@ -193,6 +193,7 @@
 WorkEffortCreate=Create Work Effort
 WorkEffortRequestItems=Request Items
 WorkEffortDayView=Day View
+WorkEffortDuplicateWorkEffort=Duplicate Work Effort
 WorkEffortEmailAddressIsMissing=Email Address is missing
 WorkEffortEmailAddressNotFormatted=Email Address is not formatted correctly, must be like foo@bar.com
 WorkEffortErrorNotFindActivityId=ERROR\: Could not find activity with ID

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?view=diff&rev=498882&r1=498881&r2=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Mon Jan 22 17:14:26 2007
@@ -1056,4 +1056,88 @@
         </if-not-empty>
         <check-errors/>
     </simple-method>
+
+    <simple-method method-name="duplicateWorkEffort" short-description="Duplicate a WorkEffort" login-required="false">
+        
+        <check-permission permission="WORKEFFORTMGR" action="_CREATE">
+            <fail-property resource="WorkEffortUiLabels" property="WorkEffortCreatePermissionError"/>
+        </check-permission>
+        <check-errors />
+        <check-permission permission="WORKEFFORTMGR" action="_DELETE">
+            <fail-property resource="WorkEffortUiLabels" property="WorkEffortCreatePermissionError"/>
+        </check-permission>
+        <check-errors />
+        <!-- look up the old workEffort and clone it -->
+        <entity-one entity-name="WorkEffort" value-name="oldWorkEffort">
+            <field-map field-name="workEffortId" env-name="parameters.oldWorkEffortId"/>
+        </entity-one>
+        <clone-value value-name="oldWorkEffort" new-value-name="newWorkEffort"/>
+        
+        <!-- set the workEffortId, and write it to the datasource -->
+        <set from-field="parameters.workEffortId" field="newWorkEffort.workEffortId"/>
+        <create-value value-name="newWorkEffort"/>
+        
+        <!-- set up entity filter for workEffortAssoc-->
+        <set field="workEffortAssocFindContext.workEffortIdFrom" from-field="parameters.oldWorkEffortId"/>
+        <set field="reverseWorkEffortFindContext.workEffortIdTo" from-field="parameters.oldProductId"/>
+        <if-not-empty field-name="duplicateWorkEffortAssocs" map-name="parameters">
+            <find-by-and entity-name="WorkEffortAssoc" map-name="workEffortAssocFindContext" list-name="foundValues"/>
+            <iterate entry-name="foundValue" list-name="foundValues">
+                <clone-value value-name="foundValue" new-value-name="newTempValue"/>
+                <set from-field="parameters.workEffortId" field="newTempValue.workEffortIdFrom"/>
+                <create-value value-name="newTempValue"/>
+            </iterate>
+            <entity-and entity-name="WorkEffortAssoc" list-name="foundValues">
+                <field-map field-name="workEffortIdTo" env-name="parameters.oldWorkEffortId"/>
+            </entity-and>
+            <iterate entry-name="foundValue" list-name="foundValues">
+                <clone-value value-name="foundValue" new-value-name="newTempValue"/>
+                <set from-field="parameters.workEffortId" field="newTempValue.workEffortIdTo"/>
+                <create-value value-name="newTempValue"/>                
+            </iterate>
+        </if-not-empty>
+        
+        
+        <!-- set up entity filter -->
+        <set field="workEffortFindContext.workEffortId" from-field="parameters.oldWorkEffortId"/>
+        <if-not-empty field-name="duplicateWorkEffortNotes" map-name="parameters">
+            <find-by-and entity-name="WorkEffortNote" map-name="workEffortFindContext" list-name="foundValues"/>
+            <iterate entry-name="foundValue" list-name="foundValues">
+                <clone-value value-name="foundValue" new-value-name="newTempValue"/>
+                <set from-field="parameters.workEffortId" field="newTempValue.workEffortId"/>
+                <create-value value-name="newTempValue"/>
+            </iterate>
+        </if-not-empty>
+        <if-not-empty field-name="duplicateWorkEffortContents" map-name="parameters">
+            <find-by-and entity-name="WorkEffortContent" map-name="workEffortFindContext" list-name="foundValues"/>
+            <iterate entry-name="foundValue" list-name="foundValues">
+                <clone-value value-name="foundValue" new-value-name="newTempValue"/>
+                <set from-field="parameters.workEffortId" field="newTempValue.workEffortId"/>
+                <create-value value-name="newTempValue"/>
+            </iterate>
+        </if-not-empty>
+        <if-not-empty field-name="duplicateWorkEffortAssignmentRates" map-name="parameters">
+            <find-by-and entity-name="WorkEffortAssignmentRate" map-name="workEffortFindContext" list-name="foundValues"/>
+            <iterate entry-name="foundValue" list-name="foundValues">
+                <clone-value value-name="foundValue" new-value-name="newTempValue"/>
+                <set from-field="parameters.workEffortId" field="newTempValue.workEffortId"/>
+                <create-value value-name="newTempValue"/>
+            </iterate>
+        </if-not-empty>
+
+        <if-not-empty field-name="removeWorkEffortAssocs" map-name="parameters">
+            <remove-by-and entity-name="WorkEffortAssoc" map-name="workEffortAssocFindContext"/>            
+            <!-- small difference here, also do the reverse assocs... -->
+            <remove-by-and entity-name="WorkEffortAssoc" map-name="reverseWorkEffortFindContext"/>
+        </if-not-empty>
+        <if-not-empty field-name="removeWorkEffortContents" map-name="parameters">
+            <remove-by-and entity-name="WorkEffortContent" map-name="workEffortFindContext"/>
+        </if-not-empty>
+        <if-not-empty field-name="removeWorkEffortNotes" map-name="parameters">
+            <remove-by-and entity-name="WorkEffortNote" map-name="workEffortFindContext"/>
+        </if-not-empty>
+        <if-not-empty field-name="removeWorkEffortAssignmentRates" map-name="parameters">
+            <remove-by-and entity-name="WorkEffortAssignmentRate" map-name="workEffortFindContext"/>
+        </if-not-empty>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?view=diff&rev=498882&r1=498881&r2=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Mon Jan 22 17:14:26 2007
@@ -58,6 +58,21 @@
         <description>Delete a WorkEffort Entity</description>
         <auto-attributes mode="IN" include="pk" optional="false"/>        
     </service>
+
+    <service name="duplicateWorkEffort" engine="simple"
+        location="org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml" invoke="duplicateWorkEffort" auth="true">
+        <description>Duplicate a Work Effort using a new workEffortId</description>
+        <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
+        <attribute name="oldWorkEffortId" type="String" mode="IN" optional="false"/>
+        <attribute name="duplicateWorkEffortAssocs" type="String" mode="IN" optional="true"/>
+        <attribute name="duplicateWorkEffortContents" type="String" mode="IN" optional="true"/>
+        <attribute name="duplicateWorkEffortNotes" type="String" mode="IN" optional="true"/>
+        <attribute name="duplicateWorkEffortAssignmentRates" type="String" mode="IN" optional="true"/>                        
+        <attribute name="removeWorkEffortAssocs" type="String" mode="IN" optional="true"/>
+        <attribute name="removeWorkEffortContents" type="String" mode="IN" optional="true"/>
+        <attribute name="removeWorkEffortNotes" type="String" mode="IN" optional="true"/>
+        <attribute name="removeWorkEffortAssignmentRates" type="String" mode="IN" optional="true"/>                        
+    </service>
     
     <!-- Communication Event WorkEffort -->
     <service name="makeCommunicationEventWorkEffort" default-entity-name="CommunicationEventWorkEff" engine="simple"

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?view=diff&rev=498882&r1=498881&r2=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml Mon Jan 22 17:14:26 2007
@@ -562,7 +562,12 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="WorkEffortSearchResults"/>
     </request-map>    
-
+    <request-map uri="DuplicateWorkEffort">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="duplicateWorkEffort"/>
+        <response name="success" type="view" value="EditWorkEffort"/>
+        <response name="error" type="view" value="EditWorkEffort"/>
+    </request-map>
     
     <!-- Lookup request mappings -->
     <request-map uri="LookupWorkEffort"><security https="true" auth="true"/><response name="success" type="view" value="LookupWorkEffort"/></request-map>

Added: ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl?view=auto&rev=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl (added)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl Mon Jan 22 17:14:26 2007
@@ -0,0 +1,41 @@
+<#--
+
+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.
+-->
+        <hr class="sepbar"/>
+        <div class="head2">${uiLabelMap.WorkEffortDuplicateWorkEffort}</div>
+        <form action="<@o...@ofbizUrl>" method="post" style="margin: 0;">
+            <input type="hidden" name="oldWorkEffortId" value="${workEffortId?if_exists}"/>
+            <div>
+                <span class="tabletext">${uiLabelMap.ProductDuplicateRemoveSelectedWithNewId}:</span>
+                <input type="text" class="inputBox" size="20" maxlength="20" name="workEffortId"/>&nbsp;<input type="submit" class="smallSubmit" value="${uiLabelMap.CommonDuplicate}!"/>
+            </div>
+            <div class="tabletext">
+                <b>${uiLabelMap.CommonDuplicate}:</b>
+                ${uiLabelMap.FormFieldTitle_rate}&nbsp;<input type="checkbox" class="checkBox" name="duplicateWorkEffortAssignmentRates" value="Y" checked="checked"/>
+                ${uiLabelMap.WorkEffortAssoc}&nbsp;<input type="checkbox" class="checkBox" name="duplicateWorkEffortAssocs" value="Y" checked="checked"/>
+                ${uiLabelMap.ProductContent}&nbsp;<input type="checkbox" class="checkBox" name="duplicateWorkEffortContents" value="Y" checked="checked"/>
+                ${uiLabelMap.WorkEffortNotes}&nbsp;<input type="checkbox" class="checkBox" name="duplicateWorkEffortNotes" value="Y" checked="checked"/>
+            </div>
+            <div class="tabletext">
+                <b>${uiLabelMap.CommonRemove}:</b>
+                ${uiLabelMap.FormFieldTitle_rate}&nbsp;<input type="checkbox" class="checkBox" name="removeWorkEffortAssignmentRates" value="Y"/>               
+                ${uiLabelMap.WorkEffortAssoc}&nbsp;<input type="checkbox" class="checkBox" name="removeWorkEffortAssocs" value="Y"/>
+                ${uiLabelMap.ProductContent}&nbsp;<input type="checkbox" class="checkBox" name="removeWorkEffortContents" value="Y"/>
+                ${uiLabelMap.WorkEffortNotes}&nbsp;<input type="checkbox" class="checkBox" name="removeWorkEffortNotes" value="Y"/>
+
+            </div>
+        </form>
+        <hr class="sepbar"/>

Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?view=diff&rev=498882&r1=498881&r2=498882
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Mon Jan 22 17:14:26 2007
@@ -78,6 +78,9 @@
                                 <include-form name="EditWorkEffort" location="component://workeffort/widget/WorkEffortForms.xml"/>
                             </fail-widgets>
                         </section>
+                        <platform-specific>
+                            <html><html-template location="component://workeffort/webapp/workeffort/workeffort/EditWorkEffortDupForm.ftl"/></html>
+                        </platform-specific>
                     </decorator-section>
                 </decorator-screen>
             </widgets>