open-insight/LSL2/OIEVENT/READ/SPC_EVAL_ADE..json
2024-03-25 15:12:53 -07:00

11 lines
2.8 KiB
JSON

{
"header": {
"version": 1,
"type": "record"
},
"body": {
"record1": {
"<1>": "declare subroutine forward_event, security_err_msg\r\ndeclare function company_comm, msg, security_check, post_event, rowexists\r\ndeclare function fieldcount, send_event, scroll_enable\r\n$insert logical\r\n$insert security_rights_equ\r\n\r\n\r\nNewRecord = false$\r\nif rowexists( 'SPC_EVAL_ADE', .control_id->text ) then\r\n ReadOk = true$\r\nend else\r\n * user is trying to add new do they have write rights\r\n if security_check( 'SPC Eval ADE', Write$ ) then\r\n ReadOk = true$ \r\n end else\r\n security_err_msg( 'SPC Eval ADE', Write$ )\t \r\n\t ReadOk = false$\r\n\t .control_id->text = ''\r\n\t Void = post_event( CtrlEntId, 'CLEAR', False$, True$ )\r\n end\r\n NewRecord = true$\r\nend\r\nif ReadOk then\r\n if get_property( @window, '@NoRead' ) then\r\n Void = set_property( @window, '@NoRead', 0 )\r\n end else\r\n * no qbf active do the read\r\n * if it is active the read already took place\r\n forward_event()\r\n end\r\n ControlId = .control_id->text\r\n ProtectVar = 'ENTRY_ID/ENTRY_DATE/TERM_NO/TECH_SIG/TECH_SIG_NAME'\r\n swap '/' with @rm:@window:'.' in ProtectVar\r\n ProtectVar = @window:'.':ProtectVar\r\n Void = set_property( ProtectVar, 'ENABLED', 0 )\r\n if rowexists( 'SPC_EVAL_ADE', ControlId ) else\r\n .entry_id->text = oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )\r\n .entry_date->text = oconv( date(), 'D2/' ) \r\n end \r\n \r\n if NewRecord else\r\n\t *if security_check( 'SPC Eval ADE', Edit$ ) else\r\n\t * PROTECT ALL FIELDS EVEN IF THEY HAVE EDIT RIGHTS\r\n\t * CAUSE WE DO NOT WANT ANYTHING CHANGED ONCE SAVED\r\n\t * IF THE USER MADE A MISTAKE THEN THE USER WILL HAVE\r\n\t * TO DELETE AND START OVER\r\n\t * so rem the if above out and end at the bottom\r\n\t * protect all fields\r\n * ALLOW THE KEY FIELD TO BE ENABLED \t \t \r\n\t AllControls = utility( 'OBJECTLIST', @window, '' )\r\n\t Acnt = fieldcount( AllControls, @fm ) \r\n\t for i = 1 to Acnt \r\n\t ThisControl = AllControls<i>\r\n\t if index( ThisControl, 'COMMENTS', 1 ) or index( ThisControl, 'CONTROL_ID', 1 ) or ThisControl[-6,6] = '_LABEL' or index( ThisControl, 'MENU', 1 ) or index( ThisControl, 'TEXT', 1 ) else\r\n\t if index( ThisControl, 'PHX', 1 ) or index( ThisControl, 'BTN_GRP', 1 ) else\r\n\t \t void = set_property( ThisControl, 'ENABLED', 0 )\r\n\t \tend\r\n\t end \r\n\t next i \r\n *Void = scroll_enable()\t \t \t \r\n\t *end\r\n end\r\nend\r\nRETURN 0\r\n"
}
}
}