Ordinarily, yes you would put changes into custom. However there’s no way I know of to customise a bean in an upgrade safe manner. Just be aware that if you upgrade SuiteCRM you may lose your changes to that file.
I’m not sure I agree with the change you made however since it allows duplicate invoice numbers.
I.e.
number | deleted
1 | 0
2 | 1
3 | 0
4 | 0
would give the next invoice a number of 4 even though it’s taken and not deleted.
I’ve made this modification to have possibility to delete invoices (in special situations) and stay numeration correct - one after the other in invoices. Once deleted document will not be restored.
Unfortunately the problem with duplicated numbers I saw in my test instance too, but only when the modificated file was in sugarcrm\custom\modules\AOS_Invoices folder. When I made it in original folder sugarcrm\modules\AOS_Invoices everything looks fine… I’m not sure why? That’s why I asked for a location on forum.
If the file you’ve changed is modules/AOS_Invoices/AOS_Invoices.php then placing a file in custom/modules/AOS_Invoices/AOS_Invoices.php should have no effect - SuiteCRM wont check this for bean definitions unless you add customisations to use this bean.
I have had to do something similar before, rather than modifying the number I created a custom field and set it with a logic hook, overall I found it to be an easier way to have an upgrade safe method of assigning invoice numbers. Also helpful if you want to have an alphanumeric system (or have an existing system you would like to match).
Hi hnsoftwareconsulting, you could have more detail of the changes you’ve implemented?
I would use just such a thing. The number of the invoice that creates SuiteCRM would add the current year (eg invoice no. 00001/2015).
Then I would know how to behave when it starts the new year to resume numbering from n. 00001/2016.
Thank you very much for your support
I am sorry for the very late reply, I have been on hiatus from work.
If you still need help I can find a code example for you to use. If you are reasonably familiar with logic hooks I can just lay out the basic steps for this functionality.
Create a custom field to hold the new invoice numbering. If you want to have non numeral characters probably use text instead of integer.
Create an after save logic hook for invoices.
In the logic hook add logic which constructs the number (for example query the database where invoice number is like %/2016 to get the highest current and generate the next number).
You will need to read this to acquaint yourself with how to set up a logic hook. The logic for setting the invoice number will go in the after_save_method.
When I have a moment I will see if I can find an example that should work for you.