This week we have been configuring our new servers and billing systems with WHMCS. By default WHMCS creates an account and assigns a numerical number to each client. This would not normally be an issue however, we use several different systems for accounting, billing and mailings. We have tried to adopt a system of tracking our client correspondence through a unique reference code which is present in both the Sage accounting package and KashFlow.
Whilst on my quest to to see if there was already a plugin available (in an effort to save some time) I came across several other WHMCS users that also required a similar solution.
I took a quick look at the documentation and it became apparent that building a hook to do exactly what i needed was a relatively straight forward task. The result would be a unique six character account reference which is generated automatically from either the company name or surname.
e.g. if we have a client called “Facebook” and another called “Facebook’s” the two references created would be FACE01 and FACE02 respectively.
The code below could be a little more compressed however, I decided that i would write this hook so that others may follow the workflow and amend it for their own use.
The system works flawlessly for us and we are now able to pull the custom field from the account page straight into the invoice as a payment / account ref.