Opened 12 years ago

Closed 10 years ago

#974 closed enhancement (fixed)

We need a way to have the system inventory align with accession prefix, number, suffix changes

Reported by: Mark J. Millard Owned by: Kurt Endress
Priority: critical Milestone: Server Release 2016Oct
Component: Other Version: 1.9.2
Severity: Keywords: system inventory; trigger
Cc: kurt.endress@…, marty.reisinger@…, pete.cyr@… Database Engine: SQL Server
Operating System: Windows 7 Ultimate 64 bit

Description

This may be related to ticket #514. We have the scenario where a site adds site accessions to the database and then requests a PI number for these. Usually then the PI id fields are written over the site ID Ames 898888 becomes PI 701566. I think we need a trigger that then changes the system inventory id fields to match the new PI fields. At this time this cannot be done even manually.

I suggest a trigger as some organizations may not want this behavior.

I am putting this into the "Other" component group as I don't know where the final fix will occur. I am putting this in a higher priority enhancement rather than a bug, however some organizations will definitely think this is a bug.

Attachments (1)

974.docx​ (239.0 KB ) - added by Martin Reisinger 10 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Kurt Endress, 10 years ago

Status: new → addressed

Karen modified the system AccessionDataTrigger to update the system inventory. Moved the GrinGlobal.Business.dll to npgsdev for testing.

comment:2 by Martin Reisinger, 10 years ago

Milestone: Post 1.0 → Server_2016_Oct

comment:3 by Kurt Endress, 10 years ago

The trigger trows an error when the accession changed is new and unmodified.

The UPDATE statement conflicted with the FOREIGN KEY constraint "fk_i_modified". The conflict occurred in database "gringlobal", table "dbo.cooperator", column 'cooperator_id'.
The statement has been terminated.

Changed the update SQL and moved to npgsdev for testing:

args.WriteData(@"

UPDATE i SET

i.inventory_number_part1 = a.accession_number_part1,
i.inventory_number_part2 = a.accession_number_part2,
i.inventory_number_part3 = a.accession_number_part3,
i.modified_date = COALESCE(a.modified_date, a.created_date),
i.modified_by = COALESCE(a.modified_by, a.created_by)

FROM inventory i INNER JOIN accession a ON a.accession_id = i.accession_id

WHERE i.accession_id = @accessionid AND i.form_type_code = ''",

new DataParameters("@accessionid", accessionID, DbType.Int32));

by Martin Reisinger, 10 years ago

Attachment: 974.docx​ added

comment:4 by Kurt Endress, 10 years ago

Trigger included in server build 1.9.8.2 in Oct. 2016

comment:5 by Kurt Endress, 10 years ago

Resolution: → fixed
Status: addressed → closed
Note: See TracTickets for help on using tickets.