Billing Module: 'Item Template', 'Limit Templates' and 'Recurring Items'

Discussion in 'Plugins/Modules/Addons' started by sleepingranch, Jun 1, 2015.

  1. sleepingranch

    sleepingranch New Member

    In the 'settings > item template > connected with client template' , you have this description in the Billing Addon Documentation:
    This selection allows you to connect an item template with an ISPConfig client template. This allows automatic billing of ISPConfig client templates using the Billing Module (optional, only for recurring items). If a client is assigned a new template in the ISPConfig client module, then a recurring item is created automatically in the Billing Module based on the template associated to the field Connected with client template.
    Granted, 'Client-Templates' is now 'Limit-Templates' in the Client module, I am still not enjoying any of the 'automatic' functionality you mention.

    To me, the above Documentation sentence means that if I create both a 'MAIN' and an 'ADDITIONAL' type(s) in the 'Client > Limit Templates' records of the Client module ... and then assign those to the proper 'MASTER' and 'ADDON' template dropdowns in the 'Client > Limits' tab of the Client module (pressing the 'Add Additional Template' button) ... Then I would 'automatically' see those line items built into the Billing module 'recurring item' list; meaning both the 'main' and the 'addon' template would be referenced in the list and a 'Make Invoices' job would build them into one invoice for that client. The term 'Connected with client template' (in the Billing > item template > item) leads me to think that.

    I DO see the 'main' client template get replicated (or 'connected') into the billing>recurring items list - but NOT the addon template. Therefore, the only solution (I see) is to go to the 'billing module > item template' and manually create an 'invoice item template' record for the 'addon' template - making sure to tick the 'recurring', 'shop > Addon' and 'shop > Addon of' boxes. Also, the 'Connected with client template' must be pointed to the correct 'client > additional template' record. This is prone to error.

    If I am correct, the problem this creates is two-fold:
    1. It makes the beautiful Billing Module much harder to understand because it puts doubt into the user's mind as to what should be happening. Half of the process is 'automated' (i.e. the 'main' limit-template being linked into a billing module's recurring item list item of the same name AND associated with the correct client) - ready for the 'Make Invoices' job to build it. But the other half is not! Forcing the user to manually build the 'additional template' in the billing module - which can be linked to the client module 'additional template' of the same name. (FYI: Because you do in fact put a link to it inside the 'Connected with client template' dropdown menu in the billing > item template > item form.) Once manually made this way, the 'additional template' will become listed in the billing module > 'recurring item' list and will be used to create a proper invoice when the 'Make Invoices' job is run - but not until then. For me, this added confusion when learning the ISPConfig billing module system. It seems that either the 'additonal templates' need to be automatically made just like the main template is, or the documentation needs to be more clear about the need to add it manually.
    2. Personally, I do not think ANY 'Client > Limit Templates' should be manually made in the Billing module > Item Template > Invoice Item Template. Once you enable this (manual) ability it then becomes feasible for the billing and client 'Limit Templates' to be different. That opens the possibility for ISPConfig to be billing one thing and enabling the servers to do another. Obviously, being able to construct recurring and item templates within the Billing module > item template form is critical (i.e. yearly domain registrations, service contracts, etc) - but just not for the limit templates that are also used to control server quotas.

    Awesome work, Till.

    PS. For the record, I see no reason why anyone would use WHMCS in conjunction with ISPConfig. At best, it is a black box (ioncube) API with complexity that only the English can imagine and include. ​
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Hi Rick,

    the main and the addon template are both connected or at least they were in the past and they should be connected between billing module and the ispconfig client module. Please contact me by email to support [at] ispconfig [dot] org so I can check with which billing and ISPConfig version I can reproduce that so that I can send you a fix for the billing module or ispconfig.

    The ability to create to create custom recurring items and especially to also create invoices manually was one of the reasons why I started to write the billing module. I started the development of the billing module basically for my own needs as there were automated billing solutions at the market and also traditional "manual" billing software but what I needed was something that can create invcoices automatically based on scheduled / recurring items and join all due ites to one invoice at the time I do the next invoice run but I also needed the ability to write a invice to a client that for something completely diffferent. e.g. a piece of hardware or something like that in between.
  3. sleepingranch

    sleepingranch New Member

    Hi Till,
    Sorry about the length, but I had this open and was using it to assemble my thoughts throughout the day. Hope it helps.
    Yes, I see that is what you are doing and totally agree with it.

    Right now, upon creation of a Client > Templates > Limit Templates, you place a 'connected' version of that template in the Billing > Settings > Item Template. I don't think you need to do that. You already generate a billing > recurring > recurring item listing of it (well, the 'main' template you do, not the 'additional' template - which was my main complaint above). All the name/value pairs you need filled/edited are there in the 'billing > recurring item' list you generate. When you stick a second 'billing > settings > item template' connection listing you confuse the issue AND you make it possible for people to create limit-templates (by going to 'billing > recurring > recurring item > Add New Record') which means you can setup a billing for servers (main and additional) that are NOT connected to the ACTUAL limit templates in the Client module which are literally controlling the quota system.

    If you remove the ability to construct 'Client > Limit-templates' in the billing module via the 'billing > settings > item template' and ONLY allow them to be built in the 'Client > Limit Templates' (where they are made to control the Client's quota) then that would mean the only way a customer can get billed for a client limit-template (main or additional) is if it is actually installed in and working in the client module.

    Your stated (auto) goal is:
    Consider these changes in the 'billing > settings > item template' form:
    1. Remove the 'Connected with client template' dropdown menu. Limit Templates are installed in the Client module and referenced in the billing module - do not give them the option to do it in reverse of that.
    2. Give the 'billing > recurring invoice items > Add new record' the ability to create one-off invoice that will be found by the 'Create Invoices' routine. (I make a suggestion on how to do that below.)
    Another stated (manual) goal:

    What if you call these 'Manual' invoices and locate them in a 'billing > settings > manual template > Manual invoice template' form? This is what you would use to create 'manual' one-off invoices to be billed separately from a normal monthly billing cycle.
    2). Then, you can refer to a 'client > Limit Template' as an 'auto' template in the Billing module. They would NOT need their own ('billing > settings > auto template > Auto Templates') form, BUT marking them as 'auto' in the 'Type' column (in the 'Recurring invoice items' list) would help to distinguish them from those 'manual' invoices [Domain, Web, Service, Other] the templates of which are stored in the (newly suggested) 'billing > settings > manual templates'.
    3. Summarizing: 'Auto' invoice item types are generated from the Client's module limit-template settings. Manual invoice item types are constructed from the Billing module settings.​

    But how do the class methods separate 'manual' from 'auto' invoices?

    I choose to use pictures to walk myself through it (I figure you already know it, thanks for being patient):
    If I create the Fictitious Company in the client module and assign to its 'Master Template' the value of (an existing) Main Template named 'Base Template' ... And then assigned to its 'Addon Template' the value of (an existing) Additional Template named '10 additional gigabytes' then I would have this in the client > edit client > limits:

    And I would have this in the 'billing > recurring items > Recurring invoice items':
    Instead, it should look like this (which I've had to do 'manually' by ticking the 'Add new record' button inside this (billing > recurring item > recurring invoice items') form:

    I suggest using the 'Type' column (which is not used for anything other than organizing) to override the dropdown menu choices [Client template, Domain, Web, Service, Other] to be either a static 'Auto' (if generated automatically from the Client module) or a 'manual' dropdown choice of [Domain, Web, Service, Other]. Something like this:

    Then, consider making this change inside the Recurring invoice item form:

    To include one-off invoices ALONG WITH recurring invoices in one invoice, then; inside the 'billing > recurring item > Recurring invoice items > Add new record' it seems you may need to accept more than just 'recurring' in the 'Type' dropdown menu. I haven't looked at the code, but it seems you are trying to keep only the 'recurring' invoice types to be found by the 'Make Invoices' routine. Maybe you can change the 'billing > settings > item template > Invoice item template' dropdown menu to look like this:

    If all goes well, you should be able to add a 'manual' invoice along side 'auto' invoices inside the 'billing > recurring > Recurring invoice items' list which will be picked up by the 'Make Invoices' routine and built into one (monthly) invoice.

    Would that work?
    Last edited: Jun 2, 2015
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thank you for your detailed explanation. The most likely reason for your problem is a incompatibility between the ispconfig and billing module version on your server, that why I asked you to contact our support so that we can verify that. The goal to join automatic and manual invoices is already implemented and it is working fine here, I just used it yesterday to create invoices. Alaos adding main and additional templates works automatically here, so no need for a manual step. The system knows how to pick up the invoices with manual items automatically when you do a new automatic invoice run, there is no need for a separate type field.

Share This Page