1 TRIGGER PROCEDURE FOR WRITE OF RentalSpace
OLD BUFFER old-RSP.
3 {inc
/audit.i
"RentalSpace"}
5 /* If this area changes from Vacant to Leased then...
*/
6 IF (RentalSpace.AreaStatus
= "L" AND old-RSP.AreaStatus
<> "L")
7 OR (old-RSP.TenancyLeaseCode
<> RentalSpace.TenancyLeaseCode
)
9 ON WRITE OF RentalSpace
OVERRIDE DO: END.
10 ON WRITE OF TenancyLease
OVERRIDE DO: END.
11 FIND TenancyLease
OF RentalSpace
EXCLUSIVE-LOCK NO-ERROR.
12 IF AVAILABLE(TenancyLease
) AND TenancyLease.PropertyCode
<> RentalSpace.PropertyCode
THEN
13 TenancyLease.PropertyCode
= RentalSpace.PropertyCode.
14 ON WRITE OF TenancyLease
REVERT.
15 ON WRITE OF RentalSpace
REVERT.
18 IF /* various changes requiring a write of a RentSpaceHistory record
*/
19 RentalSpace.AreaSize
<> Old-RSP.AreaSize
20 OR RentalSpace.AreaStatus
<> Old-RSP.AreaStatus
21 OR RentalSpace.ChargedRental
<> Old-RSP.ChargedRental
22 OR RentalSpace.ContractedRental
<> Old-RSP.ContractedRental
23 OR RentalSpace.Description
<> Old-RSP.Description
24 OR RentalSpace.MarketRental
<> Old-RSP.MarketRental
25 OR RentalSpace.MarketRentalDate
<> Old-RSP.MarketRentalDate
26 OR RentalSpace.TenancyLeaseCode
<> Old-RSP.TenancyLeaseCode
28 FIND RentSpaceHistory
WHERE
29 RentSpaceHistory.PropertyCode
= Old-RSP.PropertyCode
30 AND RentSpaceHistory.RentalSpaceCode
= Old-RSP.RentalSpaceCode
31 AND RentSpaceHistory.DateChanged
= TODAY
33 IF NOT AVAILABLE(RentSpaceHistory
) THEN DO:
34 CREATE RentSpaceHistory
NO-ERROR.
36 RentSpaceHistory.PropertyCode
= Old-RSP.PropertyCode
37 RentSpaceHistory.RentalSpaceCode
= Old-RSP.RentalSpaceCode
38 RentSpaceHistory.DateChanged
= TODAY
39 RentSpaceHistory.AreaSize
= Old-RSP.AreaSize
40 RentSpaceHistory.AreaStatus
= Old-RSP.AreaStatus
41 RentSpaceHistory.ChargedRental
= Old-RSP.ChargedRental
42 RentSpaceHistory.ContractedRental
= Old-RSP.ContractedRental
43 RentSpaceHistory.Description
= Old-RSP.Description
44 RentSpaceHistory.MarketRental
= Old-RSP.MarketRental
45 RentSpaceHistory.MarketRentalDate
= Old-RSP.MarketRentalDate
46 RentSpaceHistory.TenancyLeaseCode
= Old-RSP.TenancyLeaseCode