Author: jleroux
Date: Thu Mar 22 09:38:56 2007 New Revision: 521333 URL: http://svn.apache.org/viewvc?view=rev&rev=521333 Log: A patch from Anil K Patel "FixedAssetMaintOrder, default to first item on PO" https://issues.apache.org/jira/browse/OFBIZ-827 Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml?view=diff&rev=521333&r1=521332&r2=521333 ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Thu Mar 22 09:38:56 2007 @@ -636,17 +636,30 @@ <set field="orderId" from-field="parameters.orderId"/> <add-error><fail-property resource="AccountingUiLabels" property="AccountingOrderWithIdNotFound"/></add-error> </if-empty> - <check-errors/> - - <if-not-empty field-name="orderItemSeqId" map-name="parameters"> - <!-- Check, should exist orderId and orderItemId --> - <entity-one entity-name="OrderItem" value-name="lookedUpValue"/> - <if-empty field-name="lookedUpValue"> - <set field="orderItemSeqId" from-field="parameters.orderItemSeqId"/> - <add-error><fail-property resource="AccountingUiLabels" property="AccountingOrderItemWithIdNotFound"/></add-error> - </if-empty> <check-errors/> - </if-not-empty> + + <!-- Check if user has not passed in orderItemSeqId then get list of OrderItems from database and default to first item --> + <if-empty field-name="orderItemSeqId" map-name="parameters"> + <entity-and entity-name="OrderItem" list-name="orderItems"> + <field-map field-name="orderId" env-name="parameters.orderId"/> + </entity-and> + <if-not-empty field-name="orderItems"> + <set field="orderItem" from-field="orderItems[0]"/> + <if-not-empty field-name="orderItem"> + <set field="parameters.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> + </if-not-empty> + </if-not-empty> + + <else> + <!-- Check, should exist orderId and orderItemId --> + <entity-one entity-name="OrderItem" value-name="lookedUpValue"/> + <if-empty field-name="lookedUpValue"> + <set field="orderItemSeqId" from-field="parameters.orderItemSeqId"/> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingOrderItemWithIdNotFound"/></add-error> + </if-empty> + </else> + </if-empty> + <check-errors/> <make-value entity-name="FixedAssetMaintOrder" value-name="newEntity"/> <set-pk-fields map-name="parameters" value-name="newEntity"/> Modified: ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml?view=diff&rev=521333&r1=521332&r2=521333 ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml Thu Mar 22 09:38:56 2007 @@ -242,7 +242,10 @@ <service name="createFixedAssetMaintOrder" default-entity-name="FixedAssetMaintOrder" engine="simple" location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetMaintOrder" auth="true"> <description>Create a FixedAsset Maintenance Order</description> - <auto-attributes include="pk" mode="IN" optional="false"/> + <attribute name="fixedAssetId" type="String" mode="IN" optional="false"/> + <attribute name="maintHistSeqId" type="String" mode="IN" optional="false"/> + <attribute name="orderId" type="String" mode="IN" optional="false"/> + <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> <service name="deleteFixedAssetMaintOrder" default-entity-name="FixedAssetMaintOrder" engine="simple" Modified: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml?view=diff&rev=521333&r1=521332&r2=521333 ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml Thu Mar 22 09:38:56 2007 @@ -430,7 +430,6 @@ </form> <!-- create and update a Order on a fixed asset --> <form name="AddFixedAssetMaintOrder" type="single" target="createFixedAssetMaintOrder" title="" default-map-name="fixedAssetMaintOrder"> - <auto-fields-service service-name="createFixedAssetMaintOrder" map-name="fixedAssetMaintOrder"/> <field name="fixedAssetId"><hidden/></field> <field name="maintHistSeqId"><hidden/></field> <field name="orderId"><lookup target-form-name="LookupOrderHeader"/></field> |
Free forum by Nabble | Edit this page |