11 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
	
| {
 | |
|     "header": {
 | |
|         "version": 1,
 | |
|         "type": "record"
 | |
|     },
 | |
|     "body": {
 | |
|         "record1": {
 | |
|             "<1>": "declare subroutine forward_event, security_err_msg\r\ndeclare function rowexists, security_check, end_window, post_event, fieldcount, scroll_enable\r\n\r\n$insert logical\r\n$insert security_rights_equ\r\nNewRecord = false$\r\nif rowexists( 'NAMES', .seq->text ) then\r\n   ReadOk = true$\r\nend else\r\n   * user is trying to add new do they have the rights\r\n   if security_check( 'Names', Write$ ) then\r\n      ReadOk = true$\r\n   end else\r\n      security_err_msg( 'Names', Write$ )\r\n      ReadOk = false$\r\n      Void = post_event( CtrlEntId, 'CLOSE' )\r\n      *Void = end_window( @window, '' ) \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 ;*  QBF meaning the read already took place\r\n        forward_event()\r\n    end\r\n\tif .co_id->text = '' then\r\n\t   .co_id->text = .co_id->misc\r\n\tend\r\n\tif RowExists( 'NAMES', .seq->text ) then\r\n\t   .co_id->text = .co_id->misc\r\n\tend else \r\n\t   .entry_id->text = oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )\r\n\t   .entry_date->text = oconv( date(), 'D2/' )\r\n\tend\r\n    ProtectVar = 'ENTRY_ID/ENTRY_DATE/ACCT_REP'\r\n    swap '/' with @rm:@window:'.' in ProtectVar\r\n    ProtectVar = @window:'.':ProtectVar\r\n    Void = set_property( ProtectVar, 'ENABLED', 0 )\t\r\n\tif NewRecord else\r\n\t   if security_check( 'Names', 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<i>\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\tend\r\nend\r\nRETURN 0"
 | |
|         }
 | |
|     }
 | |
| } |