Skip to content

Add foreign key constraint for transaction.requisition_id #108

@jmiranda

Description

@jmiranda

Yesterday, I had to deal with an issue where PIH Liberia had deleted a requisition, but the transactions underlying that requisition were left intact including the deleted requisition_id (see OBPIH-349: Stock history viewing issue: JY51). The bug manifested itself by not allowing users to view the stock history for a product at a certain location. This is a blocker and should be dealt with immediately to prevent unintended loss of data.

2015-09-17 21:17:54,541 [ajp-bio-8009-exec-2] INFO  inventory.InventoryItemController  - inventoryItem.showStockHistory: 24 ms
2015-09-17 21:17:55,067 [ajp-bio-8009-exec-2] ERROR errors.GrailsExceptionResolver  - Exception occurred when processing request: [GET] /openboxes/inventoryItem/showStockHistory/c879370c4a13ffdf014a15e2cb6500c1
Stacktrace follows:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.pih.warehouse.requisition.Requisition#c879370c4cdfd123014ce136632600c3]
    at gsp_openboxes_inventoryItem_showStockHistory_gsp$_run_closure1_closure3_closure5.doCall(gsp_openboxes_inventoryItem_showStockHistory_gsp.groovy:203)
    at gsp_openboxes_inventoryItem_showStockHistory_gsp$_run_closure1_closure3.doCall(gsp_openboxes_inventoryItem_showStockHistory_gsp.groovy:79)
    at gsp_openboxes_inventoryItem_showStockHistory_gsp$_run_closure1.doCall(gsp_openboxes_inventoryItem_showStockHistory_gsp.groovy:77)
    at gsp_openboxes_inventoryItem_showStockHistory_gsp$_run_closure1.doCall(gsp_openboxes_inventoryItem_showStockHistory_gsp.groovy)
    at gsp_openboxes_inventoryItem_showStockHistory_gsp.run(gsp_openboxes_inventoryItem_showStockHistory_gsp.groovy:295)
    at org.pih.warehouse.inventory.InventoryItemController$_closure7.doCall(InventoryItemController.groovy:139)
    at org.pih.warehouse.inventory.InventoryItemController$_closure7.call(InventoryItemController.groovy)
    at grails.plugin.springcache.web.GrailsFragmentCachingFilter.doFilter(GrailsFragmentCachingFilter.groovy:66)
    at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Metadata

Metadata

Assignees

Labels

type: bugAddresses unintended behaviours of the app

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions