Добавить доп. свойство клиентов, идентификатор Order_MX, с единственным значением 'Да'.
На нужных контрагентах выставить его.
Для нужных должностей включить проверку.
Код примерно такой
Код:
CREATE OR REPLACE PROCEDURE SUPERMAG.USR_INSPECT_1101 (
indoctype IN smdocuments.doctype%TYPE,
indocid IN smdocuments.id%TYPE,
inoldstate IN smdocuments.docstate%TYPE := NULL,
innewstate IN smdocuments.docstate%TYPE := NULL,
indummy IN core.smbool := NULL )
IS
INSPECT_ID supermag.ttinspectresbuffer.inspectid%TYPE := 1101;
PROP_SUPPLIER supermag.smclientproperties.propid%TYPE := 'Order_MX';
BEGIN
INSPECT.ONSTARTTRANS;
INSERT INTO supermag.ttinspectresbuffer
(inspectid, errid, inspectname, errtext)
SELECT DISTINCT INSPECT_ID, 0, TO_CHAR(INSPECT_ID),
SUBSTR('Не разрешено изменение заказа на контрагента №' || to_char(clientindex), 1, 255)
FROM ( SELECT d.clientindex
FROM supermag.smdocuments d, supermag.smclientproperties p
WHERE d.doctype=indoctype AND d.id=indocid AND d.doctype='OR'
AND d.clientindex=p.idclient(+) AND p.propid(+)=PROP_SUPPLIER AND P.PROPVAL IS NULL
);
INSPECT.SETFUNCNAME(INSPECT_ID);
END USR_INSPECT_1101;
/
-- для документов 'OR', при смене статусов 1-2-3, по умолчанию проверка у всех отключена
DECLARE
INSPECT_ID supermag.ssinspectfunc.id%TYPE := 1101;
INSPECT_NAME supermag.ssinspectfunc.name%TYPE := 'Пользовательская проверка 1101';
INSPECT_ORANAME supermag.ssinspectdoc.inspectoraname%TYPE := 'SUPERMAG.USR_INSPECT_1101';
INSPECT_DEFMODE supermag.ssinspectfunc.definspectmode%TYPE := 0;
BEGIN
insert into ssinspectfunc(id, name, definspectmode)
values (INSPECT_ID, INSPECT_NAME, INSPECT_DEFMODE);
insert into ssinspectdoc (doctype, docstate, docstatebefore, inspectid, inspectoraname, dobefore)
values ('OR', 2, 1, INSPECT_ID, INSPECT_ORANAME, 1);
insert into ssinspectdoc (doctype, docstate, docstatebefore, inspectid, inspectoraname, dobefore)
values ('OR', 3, 2, INSPECT_ID, INSPECT_ORANAME, 1);
insert into ssinspectdoc (doctype, docstate, docstatebefore, inspectid, inspectoraname, dobefore)
values ('OR', 1, 2, INSPECT_ID, INSPECT_ORANAME, 1);
insert into ssinspectdoc (doctype, docstate, docstatebefore, inspectid, inspectoraname, dobefore)
values ('OR', 2, 3, INSPECT_ID, INSPECT_ORANAME, 1);
commit;
END;
/