﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	db_engine	os_version
2890	Update inventory trigger to change accession backup status for and inventory status beginning with BACKUP	Cullen McGovern	dbmulg	"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.
"	defect	addressed	major	Server 2.3.8	Trigger	N/A				laura.gu@…	N/A	N/A
