|
dolibarr 25.0.0-alpha
|
Class ToolInvoices. More...


Public Member Functions | |
| __construct (DoliDB $db, $user=null, $conf=null) | |
| Constructor. | |
| getDefinitions () | |
| Returns an array of tool definitions, including name, description, and input schema. | |
| getCategories () | |
| Return categories this tool belongs to. | |
| execute (string $name, array $args) | |
| Executes the requested tool function based on its name. | |
Public Member Functions inherited from McpTool | |
| __construct ($db, $user, $conf) | |
| Constructor. | |
| isSystem () | |
| Return true if this is a system/infrastructure tool that must always remain visible and executable regardless of the admin allow-list. | |
Private Member Functions | |
| getUser () | |
| Return the authenticated user, preferring DI ($this->user) and falling back to global $user. | |
| searchInvoices ($args) | |
| Search invoices based on filters. | |
| getInvoice ($args) | |
| Get full invoice details. | |
| validateInvoice ($args) | |
| Validate a draft invoice. | |
| payInvoice ($args) | |
| Register a payment on an invoice. | |
| findCustomer ($identifier) | |
| Find a customer by identifier. | |
| findInvoice ($identifier) | |
| Find an invoice by identifier. | |
| findBankAccount ($identifier) | |
| Find a bank account. | |
Class ToolInvoices.
Provides various tools related to Dolibarr invoices.
Definition at line 38 of file invoices.class.php.
| ToolInvoices::__construct | ( | DoliDB | $db, |
| $user = null, | |||
| $conf = null ) |
Constructor.
Aligned with McpHandler's instantiation contract: new $className($db, $user, $conf).
| DoliDB | $db | Database handler |
| User | null | $user | Service user provided by McpHandler (from AI_MCP_USER_ID) |
| Conf | null | $conf | Dolibarr config (optional) |
Definition at line 50 of file invoices.class.php.
| ToolInvoices::execute | ( | string | $name, |
| array | $args ) |
Executes the requested tool function based on its name.
| string | $name | The name of the tool to execute. |
| array<string,mixed> | $args The arguments for the tool (key-value pairs). |
Reimplemented from McpTool.
Definition at line 168 of file invoices.class.php.
References getInvoice(), payInvoice(), searchInvoices(), and validateInvoice().
|
private |
Find a bank account.
| string | int | $identifier | Bank account id, ref or label |
Definition at line 547 of file invoices.class.php.
References getEntity().
Referenced by payInvoice().
|
private |
Find a customer by identifier.
| string | $identifier | ID, ref, code or name |
Definition at line 450 of file invoices.class.php.
References getEntity().
Referenced by searchInvoices().
|
private |
Find an invoice by identifier.
| string | int | $identifier | Invoice ID or ref |
Definition at line 519 of file invoices.class.php.
Referenced by getInvoice(), payInvoice(), and validateInvoice().
| ToolInvoices::getCategories | ( | ) |
Return categories this tool belongs to.
Used by the intent parser to filter available tools.
Reimplemented from McpTool.
Definition at line 156 of file invoices.class.php.
| ToolInvoices::getDefinitions | ( | ) |
Returns an array of tool definitions, including name, description, and input schema.
Reimplemented from McpTool.
Definition at line 81 of file invoices.class.php.
|
private |
Get full invoice details.
| array<string,mixed> | $args Input parameters (ref or id) |
Definition at line 293 of file invoices.class.php.
References $id, dol_html_entity_decode(), dol_print_date(), findInvoice(), and price().
Referenced by execute().
|
private |
Return the authenticated user, preferring DI ($this->user) and falling back to global $user.
In HTTP MCP context there is no PHP web session — only the service user injected via DI.
Definition at line 65 of file invoices.class.php.
References user.
Referenced by payInvoice(), and validateInvoice().
|
private |
Register a payment on an invoice.
| array<string,mixed> | $args Input parameters (invoice, amount, payment_mode, bank_account) |
Definition at line 381 of file invoices.class.php.
References dol_getIdFromCode(), dol_now(), findBankAccount(), findInvoice(), getUser(), and price().
Referenced by execute().
|
private |
Search invoices based on filters.
| array<string,mixed> | $args Input filters (limit, status, customer) |
Definition at line 196 of file invoices.class.php.
References dol_print_date(), dol_syslog(), findCustomer(), getEntity(), and price().
Referenced by execute().
|
private |
Validate a draft invoice.
| array<string,mixed> | $args Input parameters (invoice ref or id) |
Definition at line 339 of file invoices.class.php.
References findInvoice(), and getUser().
Referenced by execute().