Skip to content

Commit

Permalink
OBPIH-6114 Add tiered pricing to product supplier (#4530)
Browse files Browse the repository at this point in the history
* OBPIH-6114 Add tiered pricing to product supplier

* OBPIH-6114 Set default tiered pricing to false on command
  • Loading branch information
awalkowiak committed Mar 12, 2024
1 parent 7afa7f5 commit 8031cdb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class ProductSupplier implements Serializable, Comparable<ProductSupplier> {
// Additional comments
String comments

Boolean tieredPricing = false

// Auditing fields
Date dateCreated
Date lastUpdated
Expand Down Expand Up @@ -239,6 +241,7 @@ class ProductSupplier implements Serializable, Comparable<ProductSupplier> {
manufacturerCode: manufacturerCode,
brandName: brandName,
attributes: attributes,
tieredPricing: tieredPricing,
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
databaseChangeLog = {
changeSet(author: "openboxes (generated)", id: "1709054923255-0") {
preConditions(onError: "HALT", onFail: "MARK_RAN", onSqlOutput: "IGNORE") {
not {
columnExists(columnName: "tiered_pricing", tableName: "product_supplier")
}
}

addColumn(tableName: "product_supplier") {
column(name: "tiered_pricing", type: "bit") {
constraints(nullable: "false")
}
}
}
}
1 change: 1 addition & 0 deletions grails-app/migrations/0.9.x/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<include file="0.9.x/changelog-2023-11-06-1230-add-missing-role-names.xml" />
<include file="0.9.x/changelog-2024-01-10-1100-add-missing-foreign-keys-for-product-price.xml" />
<include file="0.9.x/changelog-2024-02-22-1300-add-default-product-package-to-product-supplier.xml" />
<include file="0.9.x/changelog-2024-02-27-1630-add-tiered-pricing-to-product-supplier.groovy" />
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ProductPackageService {
private static void setPackageData(ProductPackageCommand command) {
ProductSupplier productSupplier = command.productSupplier
productSupplier.minOrderQuantity = command.minOrderQuantity
productSupplier.tieredPricing = command.tieredPricing

ProductPackage defaultProductPackage = productSupplier?.productPackages?.find {
it.uom == command.uom && it.quantity == command.productPackageQuantity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class ProductPackageCommand implements Validateable {

Date contractPriceValidUntil

Boolean tieredPricing = false

static constraints = {
productPackageQuantity(min: 0)
minOrderQuantity(nullable: true, min: 0.0)
Expand Down

0 comments on commit 8031cdb

Please sign in to comment.