Custom Events for plugin triggers

- Add custom events for item changes, sales, returns, and inventory.
- Add custom events for item and customer csv imports.

Signed-off-by: objecttothis <objecttothis@gmail.com>
This commit is contained in:
objecttothis
2025-05-29 17:01:45 +04:00
parent e1fedab9b7
commit 6540a4970f

View File

@@ -65,3 +65,51 @@ Events::on('DBQuery', [$db_log, 'db_log_queries']);
$method = new Method();
Events::on('pre_controller', [$method, 'validate_method']);
/**
* This event triggered when an item sale occurs.
* Plugin functionality is triggered here.
*/
Events::on('item_sale', static function (): void {
// Call plugin controller methods to handle the item sale data sent in the static function.
});
/**
* This event triggered when an item return occurs.
* Plugin functionality is triggered here.
*/
Events::on('item_return', static function (): void {
// Call plugin controller methods to handle the item return data sent in the static function.
});
/**
* This event triggered when an item is changed. This can be an item create, update or delete.
* Plugin functionality is triggered here.
*/
Events::on('item_change', static function (): void {
// Call plugin controller methods to handle the item change data sent in the static function.
});
/**
* This event triggered when an item inventory action occurs.
* This can be during a receiving action or the update inventory partial view in items.
*/
Events::on('item_inventory', static function (): void {
// Call plugin controller methods to handle the item inventory data sent in the static function.
});
/**
* This event triggered when an items CSV import occurs.
* Plugin functionality is triggered here.
*/
Events::on('items_csv_import', static function (): void {
// Call plugin controller methods to handle the items CSV import data sent in the static function.
});
/**
* This event triggered when a customers CSV import occurs.
* Plugin functionality is triggered here.
*/
Events::on('customers_csv_import', static function (): void {
// Call plugin controller methods to handle the customers CSV import data sent in the static function.
});