You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It will be great to implement UUID invoice and adding a hook to prevent modification of the invoice as longe as it is approved.
Use case
To implement UUID in the Dolibarr invoice module, you can use the casting feature to ensure unique identifiers for invoices. For preventing modifications to approved invoices, you can add a hook in the module's code. Refer to the Dolibarr hooks documentation for guidance on integrating hooks effectively. Implementing UUID in Dolibarr Invoice Module
UUID Generation:
Use PHP's ramsey/uuid library to generate a universally unique identifier (UUID) for each invoice.
Ensure that the UUID is stored in the database alongside the invoice data.
Database Modification:
Add a new column in the invoice table to store the UUID.
Update the invoice creation process to include the generation and storage of the UUID.
Adding a Hook to Prevent Modifications
Suggested implementation
Hook Creation:
Create a custom hook in the invoice module that checks the status of the invoice.
The hook should be triggered on any attempt to modify an invoice.
Modification Prevention Logic:
Implement logic within the hook to check if the invoice status is "approved."
If the invoice is approved, prevent any modifications and return an appropriate error message.
Suggested steps
Implementation Steps
Install UUID Library:
Use Composer to install the ramsey/uuid library in your Dolibarr environment.
Modify Invoice Table:
Execute SQL commands to add a UUID column to the invoice table.
Update Invoice Creation Logic:
Modify the invoice creation function to generate and save the UUID.
Create the Hook:
Define a new hook function in the invoice module that checks the invoice status before allowing modifications.
Testing:
Test the functionality by creating invoices, approving them, and attempting to modify them to ensure the hook works as intended.
Documentation:
Document the changes made to the module for future reference and maintenance.
The text was updated successfully, but these errors were encountered:
Feature Request
It will be great to implement UUID invoice and adding a hook to prevent modification of the invoice as longe as it is approved.
Use case
To implement UUID in the Dolibarr invoice module, you can use the casting feature to ensure unique identifiers for invoices. For preventing modifications to approved invoices, you can add a hook in the module's code. Refer to the Dolibarr hooks documentation for guidance on integrating hooks effectively. Implementing UUID in Dolibarr Invoice Module
UUID Generation:
Use PHP's ramsey/uuid library to generate a universally unique identifier (UUID) for each invoice.
Ensure that the UUID is stored in the database alongside the invoice data.
Database Modification:
Add a new column in the invoice table to store the UUID.
Update the invoice creation process to include the generation and storage of the UUID.
Adding a Hook to Prevent Modifications
Suggested implementation
Hook Creation:
Create a custom hook in the invoice module that checks the status of the invoice.
The hook should be triggered on any attempt to modify an invoice.
Modification Prevention Logic:
Implement logic within the hook to check if the invoice status is "approved."
If the invoice is approved, prevent any modifications and return an appropriate error message.
Suggested steps
Implementation Steps
Install UUID Library:
Use Composer to install the ramsey/uuid library in your Dolibarr environment.
Modify Invoice Table:
Execute SQL commands to add a UUID column to the invoice table.
Update Invoice Creation Logic:
Modify the invoice creation function to generate and save the UUID.
Create the Hook:
Define a new hook function in the invoice module that checks the invoice status before allowing modifications.
Testing:
Test the functionality by creating invoices, approving them, and attempting to modify them to ensure the hook works as intended.
Documentation:
Document the changes made to the module for future reference and maintenance.
The text was updated successfully, but these errors were encountered: