-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
OBPIH-4581 Allow autoincrement on default product type #3413
Conversation
grails-app/services/org/pih/warehouse/core/IdentifierService.groovy
Outdated
Show resolved
Hide resolved
grails-app/services/org/pih/warehouse/core/IdentifierService.groovy
Outdated
Show resolved
Hide resolved
Added DEFAULT ProductType to the db migrations
6b8034c
to
c8a5cd1
Compare
@jmiranda this one is ready for review. I gave up on the previous version because it was generating more "what ifs" than it made sense. I added the
|
4da5601
to
f1eb80b
Compare
f1eb80b
to
2a8b28c
Compare
grails-app/migrations/0.8.x/changelog-2022-09-02-1200-add-default-product-type.xml
Show resolved
Hide resolved
grails-app/migrations/0.8.x/changelog-2022-09-02-1200-add-default-product-type.xml
Show resolved
Hide resolved
def findOrCreateProductType(String productTypeName) { | ||
def productType = ProductType.findByName(productTypeName) | ||
if (!productType) { | ||
println("Could not find product type " + productTypeName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can use log.info or remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
@@ -17,4 +19,18 @@ class ProductTypeService { | |||
|
|||
return productType.sequenceNumber | |||
} | |||
|
|||
def getDefaultProductType() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine as-is, but this could also be implemented as a named query on the ProductType domain.
http://docs.grails.org/latest/ref/Domain%20Classes/namedQueries.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially added it in the domain, but when I was calling it in the gsp template I was getting weird exception, hence I moved it here. I'll try again with domain version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I have not tried a named query then, perhaps it will be better. Thanks for the suggestion.
… type