Opened 3 years ago
Last modified 3 years ago
#2890 addressed defect
Update inventory trigger to change accession backup status for and inventory status beginning with BACKUP
| Reported by: | Cullen McGovern | Owned by: | dbmulg |
|---|---|---|---|
| Priority: | major | Milestone: | Server 2.3.8 |
| Component: | Trigger | Version: | N/A |
| Severity: | Keywords: | ||
| Cc: | laura.gu@… | Database Engine: | N/A |
| Operating System: | N/A |
Description
I’ve noticed that the inventory trigger includes this starting on line 448:
string asc = h.GetValue("availability_status_code", "", true).ToString();
if (asc == "BACKUP" || asc == "SOS") {
int ivid = args.NewPrimaryKeyID;
args.WriteData(@"UPDATE a
SET is_backed_up = 'Y', backup_location1_site_id = ci.site_id
, modified_by = COALESCE(i.modified_by, i.created_by), modified_date = GETUTCDATE()
FROM accession a
JOIN inventory i ON i.accession_id = a.accession_id
JOIN cooperator ca ON ca.cooperator_id = a.owned_by
JOIN cooperator ci ON ci.cooperator_id = i.owned_by
WHERE i.inventory_id = :ivid
AND a.is_backed_up = 'N' AND i.availability_status_code IN ('BACKUP', 'SOS') AND ca.site_id != ci.site_id",
new DataParameters(":ivid", ivid, DbType.Int32));
}
This will fail to set the accession.is_backed_up flag for inventory with the status ‘BACKUP-CRITICAL’. We may want to add additional BACKUP- statuses in the future, and it would fail for those as well.
I would propose that line 449 becomes:
if (asc.StartsWith("BACKUP", true) || asc == "SOS")
Similarly, the relevant part of line 459 should be changed to:
(i.availability_status_code = 'SOS' OR i.availability_status_code LIKE 'BACKUP%')
The result will be that any status beginning with “BACKUP” will set the accession flag.
Change History (2)
comment:1 by , 3 years ago
| Status: | assigned → addressed |
|---|
comment:2 by , 3 years ago
| Milestone: | → Server 2.3.8 |
|---|
Note:
See TracTickets
for help on using tickets.
