Описание
(Нет описания для триггера IT_SetOwnerAndProvider)
Определение
CREATE TRIGGER "IT_SetOwnerAndProvider" FOR IT
ACTIVE AFTER INSERT OR UPDATE POSITION 0
AS
begin
if (new.operationid not in (5, 17, 49, 50, 51, 53, 29, 12, 31, 54, 41, 22, 23, 4)
and new.parentid <= 0
and new.InvoiceID is not null
and new.state <> -100)
then
update IT set OwnerID = new.OwnerID, providerid = new.ProviderID
where IT.invoiceid = new.invoiceid
-- and IT.parentid <= 0
and (OwnerID <> new.OwnerID or ProviderID <> new.ProviderID);
-- and IT.InventoryID <> new.InventoryID
end