svn commit: r698803 - in /ofbiz/trunk: applications/order/script/org/ofbiz/order/request/ specialpurpose/mypage/widget/ specialpurpose/projectmgr/config/ specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/ specialpurpose/projectmgr/widget/

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

svn commit: r698803 - in /ofbiz/trunk: applications/order/script/org/ofbiz/order/request/ specialpurpose/mypage/widget/ specialpurpose/projectmgr/config/ specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/ specialpurpose/projectmgr/widget/

hansbak-2
Author: hansbak
Date: Wed Sep 24 20:05:45 2008
New Revision: 698803

URL: http://svn.apache.org/viewvc?rev=698803&view=rev
Log:
add the possibility to cancel a customer request. if workefforts are connected with no time recorded cancel these too

Modified:
    ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
    ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml
    ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/RequestScreens.xml

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml Wed Sep 24 20:05:45 2008
@@ -130,10 +130,51 @@
         <entity-one entity-name="CustRequest" value-name="custRequest"/>    
         <field-to-result field-name="custRequest.statusId" result-name="oldStatusId"/>          
         <if-compare-field field="custRequest.statusId" to-field="parameters.statusId" operator="not-equals">
+            <if-compare field="parameters.statusId" value="CRQ_CANCELLED" operator="equals">
+                <!-- check for related workefforts ...and when no time recorded cancel these too -->
+                <get-related value-name="custRequest" relation-name="CustRequestWorkEffort" list-name="workEfforts"/>
+                <if-not-empty field="workEfforts">
+                    <iterate entry-name="workEffort" list-name="workEfforts">
+                        <entity-one entity-name="WorkEffort" value-name="lowInfo">
+                            <field-map field-name="workEffortId" env-name="workEffort.workEffortId"/>
+                        </entity-one>
+                        <call-simple-method method-name="getHours" xml-resource="component://projectmgr/script/org/ofbiz/project/ProjectServices.xml"/>
+                        <set field="actualHours" from-field="highInfo.actualHours"/>
+                        <!-- no hours recorded yet so custrequest can be cancelled -->
+                        <if-empty field="actualHours">
+                            <!-- changed status-->
+                            <set field="custRequest.statusId" from-field="parameters.statusId"/>
+                            <set field="updTask.workEffortId" from-field="workEffort.workEffortId"/>
+                            <set field="updTask.currentStatusId" value="PTS_CANCELLED"/>
+                            <if-has-permission permission="MYPAGE_CUSTOMER">
+                                <entity-one entity-name="UserLogin" value-name="userLogin" auto-field-map="false">
+                                    <field-map field-name="userLoginId" value="system"/>
+                                </entity-one>
+                                <set field="updTask.userLogin" from-field="userLogin"/>
+                                <else>
+                                    <set field="updTask.userLogin" from-field="userLogin"/>
+                                </else>
+                            </if-has-permission>
+                            <call-service service-name="updateWorkEffort" in-map-name="updTask"/>
+                            <else>
+                                <set field="parameters.statusId" from-field="custRequest.statusId"/>
+                                <property-to-field resource="ProjectMgrUiLabels" property="cannotCancelledRequest" field-name="errorMessage"/>
+                                <field-to-result field-name="errorMessage"/>
+                                <set field="isShowEvent" value="N"/>
+                            </else>
+                        </if-empty>
+                    </iterate>
+                </if-not-empty>
+                <else>
+                    <set field="custRequest.statusId" from-field="parameters.statusId"/>
+                </else>
+            </if-compare>
             <!-- save the changed status in the history -->
-            <set field="custRequest.statusId" from-field="parameters.statusId"/>
             <set-service-fields to-map-name="statusMap" service-name="createCustRequestStatus" map-name="custRequest"/>
             <call-service service-name="createCustRequestStatus" in-map-name="statusMap"/>
