Problem with the billing module (recurring invoices)

Discussion in 'Plugins/Modules/Addons' started by Jeremy007, Apr 19, 2023.

  1. Jeremy007

    Jeremy007 Member

    Hello HTG friends,

    I have been having an issue with the billing module and finally i think why this has been happening. Whenever i create a recurring item and the client has a draft, it adds the draft to the recurring item when it's generated. This is a major problem because clients are receiving finalized invoices from drafts.

    Anyone who has any idea on how to solve this issue, please let me know a.s.a.p
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That's how it should work. If there is a draft and you automatically create a new invoice, then this draft is incorporated into the final invoice. This way, you can add items to the draft during the month and when you issue invoices at the end of the month, these get included in the invoice which is sent to the client.
     
  3. Jeremy007

    Jeremy007 Member

    Thanks for the quick replay till. Can this be turned into a feature? (checkbox). If you can point me in the right direction i can program it into the script myself.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Take a look at the file billing/create_recurring_invoices.php around line 418:

    Code:
    $invoice = $app...................
    
    if($invoice['invoice_id'] > 0) {
                    $invoice_id = $invoice['invoice_id'];
                } else {
                    // There is no invoice draft, so we have to create one.
    Either remove the whole $invoice = ..... and the if/else plus matching closing curly bracket, which is probably the fastest solution, or change it as you like. I can add a feature request on adding an option to disable this function.
     
  5. Jeremy007

    Jeremy007 Member

    Code:
    "SELECT invoice_id FROM invoice WHERE client_id = ? AND invoice_type = ? AND invoice_company_id = ? AND status_printed = 'n'"...
    Wait, reading the code i can also bypass this by simply setting the draft's printed to "y" by checking the "printed" checkbox on the draft page, right?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, this should work as well.
     
    Jeremy007 likes this.
  7. Jeremy007

    Jeremy007 Member

    Thanks Till!
     

Share This Page