Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44736ed

Browse files
authored
OBPIH-6887 products cant be deactivated while on a stocklist (#5557)
1 parent273efac commit44736ed

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎grails-app/domain/org/pih/warehouse/product/Product.groovy‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import org.pih.warehouse.inventory.InventoryLevel
3333
importorg.pih.warehouse.inventory.InventorySnapshotEvent
3434
importorg.pih.warehouse.inventory.TransactionCode
3535
importorg.pih.warehouse.inventory.TransactionEntry
36+
importorg.pih.warehouse.requisition.RequisitionItem
3637
importorg.pih.warehouse.shipping.ShipmentItem
3738
importorg.pih.warehouse.LocalizationUtil
3839

@@ -298,7 +299,23 @@ class Product implements Comparable, Serializable {
298299
unitOfMeasure(nullable:true,maxSize:255)
299300
category(nullable:false)
300301
productType(nullable:false)
301-
active(nullable:true)
302+
active(nullable:true,validator: {value,obj->
303+
if (value) {
304+
returntrue
305+
}
306+
// Don't allow a product to be deactivated if it is in an active stocklist.
307+
int numActiveStocklistsForProduct=RequisitionItem.createCriteria().count {
308+
eq('product', obj)
309+
requisition {
310+
eq('isTemplate',true)
311+
eq('isPublished',true)
312+
}
313+
}
314+
if (numActiveStocklistsForProduct>0) {
315+
return ['invalid.inStocklist']
316+
}
317+
returntrue
318+
})
302319
coldChain(nullable:true)
303320
reconditioned(nullable:true)
304321
controlledSubstance(nullable:true)

‎grails-app/i18n/messages.properties‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,7 @@ product.preferredBin.label=Preferred bin location
20232023
product.associations.label=Associations
20242024
product.substitutions.label=Substitutions
20252025
product.active.label=Active
2026+
product.active.invalid.inStocklist=Product cannot be deactivated because it is on a published stocklist. Go to stocklist management to see the stocklists this product is on
20262027
product.lotAndExpiryControl.label=Lot and expiry control
20272028
product.lotControl.label=Lot control
20282029
product.serialized.label=Serialized

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp