Skip to content

Commit 609ade4

Browse files
committed
Improved: Convert Shipment Crud simple service to entity-auto
(OFBIZ-6996) I converted all available shipment entities crud currently on simple service to entity-auto service : * ItemIssuanceRole * ShipmentItem * ShipmentPackageContent * ShipmentPackageRouteSeg * ShipmentRouteSegment * QuantityBreak I also transformed a simple method call to a permission service: checkCanChangeShipmentStatus, who check for a shipment is it on good status for the change. With this last conversion, the permission control set on the service definition instead of core service git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866286 13f79535-47bb-0310-9956-ffa450edef68
1 parent 899bc6f commit 609ade4

File tree

6 files changed

+112
-311
lines changed

6 files changed

+112
-311
lines changed

Diff for: applications/product/config/ProductErrorUiLabels.xml

+4
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,10 @@
14891489
<value xml:lang="zh">创建快速添加变型数据时发生交易错误:${errMessage}。</value>
14901490
<value xml:lang="zh-TW">新建快速增加變型資料時發生交易錯誤: ${errMessage}.</value>
14911491
</property>
1492+
<property key="ShipmentCanChangeStatusPermissionError">
1493+
<value xml:lang="en">Cannot perform this operation when the shipment [${testShipment.shipmentId}] is in the ${testShipmentStatus.description} [${testShipment.statusId}] status."</value>
1494+
<value xml:lang="fr">Impossible de réaliser l'opération demandée quand l'expédition [${testShipment.shipmentId}] est dans le statut ${testShipmentStatus.description} [${testShipment.statusId}]</value>
1495+
</property>
14921496
<property key="variantevents.variantProductId_required_but_missing_enter_an_id">
14931497
<value xml:lang="de">variantProductId wir benötigt, fehlt aber, bitte geben Sie eine ID für die neue Produktvariante an.</value>
14941498
<value xml:lang="en">variantProductId is required but missing, please enter an id for the new variant product.</value>

Diff for: applications/product/minilang/shipment/issuance/IssuanceServices.xml

+4-49
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ under the License.
2222
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
2323
<!-- ItemIssuance services -->
2424
<simple-method method-name="createItemIssuance" short-description="Create ItemIssuance">
25-
<set value="Create ItemIssuance" field="operationName"/>
26-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
27-
<check-errors/>
28-
2925
<make-value entity-name="ItemIssuance" value-field="newEntity"/>
3026
<sequenced-id sequence-name="ItemIssuance" field="newEntity.itemIssuanceId"/>
3127
<field-to-result field="newEntity.itemIssuanceId" result-name="itemIssuanceId"/>
@@ -64,48 +60,9 @@ under the License.
6460
</if-not-empty>
6561
<field-to-result field="affectAccounting" result-name="affectAccounting"/>
6662
</simple-method>
67-
<simple-method method-name="updateItemIssuance" short-description="Update ItemIssuance">
68-
<set value="Update ItemIssuance" field="operationName"/>
69-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
70-
<check-errors/>
71-
72-
<entity-one entity-name="ItemIssuance" value-field="lookedUpValue"/>
73-
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
74-
<store-value value-field="lookedUpValue"/>
75-
</simple-method>
76-
<simple-method method-name="deleteItemIssuance" short-description="Delete ItemIssuance">
77-
<set value="Delete ItemIssuance" field="operationName"/>
78-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
79-
<check-errors/>
80-
81-
<entity-one entity-name="ItemIssuance" value-field="lookedUpValue"/>
82-
<remove-value value-field="lookedUpValue"/>
83-
</simple-method>
84-
85-
<!-- ItemIssuanceRole services -->
86-
<simple-method method-name="createItemIssuanceRole" short-description="Create ItemIssuanceRole">
87-
<set value="Create ItemIssuanceRole" field="operationName"/>
88-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
89-
<check-errors/>
90-
<make-value entity-name="ItemIssuanceRole" value-field="newEntity"/>
91-
<set-pk-fields map="parameters" value-field="newEntity"/>
92-
<set-nonpk-fields map="parameters" value-field="newEntity"/>
93-
<create-value value-field="newEntity"/>
94-
</simple-method>
95-
96-
<simple-method method-name="deleteItemIssuanceRole" short-description="Delete ItemIssuanceRole">
97-
<set value="Delete ItemIssuanceRole" field="operationName"/>
98-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
99-
<check-errors/>
100-
<entity-one entity-name="ItemIssuanceRole" value-field="lookedUpValue"/>
101-
<remove-value value-field="lookedUpValue"/>
102-
</simple-method>
10363

10464
<!-- the actual issuance services -->
10565
<simple-method method-name="issueOrderItemToShipment" short-description="Issue OrderItem to Shipment">
106-
<set value="Issue OrderItem to Shipment" field="operationName"/>
107-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
108-
<check-errors/>
10966

11067
<!-- get orderHeader -->
11168
<entity-one entity-name="OrderHeader" value-field="orderHeader" auto-field-map="true"/>
@@ -132,9 +89,6 @@ under the License.
13289
</simple-method>
13390

13491
<simple-method method-name="issueOrderItemShipGrpInvResToShipment" short-description="Issue OrderItemShipGrpInvRes to Shipment">
135-
<set value="Issue OrderItemShipGrpInvRes to Shipment" field="operationName"/>
136-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
137-
<check-errors/>
13892

13993
<!-- get orderItemShipGrpInvRes -->
14094
<make-value entity-name="OrderItemShipGrpInvRes" value-field="OrderItemShipGrpInvResLookupPk"/>
@@ -464,7 +418,7 @@ under the License.
464418
<field-to-result field="itemIssuanceId"/>
465419
</simple-method>
466420
<simple-method method-name="associateIssueRoles" short-description="Associate Roles for ItemIssuance - meant to be called in-line">
467-
<!-- make sure the party is in the PACKER role -->
421+
<!-- make sure the party is in the PACKER role TODO need to replace by ensurePartyRole-->
468422
<make-value entity-name="PartyRole" value-field="partyRole"/>
469423
<set field="partyRole.partyId" from-field="userLogin.partyId"/>
470424
<set field="partyRole.roleTypeId" value="PACKER"/>
@@ -565,8 +519,9 @@ under the License.
565519
<!-- issuance can be canceled only if the sales shipment is not packed -->
566520

567521
<if-compare field="shipment.statusId" operator="not-equals" value="SHIPMENT_CANCELLED">
568-
<set from-field="itemIssuance.shipmentId" field="shipmentId"/>
569-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
522+
<set from-field="itemIssuance.shipmentId" field="checkCanChangeShipmentStatusPackedMap.shipmentId"/>
523+
<set value="UPDATE" field="checkCanChangeShipmentStatusPackedMap.mainAction"/>
524+
<call-service service-name="checkCanChangeShipmentStatusPacked" in-map-name="checkCanChangeShipmentStatusPackedMap" />
570525
<check-errors/>
571526
</if-compare>
572527

Diff for: applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml

-3
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ under the License.
361361
</simple-method>
362362

363363
<simple-method method-name="issueOrderItemToShipmentAndReceiveAgainstPO" short-description="Issues order item quantity specified to the shipment, then receives inventory for that item and quantity">
364-
<set value="Issue OrderItem to Shipment and Receive against PO" field="operationName"/>
365-
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
366-
<check-errors/>
367364

368365
<!-- get orderItem -->
369366
<entity-one entity-name="OrderItem" value-field="orderItem" auto-field-map="true"/>

0 commit comments

Comments
 (0)