dolibarr 25.0.0-alpha
ActionsAi Class Reference

Class ActionsAi. More...

Public Member Functions

 __construct ($db=null)
 Constructor.
 
 addMoreActionsEmailCollector ($parameters, &$object, &$action, $hookmanager)
 Add AI Email Cleaner action in EmailCollector operations.
 
 doCollectImapOneCollector ($parameters, &$object, &$action, $hookmanager)
 Execute AI cleaner when EmailCollector operation type is "hook_ai_emailcleaner".
 
 printFieldListValue ($parameters, &$object, &$action)
 Collect the id of each rendered list row.
 
 printCommonFooter ($parameters, &$object, &$action)
 Emit the current page context for the assistant popover.
 

Detailed Description

Class ActionsAi.

Definition at line 30 of file actions_ai.class.php.

Constructor & Destructor Documentation

◆ __construct()

ActionsAi::__construct ( $db = null)

Constructor.

Parameters
DoliDB | null$dbDatabase handler

Definition at line 52 of file actions_ai.class.php.

Member Function Documentation

◆ addMoreActionsEmailCollector()

ActionsAi::addMoreActionsEmailCollector ( $parameters,
& $object,
& $action,
$hookmanager )

Add AI Email Cleaner action in EmailCollector operations.

Parameters
array<string,mixed>$parameters Hook context parameters
CommonObject$objectEmail collector object
string$actionCurrent action code
HookManager$hookmanagerHook manager
Returns
int

Definition at line 66 of file actions_ai.class.php.

References getDolGlobalInt(), and EmailCleaner\isRuntimeAvailable().

◆ doCollectImapOneCollector()

ActionsAi::doCollectImapOneCollector ( $parameters,
& $object,
& $action,
$hookmanager )

Execute AI cleaner when EmailCollector operation type is "hook_ai_emailcleaner".

Parameters
array<string,mixed>$parameters Hook context parameters
CommonObject$objectEmail collector object
string$actionCurrent action code
HookManager$hookmanagerHook manager
Returns
int

Definition at line 92 of file actions_ai.class.php.

References $object, getDolGlobalInt(), EmailCleaner\isEmailCollectorHookAction(), and EmailCleaner\isRuntimeAvailable().

◆ printCommonFooter()

ActionsAi::printCommonFooter ( $parameters,
& $object,
& $action )

Emit the current page context for the assistant popover.

Runs on every page footer and emits window.aiPageContext, the page identity the chat JS posts back with each request so the assistant resolves references like "this invoice" or "the selected rows".

Three page shapes are recognized:

  • Card/tab pages: the loaded main object (element, id, ref, thirdparty id) - only data the page itself already displays, since the page enforces its reading rights before this hook fires.
  • List pages: element, active filters, the row ids the current page renders (printFieldListValue collects them) and the checked ones.
  • Module dashboards and the home page: a whitelisted page label only.

Trust boundary: this emission is a hint, never an authorization. The POST that carries it back is client-controlled, so parse_intent.php re-validates everything independently on every chat request (element whitelist, fetch, user rights, entity) before any of it reaches the prompt.

Parameters
array<string,mixed>$parameters Hook parameters
CommonObject | null$objectCurrent object, when the page sets one
string$actionCurrent action
Returns
int 0 on success

Definition at line 184 of file actions_ai.class.php.

References $conf, $context, $object, dol_string_nohtmltag(), getDolGlobalString(), getNonce(), and isModEnabled().

◆ printFieldListValue()

ActionsAi::printFieldListValue ( $parameters,
& $object,
& $action )

Collect the id of each rendered list row.

printFieldListValue is an existing hook fired once per row inside every standard list loop, the HookManager reuses this instance for the whole request, so the ids accumulate here and printCommonFooter (which fires later on the same page) emits them.

Parameters
array<string,mixed>$parameters Hook parameters ('obj' = row)
CommonObject$objectPage object
string$actionCurrent action
Returns
int 0

Definition at line 143 of file actions_ai.class.php.


The documentation for this class was generated from the following file: