Change status when mailing the invoice

Hi. I need some help. I would need that when I mail the invoice, it will not change to “sent” status and it will be changed to the “draft” status. Could you tell me where to make the change? Thank you!

It doesn’t make sense to me to loose the ability to track which invoices have been sent, but if that’s what you want, to disable this feature edit the file

  • application/modules/mailer/controllers/Mailer.php

and comment out the line

  • $this->mdl_invoices->mark_sent($invoice_id);

in the function send_invoice($invoice_id) (line 163) to change the code from

    if (email_invoice($invoice_id, $pdf_template, $from, $to, $subject, $body, $cc, $bcc, $attachment_files)) {
        $this->mdl_invoices->mark_sent($invoice_id);
        $this->session->set_flashdata('alert_success', trans('email_successfully_sent'));
    redirect('invoices/view/' . $invoice_id);
} else {

to

    if (email_invoice($invoice_id, $pdf_template, $from, $to, $subject, $body, $cc, $bcc, $attachment_files)) {
        // $this->mdl_invoices->mark_sent($invoice_id);
        $this->session->set_flashdata('alert_success', trans('email_successfully_sent'));
    redirect('invoices/view/' . $invoice_id);
} else {

That should keep the current status of your invoice when you send it.

Thank you very much! You are a crack. For me, it makes sense. E modified InvoicePlane quite a lot, and everything is right. I do not use it to create invoices, but motorcycle budgets.

Test the answer and, if it works, remember to mark the message with the solution as “Accepted Answer”.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.