generate/cbs2.gif Log-in Hook (R-SECLOG.MAC) generate/enh74c.jpg


 

The script file must be located in your CAPITAL program directory and must have the file name R-SECLOG.MAC.

It is executed every time a user is logged in or logged out of the system.

Entry Values

Variable

Purpose

DepSet

The department the user is logged into.

LocSet

The location the user is logged into.

LevelSet

The security level of the user. This will be a number between 0-9. You cannot set a security level higher than the user's default security level using this script.

SpoolSet

The name of the Visual Builder printer spool file to use.

PrintSet

This variable contains TRUE if CAPITAL is set to launch Visual Builder if print jobs have been sent by CAPITAL Office.

Comrate->

Fields of the user's Staff Profile, if a Staff Profile record exists for this user.

generate/corporate.jpgThe following entry values are available in the Corporate Edition of CAPITAL Office only:

Variable

Purpose

StockFilter

You may assign this variable a character string value to establish a filter condition for viewing stock records.

CustomerFilter

You may assign this variable a character value to establish a filter condition for viewing customer records.

SupplierFilter

You may assign this variable a character value to establish a filter condition for viewing customer records.

generate/notepad2.gifFor information on defining filter conditions consult the topic: Filter Record Hook.

Return Values

This script does not have a return value, however, you may change any of the entry value variables to a different value. For example:

DepSet := "DEP5"

Will assign the user to the department code "DEP5".

Comments

Use the UserName() function to determine who has logged in inside the script. If the return value is blank, no one is presently logged in because a user has just logged out or has been refused access.

Example #1

The following script sets a Visual Builder spool file based on the user's department code, assigned in the user's Staff Profile. It is assumed that the Visual Builder spool file has already been created matching the department code, and that a Staff Profile already exists for the logged in user.

* Do nothing if a user has logged out

If IsEmpty(UserName())

   Return

Endif

* Comrate->Depuser contains the user default

* department code

If .Not. IsEmpty(Comrate->Depuser)

   SpoolSet := Comrate->Depuser

Else

   Echo("You have not been assigned a department code. Default print spooler has been assigned.")

   SpoolSet := "S0000000"

Endif

Example #2

This example is applicable to the Corporate Edition of CAPITAL Office and applies a filter condition to the stock database. In this case the Location field of the stock database is set to match the user's default department code, if applicable.

* Do nothing if a user has logged out

If IsEmpty(UserName())

   Return

Endif

* Comrate->Depuser contains the user default

* department code

If .Not. IsEmpty(Comrate->Depuser)

   StockFilter := "Location = '" + Comrate->Depuser + "'"

Endif

____________________________

Related Topics:

Filter Record Hook

Record Filters

Scripting Hooks

Script Programming

Security

Staff Profiles, Rates & Commissions



Help Topic Map