Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#1444 closed enhancement (fixed)

Cancel Web Order Trigger

Reported by: Kurt Endress Owned by: Kurt Endress
Priority: medium Milestone: Next Release - Server
Component: Trigger Version: N/A
Severity: Keywords:
Cc: Database Engine: N/A
Operating System: N/A

Description

Create a trigger that would allow curators to cancel a web order without having to create and cancel a full fledged order_request. The web_order_request_action table is the most likely candidate to trigger the cancel action. Could be used directly by the curator in a web order action dataview or by the Order Wizard through a button as requested in Trac 1360.

Change History (6)

comment:1 by Kurt Endress, 10 years ago

Loaded get_web_order_request_action_20170411.dataview on npgsdev for testing trigger.

comment:2 by Kurt Endress, 10 years ago

Enabled trigger on web_order_request_action on npgsdev for testing

INSERT INTO sys_datatrigger
VALUES (
NULL, 184
, '~/bin/GrinGlobal.NPGSDataTriggers.dll'
, 'GrinGlobal.NPGSDataTriggers'
, 'GrinGlobal.NPGSDataTriggers.WebOrderRequestActionDataTrigger'
,'Y', 'N', 0, GETUTCDATE(), 48, NULL, NULL, GETUTCDATE(), 48
)

comment:3 by Kurt Endress, 10 years ago

New trigger on web_order_request placed on npgsdev for testing

INSERT INTO sys_datatrigger
VALUES (
NULL, 183
, '~/bin/GrinGlobal.NPGSDataTriggers.dll'
, 'GrinGlobal.NPGSDataTriggers'
, 'GrinGlobal.NPGSDataTriggers.WebOrderRequestDataTrigger'
,'Y', 'N', 0, GETUTCDATE(), 48, NULL, NULL, GETUTCDATE(), 48
)

comment:4 by Kurt Endress, 10 years ago

dropped FK constraint on npgsdev so CT can modify web orders
ALTER TABLE [dbo].[web_order_request] DROP CONSTRAINT [fk_wor_modified]

created MANAGE_WEB_ORDER_REQUEST permission to allow updates to all rows

comment:5 by Kurt Endress, 9 years ago

Resolution: → fixed
Status: new → closed

Included in 1.9.9.2 build released to production.

comment:6 by Kurt Endress, 7 years ago

To clarify, the trigger was made on the web order request table and not the action. It fires when the status code is set to CANCELED. It cancels only the items for accessions belonging to the site of the person making the change. That person must have their cooperator linked to a web_cooperator so the modified by can be reset to a web_user_id.

The trigger makes changes to three tables:

  • Updates Web_order_request_item status_code field to CANCEL for any items for accessions owned by the site of the person making the change
  • Creates a web_order_request_action record in the form: x items canceled by maintenance site y
  • Updates the web_order_request.status_code to one of: MIXED, CANCELED, SUBMITTED, ACCEPTED depending in the status mix of the items and fixes the modified_by field to be the person’s web_user_id instead of cooperator_id
Note: See TracTickets for help on using tickets.