{ "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, scroll_enable\r\n$insert logical\r\n$insert security_rights_equ\r\n$insert msg_equates\r\n\r\n\r\nNewRecord = false$\r\nif rowexists( 'COC', .coc_no->text ) then\r\n ReadOk = true$\r\nend else\r\n * user is trying to add new don't allow ( only create via order )\r\n MsgInfo = ''\r\n MsgInfo = 'COC records are only created when shipping.'\r\n MsgInfo = 'H'\r\n Void = msg( '', MsgInfo )\t \r\n ReadOk = false$\r\n .coc_no->text = ''\r\n Void = post_event( CtrlEntId, 'CLEAR', False$, 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 COCNo = .coc_no->text\r\n ProtectVar = 'ENTRY_ID/ENTRY_DATE/CUST_NO/CUST_NAME/DIVISION/'\r\n ProtectVar:= 'PO/WO/SHIPMENT'\r\n swap '/' with @rm:@window:'.' in ProtectVar\r\n ProtectVar = @window:'.':ProtectVar\r\n Void = set_property( ProtectVar, 'ENABLED', 0 ) \r\n * add all other protected fields\r\n if rowexists( 'COC', COCNo ) 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 if NewRecord else\r\n\t if security_check( 'COC', Edit$ ) else\r\n\t * protect all fields\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\r\n\t if ThisControl[-6,6] = '_LABEL' or index( ThisControl, 'MENU', 1 ) or index( ThisControl, 'TEXT', 1 ) else\r\n\t void = set_property( ThisControl, 'ENABLED', 0 )\r\n\t end \r\n\t next i \r\n\t Void = scroll_enable()\t\t \r\n\t end\r\n end\r\nend\r\nRETURN 0" } } }