As the authorisation of work tasks is possible in two screens (PREPARE WORK ORDER and WORK TASK TRANSACTION), the authorisation is carried out differently.
In the PREPARE WORK ORDER screen, the Jt_Task_Transaction_API.Authorize function is executed; in the WORK TASK TRANSACTION screen, the Authorise__ function with the 'CHECK' parameter is executed first.
If my event is called from the PREPARE WORK ORDER screen, my programming works, from the other window does not work. This is because the new status "Authorised" is already saved in the NEW:ROWSTATE variable in the PREPARE WORK ORDER screen, but not in the other case. There it is still "Reported".
Is there a way to find out where the event is being called from?
Here is my script in the event:
IF '&NEW:ROWSTATE' <> 'AUTHORIZED' AND '&NEW:ROWSTATE' <> 'TRANSFERRED' AND NOT ('&OLD:ROWSTATE' = 'AUTHORIZED' AND '&NEW:ROWSTATE' = 'REPORTED') THEN
IF time_pers_diary_api.Is_Transferred('&NEW:COMPANY', '&NEW:EMPLOYEE_ID',
to_date('&NEW:TRANSACTION_DATE', 'YYYY-MM-DD')) = 1 THEN
send_email('ATTENTION! - The day is already transferred.CHANGE is not
possible');
IFSAPP.ERROR_SYS.Record_General('ATTENTION! ', ' - The day is already transferred.
CHANGE is not possible');
ELSIF time_pers_diary_api.Is_Authorized('&NEW:COMPANY', '&NEW:EMPLOYEE_ID',
to_date('&NEW:TRANSACTION_DATE', 'YYYY-MM-DD')) = 1 THEN
send_email('ATTENTION! - The day is already authorised. CHANGE is not
possible');
IFSAPP.ERROR_SYS.Record_General('ATTENTION! ', ' - The day is already authorised -
CHANGE is not possible');
ELSIF time_pers_diary_api.Is_Confirmed('&NEW:COMPANY', '&NEW:EMPLOYEE_ID',
to_date('&NEW:TRANSACTION_DATE', 'YYYY-MM-DD')) = 1 THEN
send_email('ATTENTION! - The day is already confirmed. CHANGE is not
possible');
IFSAPP.ERROR_SYS.Record_General('ATTENTION! ', ' - The day is already confirmed.
CHANGE is not possible');
END IF;
END IF;