Jump to content

Invoices send first to Draft


Jam

Recommended Posts

3 hours ago, WHMCS ChrisD said:

@Jam invoices created manually will create in draft, invoices generated for renewal will not, out of the box it is not possible to change this behaviour but a third party addon or customisation may allow this to happen.

Sorry, Sir, I didn't get your pouint

Link to comment
Share on other sites

1 hour ago, Jam said:

Sorry, Sir, I didn't get your point

he means that if you manually create an invoice in the admin area, it's status will default to being "Draft"; if WHMCS automatically creates it, e.g it's a renewal invoice or for a new order, then it will have another status, e.g Paid, Unpaid etc. but never Draft.

renewal/order invoices can be assigned draft status using hook(s) - usually it's done with two hooks, one to change the status of the invoice to draft after it's created, and another to prevent the newly draft invoice from being emailed to the client.... note that clients shouldn't be able to view draft invoices from their client area.

I assume the idea of your question is that you want to inspect / edit the invoices in the admin area before they get sent to the client ?

Link to comment
Share on other sites

12 hours ago, brian! said:

I assume the idea of your question is that you want to inspect / edit the invoices in the admin area before they get sent to the client ?

I want the Invoices to send first to Draft before send to Unpaid
 

For example, I make Bill Item and I click save changes, its automatically send to Unpaid Invoices, not in Draft.

Link to comment
Share on other sites

45 minutes ago, Jam said:

Both Sir

You can not do this with recurring items, these will always invoice to the client directly, for Billable items you have a choice of :

 

  • Don't invoice for now - so it will remain listed in the clients account as an unbilled item
  • Invoice on Next Cron Run - generate an invoice for it the next time your daily cron job runs
  • Add to User's Next Invoice - add to the next automated recurring renewal invoice to be generated for products and services
  • Invoice as Normal for Due Date - allows you to set a specific date the item is due and it will be invoiced X days in advance like all other products/services
  • Recur - allowing you to set for the item to recur every X number of Days/Weeks/Months/Years for a defined or unlimited number of times
Link to comment
Share on other sites

  • 7 months later...

Hi, I was trying to achieve the same thing and did it by implemeting the following hook:


/**
 * Sets the status of new invoices to Draft
 * @params array $vars [
 *  source => [adminarea, api, autogen]
 *  user => (string)
 *  invoiceid => (int)
 *  status => (string)
 * ]
 */
add_hook('InvoiceCreation', 10, function($vars) {
    try {
        Capsule::table('tblinvoices')
            ->where('id', $vars['invoiceid'])
            ->update(
                [
                    'status' => 'Draft',
                ]
            );
        logActivity(sprintf('Invoice %d status automatically set to draft', $vars['invoiceid']), 0);
    } catch (\Exception $e) {
        logActivity(sprintf('Invoice %d status could not be set to draft', $vars['invoiceid']), 0);
    }
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated