Jump to content
ju5t

Accounting software integration

Recommended Posts

Everyone knows that WHMCS isn't meant to be or to replace your accounting software. There is no place for purchase orders, ledgers and other important aspects of accounting in WHMCS.

Just to be sure, I'm not asking for it either.

But I was thinking, would it be useful if WHMCS stores some data outside the WHMCS database? Invoices for example. If we could store invoices elsewhere and use that as the source of truth that would be helpful for some companies. I still want customers to manage and pay their invoices online from within WHMCS, it would just get its invoice data from somewhere else. You could make your own invoice page instead but that could affect automation settings or potentially stop from working and I don't want that.

From a technical point of view we would like to override the WHMCS\Billing\Invoice class and implement the relevant methods for each action (e.g. ::find(100) should search the API of your accounting software instead of the database). A list of the methods it calls throughout WHMCS would help. If you decide to override WHMCS\Billing\Invoice and have other modules that depend on tblinvoices those other modules would be incompatible. I see the risk in that but if you don't override it everything would stay as it is. 

Before I raise a feature request I was hoping to get some feedback here so I can make the request as detailed as possible.

Share this post


Link to post
Share on other sites
2 hours ago, ju5t said:

Before I raise a feature request I was hoping to get some feedback here so I can make the request as detailed as possible.

not wishing to discourage you from posting a request, but be aware that WHMCS can take 5+ years to implement feature requests - so don't be expecting a quick development timetable from them... frankly, if you want/need this soon (e.g., in the next year or two), you'd be better off throwing money towards a developer to do this.

if you do post the request, remember to the post its URL here - otherwise, the chances are no other users will a) see it, b) vote for it or c) WHMCS develop it.

Share this post


Link to post
Share on other sites

How long it takes for WHMCS to implement feature requests is besides the point.

It's impossible for a developer to write this without the ability to override WHMCS\Billing\Invoice. Extending this class is not enough. We could throw development time at it but it would never integrate as neatly as I'm proposing.

Share this post


Link to post
Share on other sites
5 minutes ago, ju5t said:

How long it takes for WHMCS to implement feature requests is besides the point.

not if you're submitting one - I would have thought it was highly pertinent! waiting.gif

7 minutes ago, ju5t said:

It's impossible for a developer to write this without the ability to override WHMCS\Billing\Invoice. Extending this class is not enough. We could throw development time at it but it would never integrate as neatly as I'm proposing.

let's see how many votes it receives and how long it remains "under consideration". 🙂

Share this post


Link to post
Share on other sites
10 minutes ago, ju5t said:

And replies like this kill discussions before they even start. Thanks.

yeah shoot the messenger - I was only trying to help, but if you really feel that i'm suppressing some lively exciting debate on this topic, then i'm more than happy to remove my posts from this thread if you want me to.

Share this post


Link to post
Share on other sites

@ju5t, maybe it's easier to replicate invoice data in an external table or database using hooks.

For example, every time an invoice is created, run a script.
Or everytime an invoice is modified or deleted, run another script.

Those scripts will receive all invoice data and you will be able to do what you want, like storing them in another place.

Quick, easy and update-safe 😄

Share this post


Link to post
Share on other sites

