Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OFBIZ-11468 Improved: Convert ShipmentReceiptServices.xml mini lang to groovy #150

Conversation

wpaetzold
Copy link
Contributor

(OFBIZ-11468)

Also converted getTotalIssuedQuantityForOrderItem in IssuanceServices, because it is used in ShipmentReceiptServices and needed more return values.

(OFBIZ-11468)

Also converted getTotalIssuedQuantityForOrderItem in IssuanceServices, because it is used in ShipmentReceiptServices and needed more return values.
@sonarcloud
Copy link

sonarcloud bot commented May 20, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@PierreSmits PierreSmits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to have subfolders defining where the services belong to when such is already captured in the name of the file, e.g.:
folder /shipment/receipt/ when the filename has ShipmentReceiptServices.groovy
Similarly
/shipment/issuance/ when the filename has ShipmentIssuanceServices.groovy

@JacquesLeRoux
Copy link
Contributor

Hi Wiebke,

After a break, I'll continue to review, sorry for the delay. I agree with Pierre. It does not make sense to have directories with a single file named "as" the directory, like it's in XML currently.

@JacquesLeRoux
Copy link
Contributor

Hi Wiebke,

Would you have a chance to change as Pierre suggested? We though could do that later with another PR if your prefer...

@wpaetzold
Copy link
Contributor Author

Hi,
sorry for the delay.
Of course I can change the structure as Pierre sugessted. I just copied the structure from the minilang files.
But wouldn't it be better to move all ShipmentServices into one folder in a separate PR, since picklist, issuance and shipment each also contain only one file?

@JacquesLeRoux
Copy link
Contributor

You later suggestion sounds good to me, Wiebke. I have still to finish the review, from what I saw so far (half of it), I'll maybe not do a complete review but just check another service before merging...

@wpaetzold
Copy link
Contributor Author

Then I will leave the structure as it is and we can create a separate PR for it later

Copy link
Contributor

@JacquesLeRoux JacquesLeRoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are few lines long to format, please do before I merge, TIA

Boolean affectAccounting = true

GenericValue product = from("Product").where(parameters).queryOne()
if (product.productTypeId == "SERVICE_PRODUCT" || product.productTypeId == "ASSET_USAGE_OUT_IN" || product.productTypeId == "AGGREGATEDSERV_CONF") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though we use now 150 chars it would be easier to read if the or would be split by line.
To be sincere, this was more to test the GH review feature :)

run service:"createInventoryItemDetail", with: inventoryItemDetailMap

// Balance the inventory item
Map balanceInventoryItemMap = [inventoryItemId: inventoryItem.inventoryItemId, priorityOrderId: shipmentReceipt.orderId, priorityOrderItemSeqId: shipmentReceipt.orderItemSeqId]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is 26 chars too long (180 instead of max 250)

shipmentItem.quantity += quantityToAdd
shipmentItem.store()
GenericValue orderShipment = from("OrderShipment")
.where(orderId: parameters.orderId, orderItemSeqId: parameters.orderItemSeqId, shipmentId: parameters.shipmentId, shipmentItemSeqId: shipmentItem.shipmentItemSeqId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another too long line

*
* - for serialized items with a serial number passed in: the quantityAccepted _should_ always be 1
* - if the type is SERIALIZED_INV_ITEM but there is not serial number (which is weird...) we'll create a bunch of individual InventoryItems
* - DEJ20070822: something to consider for the future: maybe instead of this funny looping maybe for serialized items we should only allow a quantity of 1, ie return an error if it is not 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another (inherited) too long line

@JacquesLeRoux
Copy link
Contributor

Very good code, just 4 too long lines, thanks for the good work Wiebke (even if I did not review all, I'm confident with what I saw about the code quality)

@sonarcloud
Copy link

sonarcloud bot commented Jun 24, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@JacquesLeRoux JacquesLeRoux merged commit 7335ce0 into apache:trunk Jun 24, 2020
@JacquesLeRoux
Copy link
Contributor

Hi Pierre, Wiebke,

With 3926134 commit I have moved the files in up-dir

@JacquesLeRoux
Copy link
Contributor

Forgot to change in services def, Pawan handled it :)

@wpaetzold wpaetzold deleted the OFBIZ-11468_Convert_ShipmentReceiptServices-squashed branch January 25, 2021 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants