Author: hansbak
Date: Fri Mar 12 06:05:58 2010 New Revision: 922152 URL: http://svn.apache.org/viewvc?rev=922152&view=rev Log: add a draft status to the customer request Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml ofbiz/trunk/applications/order/data/OrderTypeData.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml ofbiz/trunk/applications/order/servicedef/services_request.xml Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=922152&r1=922151&r2=922152&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri Mar 12 06:05:58 2010 @@ -2512,6 +2512,9 @@ <value xml:lang="en">Customer Request Note added Notification</value> <value xml:lang="it">Notifica nota richiesta cliente aggiunta</value> </property> + <property key="OrderCustRequestShouldHaveFromPartyIdIfNotDraft"> + <value xml:lang="en">Customer Request should have a 'from' partyId if not in the draft status</value> + </property> <property key="OrderCustRequestStatusList"> <value xml:lang="en">Customer Request Status List</value> <value xml:lang="it">Lista stato richiesta cliente</value> Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=922152&r1=922151&r2=922152&view=diff ============================================================================== --- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original) +++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Fri Mar 12 06:05:58 2010 @@ -214,12 +214,16 @@ under the License. <!-- CustRequest statuses --> <StatusType description="Custom Request Status" hasTable="N" parentTypeId="" statusTypeId="CUSTREQ_STTS"/> + <StatusItem description="Draft" sequenceId="00" statusCode="DRAFT" statusId="CRQ_DRAFT" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Submitted" sequenceId="01" statusCode="SUBMITTED" statusId="CRQ_SUBMITTED" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Accepted" sequenceId="02" statusCode="ACCEPTED" statusId="CRQ_ACCEPTED" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Reviewed" sequenceId="03" statusCode="REVIEWED" statusId="CRQ_REVIEWED" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Completed" sequenceId="04" statusCode="COMPLETED" statusId="CRQ_COMPLETED" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Rejected" sequenceId="98" statusCode="REJECTED" statusId="CRQ_REJECTED" statusTypeId="CUSTREQ_STTS"/> <StatusItem description="Cancelled" sequenceId="99" statusCode="CANCELLED" statusId="CRQ_CANCELLED" statusTypeId="CUSTREQ_STTS"/> + <StatusValidChange condition="" statusId="CRQ_DRAFT" statusIdTo="CRQ_ACCEPTED" transitionName="Accept Request"/> + <StatusValidChange condition="" statusId="CRQ_DRAFT" statusIdTo="CRQ_SUBMITTED" transitionName="Submit Request"/> + <StatusValidChange condition="" statusId="CRQ_DRAFT" statusIdTo="CRQ_CANCELLED" transitionName="Cancel Request"/> <StatusValidChange condition="" statusId="CRQ_SUBMITTED" statusIdTo="CRQ_ACCEPTED" transitionName="Accept Request"/> <StatusValidChange condition="" statusId="CRQ_SUBMITTED" statusIdTo="CRQ_REJECTED" transitionName="Reject Request"/> <StatusValidChange condition="" statusId="CRQ_SUBMITTED" statusIdTo="CRQ_CANCELLED" transitionName="Cancel Request"/> 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=922152&r1=922151&r2=922152&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 Fri Mar 12 06:05:58 2010 @@ -62,9 +62,20 @@ under the License. <set field="newEntity.custRequestDate" from-field="nowTimestamp"/> </if-empty> - <!-- always start with submitted --> - <set value="CRQ_SUBMITTED" field="newEntity.statusId"/> - + <!-- if not draft status input check for from fromPartyId present --> + <if-not-empty field="parameters.statusId"> + <if-compare operator="not-equals" value="CRQ_DRAFT" field="parameters.statusId"> + <if-empty field="newEntity.fromPartyId"> + <add-error> + <fail-property property="OrderCustRequestShouldHaveFromPartyIdIfNotDraft" resource="OrderUiLabels"/> + </add-error> + </if-empty> + </if-compare> + </if-not-empty> + + <!-- always start with draft --> + <set value="CRQ_DRAFT" field="newEntity.statusId"/> + <if-not-empty field="parameters.custRequestId"> <set field="newEntity.custRequestId" from-field="parameters.custRequestId"/> <else> @@ -72,13 +83,16 @@ under the License. </else> </if-not-empty> + <check-errors/> <create-value value-field="newEntity"/> <field-to-result field="newEntity.custRequestId" result-name="custRequestId"/> - <!-- set status fields and history --> - <set field="parameters.custRequestId" from-field="newEntity.custRequestId"/> - <set-service-fields service-name="setCustRequestStatus" map="parameters" to-map="setStat"/> - <call-service service-name="setCustRequestStatus" in-map-name="setStat"/> + <!-- set status fields and history if provided --> + <if-not-empty field="parameters.statusId"> + <set field="setStat.statusId" from-field="parameters.statusId"/> + <set field="setStat.custRequestId" from-field="newEntity.custRequestId"/> + <call-service service-name="setCustRequestStatus" in-map-name="setStat"/> + </if-not-empty> <!-- create also the item if key fields are provided --> <if> @@ -100,41 +114,43 @@ under the License. <simple-method method-name="updateCustRequest" short-description="Update Customer Request"> <call-simple-method method-name="checkStatusCustRequest"/> <field-to-result field="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-field="custRequest" relation-name="CustRequestWorkEffort" list="workEfforts"/> - <if-not-empty field="workEfforts"> - <iterate entry="workEffort" list="workEfforts"> - <entity-one entity-name="WorkEffort" value-field="lowInfo"> - <field-map field-name="workEffortId" from-field="workEffort.workEffortId"/> - </entity-one> - <call-simple-method method-name="getHours" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.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"/> - <call-service service-name="updateWorkEffort" in-map-name="updTask"/> - <else> - <set field="parameters.statusId" from-field="custRequest.statusId"/> - <property-to-field resource="OrderUiLabels" property="OrderCannotCancelRequestAlreadyWorkedOn" field="errorMessage"/> - <field-to-result field="errorMessage"/> - <set field="isShowEvent" value="N"/> - </else> - </if-empty> - </iterate> + <if-not-empty field="parameters.statusId"> + <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-field="custRequest" relation-name="CustRequestWorkEffort" list="workEfforts"/> + <if-not-empty field="workEfforts"> + <iterate entry="workEffort" list="workEfforts"> + <entity-one entity-name="WorkEffort" value-field="lowInfo"> + <field-map field-name="workEffortId" from-field="workEffort.workEffortId"/> + </entity-one> + <call-simple-method method-name="getHours" xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.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"/> + <call-service service-name="updateWorkEffort" in-map-name="updTask"/> + <else> + <set field="parameters.statusId" from-field="custRequest.statusId"/> + <property-to-field resource="OrderUiLabels" property="OrderCannotCancelRequestAlreadyWorkedOn" field="errorMessage"/> + <field-to-result field="errorMessage"/> + <set field="isShowEvent" value="N"/> + </else> + </if-empty> + </iterate> + </if-not-empty> + </if-compare> + <!-- update status and save the changed status in the history --> + <set-service-fields service-name="setCustRequestStatus" map="parameters" to-map="setStat"/> + <call-service service-name="setCustRequestStatus" in-map-name="setStat"/> + <if-not-empty field="isShowEvent"> + <clear-field field="successMessage"/> </if-not-empty> - </if-compare> - <!-- update status and save the changed status in the history --> - <set-service-fields service-name="setCustRequestStatus" map="parameters" to-map="setStat"/> - <call-service service-name="setCustRequestStatus" in-map-name="setStat"/> - <if-not-empty field="isShowEvent"> - <clear-field field="successMessage"/> - </if-not-empty> - </if-compare-field> + </if-compare-field> + </if-not-empty> <now-timestamp field="nowTimestamp"/> <set from-field="nowTimestamp" field="custRequest.lastModifiedDate"/> <set from-field="userLogin.userLoginId" field="custRequest.lastModifiedByUserLogin"/> Modified: ofbiz/trunk/applications/order/servicedef/services_request.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_request.xml?rev=922152&r1=922151&r2=922152&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_request.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_request.xml Fri Mar 12 06:05:58 2010 @@ -41,7 +41,6 @@ under the License. <auto-attributes include="pk" mode="INOUT" optional="true"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <auto-attributes include="all" mode="IN" entity-name="CustRequestItem" optional="true"/> - <attribute name="fromPartyId" type="String" mode="IN" optional="false"/> <override name="custRequestName" allow-html="safe"/> <override name="description" allow-html="safe"/> <override name="story" allow-html="safe"/> |
Free forum by Nabble | Edit this page |