@brian! I know the pace at which WHMCS picks up feature requests. And I've seen you saying it to lots of people before too. I know you're trying to help (and frankly, I've seen awesome suggestions from you before) but in this case I'm not after 'hey WHMCS is pretty * when it comes to feature requests'. I just thought about something that could help us as a company and before I even bother to open a request, I thought I'd try it from a different angle and ask some people here first.

@egrueda that's what we do at the moment, or similar at least. And you're 100% right that it's quick and easy.

It has a few downsides.

For example, you have to keep track of which invoice in your accounts belongs to an invoice in WHMCS. You could solve this by setting the `invoicenum` field in the database with the invoice id generated by your accounting software I guess but you would all sorts of hooks to make it clean (e.g. change it before the email goes out, etc.). As you often can't use the original invoice `id` in your accounting software, at least not in the EU as it's not allowed, you don't have much options.

WHMCS makes changes to invoices at unexpected times. This feature would allow give you the opportunity to stop that, e.g. block `save()`-commands on existing invoices. 

Accounting software can process MT940 files. WHMCS can't. This means the old fashioned bank transfer has to be done twice. If you read the invoices from your accounting software in WHMCS, that problem is gone too. 

WHMCS isn't really ahead of the rest when it comes to invoices and accounting. And I completely understand that it's what they do. That's what accounting software is for. But if I want to send a UBL invoice, I can't. It's often the small things that are useful and WHMCS doesn't have them (and probably shouldn't write it either).

Overall it helps to have a single source of truth.

There are definitely downsides of using an API-based invoice model too. Downtime of the API being the biggest one. This is also why hooks aren't the best solution. If the API call fails you've lost that invoice. This is one of the reasons for https://requests.whmcs.com/topic/extend-the-module-queue-to-hooks-and-add-ons (and yea, it doesn't get much traction). The other you pointed out already, updates. Although I don't see much difference in writing hooks and all sorts of calls that depend on the internal structure of WHMCS and writing your own model, but you do have a point. And if not that its complexity would take some interest away.

Share this post


Link to post
Share on other sites
2 minutes ago, ju5t said:

And I've seen you saying it to lots of people before too.

I tend to say it more to newbies to try to dispel their possible delusion that WHMCS is a dynamic responsive company... and that submitting a request is a fast way to get something added to the core program - they're not and it isn't... though I wish the opposite to both were true.

7 minutes ago, ju5t said:

in this case I'm not after 'hey WHMCS is pretty * when it comes to feature requests'.

and i'm supposed to know that ?

almost as bizarre as starting a thread about expanding WHMCS core functionality in a sub-board dedicated to THIRD-PARTY addons! 🙄

anyway, i'll leave all your threads alone in the future.

Share this post


Link to post
Share on other sites

@brian! not sure if you are offended by what I wrote but if you are I'm sorry, it wasn't my intention. In fact I complimented you on how you've helped others. You could consider me a community newbie (point taken about this topic being in the wrong section), but WHMCS definitely isn't. You can't guess that though, I understand. 

Anyway, I guess you aren't very enthusiastic about my suggestion as you didn't comment on it at all, but that is exactly the kind of feedback I was after. I have no problem with 'hey that is a stupid suggestion'. In that case we'll live with the facts and that's it. If not, I'll take the time to gather what people wrote and put it in a feature request. Even if WHMCS doesn't do anything with it, it doesn't hurt to try.

5 minutes ago, brian! said:

anyway, i'll leave all your threads alone in the future.

Fair enough, again, definitely not my intention but it's up to you.

Share this post


Link to post
Share on other sites

I'm working on the invoicing part of WHMCS since 2014 and trust me, it's more complicated than you think. It's not about extending / altering a specific class or using APIs & hooks points. You need way more than that. Actually even though I managed to achieve pretty great results it's not so rewarding and I feel like I'm wasting my time. Investing 2 weeks of development just because WHMCS changed 1 line of code is depressing but that's another story. I digress.

Your solution sadly will not work because you are not considering 1 million of exceptions and the inexplicable flowchart involved in the invoicing process that of course is not the same. There are at least 6 big variations each one with its own further differences. The best advice I can give you is to stay away from this topic unless you are prepared to:

  • Work at least for 6 months if you are very skilled and already know what to do. If you're not well... good luck ⚰️
  • Keep coding non-stop for the rest of your life
  • Be afraid of WHMCS updates, even the smallest one, more than walking on lava

Share this post


Link to post
Share on other sites

I've worked with WHMCS long enough to understand the perks of it. For people it's good to have a mind of their own, for systems, not really. WHMCS does things that it shouldn't do. I'm definitely trying to be an optimist here but a realist probably wouldn't bother discussing this at all.

44 minutes ago, Kian said:

Your solution sadly will not work because you are not considering 1 million of exceptions and the inexplicable flowchart involved in the invoicing process that of course is not the same. There are at least 6 big variations each one with its own further differences. The best advice I can give you is to stay away from this topic unless you are prepared to:

Which solution do you mean? Our current integration or overriding the Invoice-model? Your billing extension is 1000% more extensive than what I was suggesting. You can see the work that has been put into it. 

In essence I want to store invoices elsewhere. I can only assume that each invoice uses the \WHMCS\Billing\Invoice model. This model would have a few methods to initiate a new invoice, save and change it. Of course in reality it will be much more than that. Instead of storing the final result in the database it would be stored elsewhere -- if you could override it completely, that is.

Edited by ju5t

Share this post


Link to post
Share on other sites

I was talking about overriding the invoice class.

50 minutes ago, ju5t said:

In essence I want to store invoices elsewhere. I can only assume that each invoice uses the \WHMCS\Billing\Invoice model. This model would have a few methods to initiate a new invoice, save and change it. Of course in reality it will be much more than that. Instead of storing the final result in the database it would be stored elsewhere -- if you could override it completely, that is.

The question is that we can't even start talking about the difficuly involved in this process because WHMCS\Billing\Invoice class will never be accessible to us and it's probably used/extended in tens of other classes. Don't get me wrong, I understand your point of view but what are the chances of having all these files open source and fully customizable? In the end with a lot of pain you can get the same result using tons of action hooks, APIs and contort queries.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines