Hi to all,
I’ve found a bug after updating to IP 1.5.8 (but also IP 1.5.9 is affected), with generate_invoice_number_for_draft
set to No
and mark_invoices_sent_pdf
set to Yes
, when I download a drafted invoice, the invoice changes his status to sent but doesn’t generate the invoice number and downloads a PDF without the invoice number.
But if I manually change invoice status from draft to sent, the invoice number generates correctly.
You can test this bug directly in the InvoicePlane demo with the latest version.
I think the bug is caused by this pull request [IP-602] & [IP-603] - Invoice/Quote number generated after sent.
I could be wrong but maybe adding this line in application/modules/invoices/controllers/Invoices.php
fixes the problem:
public function generate_pdf($invoice_id, $stream = true, $invoice_template = null)
{
$this->load->helper('pdf');
if (get_setting('mark_invoices_sent_pdf') == 1) {
+ $this->mdl_invoices->generate_invoice_number_if_applicable($invoice_id);
$this->mdl_invoices->mark_sent($invoice_id);
}
generate_invoice_pdf($invoice_id, $stream, $invoice_template, null);
}
...
And, of course, the same thing happens with quotes.
Thank you!