Really, this should be it, for the passing income.
[capital-apms-progress.git] / trigger / wrcontct.p
blob46b804629a478b497fcf3a5d557fd8fb00c1b06b
1 TRIGGER PROCEDURE FOR WRITE OF Contact.
3 /* seems to be a deadlock problem between this and the Person trigger */
4 /* :-( */
5 /* trying again - 7/12/98 */
7 IF NEW( Contact ) THEN DO:
8 DEF VAR system-contact AS LOGI NO-UNDO INITIAL No.
10 DEF BUFFER CtcType FOR ContactType.
11 DEF BUFFER OtherContact FOR Contact.
13 FIND ContactType OF Contact NO-LOCK NO-ERROR.
14 IF AVAILABLE(ContactType) THEN system-contact = ContactType.SystemCode.
16 IF system-contact THEN DO:
17 FOR EACH OtherContact WHERE OtherContact.PersonCode = Contact.PersonCode
18 AND RECID(OtherContact) <> RECID(Contact) NO-LOCK,
19 FIRST CtcType OF OtherContact NO-LOCK:
20 IF NOT CtcType.SystemCode THEN system-contact = No.
21 END.
22 END.
24 FIND Person OF Contact EXCLUSIVE-LOCK NO-ERROR.
25 IF AVAILABLE(Person) THEN ASSIGN
26 Person.SystemContact = system-contact
27 Person.LastModified = TODAY.
29 END.