Author: hansbak
Date: Mon Dec 17 21:52:24 2007 New Revision: 605098 URL: http://svn.apache.org/viewvc?rev=605098&view=rev Log: add the copy project function Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties (original) +++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties Mon Dec 17 21:52:24 2007 @@ -64,6 +64,7 @@ ProjectMgrSchedule=Schedule ProjectMgrCompanyName=Ofbiz Company ProjectMgrCompanySubtitle=Project +ProjectMgrCopyProject=Copy Project ProjectMgrDependencies=Dependencies ProjectMgrEditPatySkill=Edit PatySkill ProjectMgrEditPoject=Edit Project Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml Mon Dec 17 21:52:24 2007 @@ -37,7 +37,7 @@ <WorkEffort workEffortId="9005" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:50.84" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task3" estimatedStartDate="2007-12-16 00:00:00.0" estimatedCompletionDate="2007-12-17 00:00:00.0" revisionNumber="1"/> <WorkEffortSkillStandard workEffortId="9005" skillTypeId="9000" estimatedDuration="32.0"/> <WorkEffort workEffortId="9006" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:58.857" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task4" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-20 00:00:00.0" revisionNumber="1"/> - <WorkEffortSkillStandard workEffortId="9002" skillTypeId="9000" estimatedDuration="40.0"/> + <WorkEffortSkillStandard workEffortId="9006" skillTypeId="9000" estimatedDuration="40.0"/> <!-- task dependencies --> <WorkEffortAssoc workEffortIdFrom="9002" workEffortIdTo="9003" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/> Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Mon Dec 17 21:52:24 2007 @@ -211,6 +211,62 @@ <field-to-result field-name="project.workEffortName" result-name="projectName"/> </simple-method> + <simple-method method-name="copyProject" short-description="copy a project with related phases and tasks however no actual data"> + <entity-one entity-name="WorkEffort" value-name="project"> + <field-map field-name="workEffortId" env-name="parameters.projectId"/> + </entity-one> + + <if-empty field-name="project"> + <field-to-result map-name="parameters" field-name="projectId"/> + <add-error error-list-name="error_list"><fail-message message="Project: ${parameters.projectId} not found"/></add-error> + </if-empty> + + <set field="newProject.workEffortName" from-field="project.workEffortName"/> + <set field="newProject.workEffortTypeId" from-field="project.workEffortTypeId"/> + <set field="newProject.currentStatusId" value="CAL_ACCEPTED"/> + <call-service service-name="createWorkEffort" in-map-name="newProject"> + <result-to-field result-name="workEffortId" field-name="newProjectId"/> + </call-service> + + <!-- copy assigned parties --> + <get-related value-name="project" relation-name="WorkEffortPartyAssignment" list-name="parties"/> + <iterate entry-name="party" list-name="parties"> + <set field="pa.workEffortId" from-field="newProjectId"/> + <set field="pa.partyId" from-field="party.partyId"/> + <set field="pa.roleTypeId" from-field="party.roleTypeId"/> + <set field="pa.statusId" value="CAL_ACCEPTED"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="pa"/> + </iterate> + + <get-related value-name="project" relation-name="ChildWorkEffort" list-name="phases"/> + <if-not-empty field-name="phases"> + <iterate entry-name="phase" list-name="phases"> + <clear-field field-name="newPhase"/> + <set field="newPhase.workEffortName" from-field="phase.workEffortName"/> + <set field="newPhase.workEffortTypeId" from-field="phase.workEffortTypeId"/> + <set field="newPhase.workEffortParentId" from-field="newProjectId"/> + <set field="newPhase.currentStatusId" value="CAL_ACCEPTED"/> + <call-service service-name="createWorkEffort" in-map-name="newPhase"> + <result-to-field result-name="workEffortId" field-name="newPhaseId"/> + </call-service> + + <get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks"/> + <if-not-empty field-name="tasks"> + <iterate entry-name="task" list-name="tasks"> + <clear-field field-name="newTask"/> + <set field="newTask.workEffortName" from-field="task.workEffortName"/> + <set field="newTask.workEffortTypeId" from-field="task.workEffortTypeId"/> + <set field="newTask.priority" from-field="task.priority"/> + <set field="newTask.workEffortParentId" from-field="newPhaseId"/> + <set field="newTask.currentStatusId" value="CAL_ACCEPTED"/> + <call-service service-name="createWorkEffort" in-map-name="newTask"/> + </iterate> + </if-not-empty> + </iterate> + </if-not-empty> + <field-to-result field-name="newProjectId" result-name="projectId"/> + </simple-method> + <simple-method method-name="getProject" short-description="get Project information" login-required="true"> <if-empty field-name="parameters.projectId"> <return/> Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Mon Dec 17 21:52:24 2007 @@ -42,6 +42,12 @@ <attribute name="projectId" type="String" mode="INOUT" optional="true"/> <attribute name="projectInfo" type="java.util.Map" mode="OUT" optional="true"/> </service> + + <service name="copyProject" engine="simple" + location="org/ofbiz/project/ProjectServices.xml" invoke="copyProject"> + <description>Copy a project planning data but ignore the actual data.</description> + <attribute name="projectId" type="String" mode="INOUT" optional="false"/> + </service> <service name="scheduleProject" engine="simple" location="org/ofbiz/project/ProjectServices.xml" invoke="scheduleProject"> Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Mon Dec 17 21:52:24 2007 @@ -67,6 +67,12 @@ <response name="success" type="view" value="EditProject"/> <response name="error" type="view" value="EditProject"/> </request-map> + <request-map uri="copyProject"> + <security https="true" auth="true"/> + <event type="service" invoke="copyProject"/> + <response name="success" type="view" value="projectView"/> + <response name="error" type="view" value="projectView"/> + </request-map> <request-map uri="deleteProject"> <security https="true" auth="true"/> <event type="service" invoke="deleteWorkEffort"/> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=605098&r1=605097&r2=605098&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Mon Dec 17 21:52:24 2007 @@ -69,6 +69,14 @@ </condition> <link target="EditProject"></link> </menu-item> + <menu-item name="copyProject" title="${uiLabelMap.ProjectMgrCopyProject}"> + <condition> + <not> + <if-empty field-name="project"/> + </not> + </condition> + <link target="copyProject?projectId=${projectId}"></link> + </menu-item> <menu-item name="schedule" title="${uiLabelMap.ProjectMgrSchedule}"> <condition> <not> |
Free forum by Nabble | Edit this page |