Fixed: Convert InventoryIssueServices.xml mini lang to groovy
Side effect: Inventory Issuance use generic shipment service to control the authorization
but without a shipment, checkCanChangeShipmentStatusGeneral failed with NPE.
I complete the function to escape if a shipment isn't present and only valid with facility permission
@@ -746,6 +746,7 @@ def checkCanChangeShipmentStatusGeneral(Map inputParameters) {
}
Boolean hasPermission = serviceResult.hasPermission
GenericValue testShipment = from("Shipment").where(inputParameters).cache().queryOne()
+ if (testShipment) {
boolean badMoveToPacked = testShipment.statusId == "SHIPMENT_PACKED" && fromStatusId == "SHIPMENT_PACKED"
boolean badMoveToShipped = testShipment.statusId == "SHIPMENT_SHIPPED" &&
@@ -763,6 +764,7 @@ def checkCanChangeShipmentStatusGeneral(Map inputParameters) {
hasPermission = false
result.failMessage = failMessage
}
+ }
result.hasPermission = hasPermission
return result
}