+            <if-not-empty field="isShowEvent">
+                <clear-field field-name="successMessage"/>
+            </if-not-empty>
         </if-compare-field>
         <now-timestamp-to-env env-name="nowTimestamp"/>
         <set from-field="nowTimestamp" field="custRequest.lastModifiedDate"/>

Modified: ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml Wed Sep 24 20:05:45 2008
@@ -478,6 +478,7 @@
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
+                        <include-menu name="RequestSubTabBar" location="component://mypage/widget/MyPageMenus.xml"/>
                       <decorator-section-include name="body"/>
                     </decorator-section>
                 </decorator-screen>

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml Wed Sep 24 20:05:45 2008
@@ -193,5 +193,9 @@
             <link target="RemoveCommunicationEventRole?communicationEventId=${parameters.communicationEventId}&amp;roleTypeId=${communicationEventRole.roleTypeId}&amp;partyId=${userLogin.partyId}&amp;deleteCommEventIfLast=Y&amp;delContentDataResource=Y"/>
         </menu-item>
     </menu>
-    
+    <menu name="RequestSubTabBar" type="simple" menu-container-style="button-bar button-style-2">
+        <menu-item name="cancelledRequest" title="Cancel request" >
+            <link target="setCustRequestStatus?custRequestId=${custRequestId}&amp;statusId=CRQ_CANCELLED"/>
+        </menu-item>
+    </menu>
 </menus>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml Wed Sep 24 20:05:45 2008
@@ -1283,4 +1283,7 @@
         <value xml:lang="fr">Heures non facturées</value>
         <value xml:lang="zh">没记账工时</value>
     </property>
+    <property key="cannotCancelledRequest">
+        <value xml:lang="en">Can not cancel request, the request is already being implemented.</value>
+    </property>
 </resource>

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=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Wed Sep 24 20:05:45 2008
@@ -571,6 +571,12 @@
         <response name="success" type="request-redirect-noparam" value="requestlist"/>
         <response name="error" type="view" value="EditRequest"/>
     </request-map>
+    <request-map uri="setCustRequestStatus">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateCustRequest"/>
+        <response name="success" type="request-redirect-noparam" value="requestlist"/>
+        <response name="error" type="view" value="EditRequest"/>
+    </request-map>
     <request-map uri="viewprofile">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="viewprofile"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml Wed Sep 24 20:05:45 2008
@@ -401,6 +401,7 @@
                         <section>
                             <widgets>
                                 <include-menu location="component://projectmgr/widget/Menus.xml" name="RequestTabBar"/>
+                                <include-menu name="RequestSubTabBar" location="component://projectmgr/widget/Menus.xml"/>
                                 <container>
                                     <label style="h1">[${uiLabelMap.CommonId}:${custRequest.custRequestId}] ${custRequest.custRequestName}</label>
                                 </container>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Wed Sep 24 20:05:45 2008
@@ -396,4 +396,9 @@
             <link target="${my}StatusToComplete?timesheetId=${timesheet.timesheetId}&amp;statusId=TIMESHEET_COMPLETED"/>
         </menu-item>
     </menu>
+    <menu name="RequestSubTabBar" type="simple" menu-container-style="button-bar button-style-2">
+        <menu-item name="cancelledRequest" title="Cancel request" >
+            <link target="setCustRequestStatus?custRequestId=${custRequestId}&amp;statusId=CRQ_CANCELLED"/>
+        </menu-item>
+    </menu>
 </menus>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/RequestScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/RequestScreens.xml?rev=698803&r1=698802&r2=698803&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/RequestScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/RequestScreens.xml Wed Sep 24 20:05:45 2008
@@ -28,6 +28,7 @@
                 <set field="headerItem" value="request"/>
                 <entity-and list-name="custRequests" entity-name="CustRequest">
                     <field-map field-name="statusId" value="CRQ_ACCEPTED"/>
+                    <field-map field-name="statusId" value="CRQ_CANCELLED"/>
                     <order-by field-name="lastModifiedDate"/>
                 </entity-and>
             </actions>