License

The context class contains a set of methods used to handle the rights granted by the license.

1. How Sage X3 manages the license

The main principles of license management are:
* In order to be granted the right to run the V12 platform, you must have at least a license file associated to a policy file:
* the policy file defines a set of elements which use can be controlled;
* the license file defines the authorizations granted to the user for every element listed in the policy file.
* Additional license files can be installed, for instance, to grant rights to specific or vertical extensions as well as to other product lines.
* The authorization depends on the folder as well as on the user's role operating the connection.
* A user can access the current license rights through a dedicated administration function.
* A developer has access to all these licensed elements in order to know if a given resource can be used without exceeding the granted rights.

2. Methods to access to the license information

The following table describes the context methods available

Element Method code Parameters Return
Activity code AGETLICACV activity code (Char)
  • [V]CST_ATRUE: the activity code can be activated
  • [V]CST_AFALSE: the activity code cannot be activated
Function AGETLICFCT function code (Char)
  • [V]CST_ATRUE: the function can be used
  • [V]CST_AFALSE: the function cannot be used
Parameter kit AGETLICKIT parameter kit (Char)
  • [V]CST_ATRUE: the parameter kit can be installed
  • [V]CST_AFALSE: the parameter kit cannot be installed
Language AGETLICLAN language code (Char)
  • [V]CST_ATRUE: the user can connect with the language code
  • [V]CST_AFALSE: the user cannot connect with the language code
Legislation AGETLICLEG legislation code (Char)
  • [V]CST_ATRUE: the user can use functions dedicated to the legislation
  • [V]CST_AFALSE: the user cannot use functions dedicated to the legislation
Modules AGETLICMOD module (Integer)
  • [V]CST_ATRUE: the user can use functions belonging to the module
  • [V]CST_AFALSE: the user cannot use functions belonging to the module
Parameter values AGETLICPAR parameter code (Char)
parameter value returned (Char)
  • [V]CST_ATRUE: the parameter is controlled by the license
  • [V]CST_AFALSE: the parameter is not controlled by the license the parameter value is not filled
License files AGETLICLIC product code(Char)
  • [V]CST_ATRUE: the license file exists for the product code.
  • [V]CST_AFALSE: the license file does not exist for the product code
License files AGETLICEXPIRED product code(Char)
  • [V]CST_ATRUE: the license is expired for the product code
  • [V]CST_AFALSE: the license file is not expired for the product code
Partner ID in license file AGETLIC_PARTNERID product code(Char)
  • Returns the partner ID code associated with the product code
Product version in license file AGETLIC_PRODUCTVER product code(Char)
  • Returns the version number associated with the product code
Policy code in license file AGETLIC_POLICYCODE product code(Char)
  • Returns the policy code associated with the product code
Policy version in license file AGETLIC_POLICYVER product code(Char)
  • Returns the policy version associated with the product code
Serial number in license file AGETLIC_SERIAL product code(Char)
  • Returns the serial number associated with the product code

Note: The authorization on a resource is granted if one of the following conditions is fulfilled:
* The policy file does not define the resource as controlled.
* The policy file includes a control on the resource and the license file grants the right on it.

3. Examples

  # A Sales order related function can be called only if GESSOH is authorized by the license.
  If fmet this.ACTX.AGETLICFCT("GESSOH")=[V]CST_ATRUE
    OK=fmet this.GENERATE_SALESORDER
  Endif
  # A Serial number control can be called only if SER activity code is authorized by the license.
  If fmet this.ACTX.AGETLICACT("SER")=[V]CST_ATRUE
    Gosub CONTROL_SERIAL_NUMBER
  Endif
  # Is the Spanish legislation code allowed?
  If fmet this.ACTX.AGETLICLEG("SPA")=[V]CST_ATRUE
    Call IVA_SPAIN
  Endif
  # Is there a valid license file for the vertical "MYV" ?
  # If yes, allow execution in read-only mode if expired, otherwise allow full execution
  If fmet this.ACTX.AGETLICLIC("MYV")=[V]CST_ATRUE
    If fmet this.ACTX.AGETLIC_EXPIRED("MYV")=[V]CST_ATRUE
      RETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"READONLY")
    Else
      RETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"UPDATE")
    Endif
  Endif
  # How many fixed assets can be created according to the license ?
  Local Integer OK, MAXASSETS
  Local Char RET_VAL(20)
  OK=fmet this.ACTX.AGETLICPAR("MAXFIXEDASSETS",RET_VAL)
  If OK=[V]CST_ATRUE
    MAXASSETS=val(RET_VAL)
  Else
    MAXASSETS=0
  Endif
  # Build a message with the characteristics of a product
  Local Char MESSAGE_LICENCE(200),PROD(20)
  PROD="MY_VERT"
  MESSAGE_LICENSE="Licence #"-fmet this.ACTX.AGETLIC_SERIAL(PROD)
  &              -"granted by"-fmet this.ACTX.AGETLIC_PARTNERID(PROD)
  &              -"for version"-fmet this.ACTX.AGETLIC_PRODUCTVER(PROD)
  &              -"with policy code equal to"-fmet this.ACTX.AGETLIC_POLICYCODE(PROD)
  &              -"(rev"-fmet this.ACTX.AGETLIC_POLICYVER(PROD)+")"
  #
  # Returns : Licence #314159 granted by SOFT_VERTICAL for version 2.72 with policy code equal to VERT (rev 2)
  #
  # If the licence file contains the following lines:
  #     {
  #         "partnerId": "SOFT_VERTICAL",
  #         "productCode": "MY_VERT",
  #         "productVersion": "2.72",
  #         "policyCode": "VERT",
  #         "policyVersion": "2",
  #         "serial": "314159"
  #     }