Blesta Addons Posted May 8, 2018 Report Posted May 8, 2018 when a invoice is edit, the Edit() function Delete existing unsent invoice delivery methods. so if we add/edit only the public note or private note the delivery method is not filled again . sample case Create invoice with email delivery, try edit the invoice via model (plugin/api) in the same time (before the cron run, a better way is a event to test it on the fly), then the email delivery will be removed an no delivery is set again !! so the invoice will not send until we send it manually . i can't tell is a real bug, but is a bad behavior of editing the invoice via model, i think it should be marked in the docs to include the delivery var with the data set in edit. something i think is similar to a previous behavior we have discovery with the invoice status, when we want to edit only a note or a lines, we should always send the status of the invoice to not be converted to active invoice when we use proforma . Quote
Blesta Addons Posted May 8, 2018 Author Report Posted May 8, 2018 we will put a sample fix, so in our case we need to made something like that, in case anyone try to use the event triggers for invoice.add, all invoices edited with the event Invoices.Add will end with no delivery method set . // preserve the actual status $vars['status'] = $invoice->status; // Preserve the delivery method (in case of unsent invoice) if (!empty($invoice->delivery)) { foreach ($invoice->delivery as $key => $value) { $vars['delivery'][] = ['method' => $value]; } } $this->Invoices->edit($invoice->id, $vars); activa 1 Quote
Tyson Posted May 8, 2018 Report Posted May 8, 2018 Yes, you'll need to provide the unsent delivery methods if you would like them to be maintained. The use of models will be updated in the future to provide better and more succinct actions for updates like these. Beav 1 Quote
Blesta Addons Posted May 8, 2018 Author Report Posted May 8, 2018 3 hours ago, Tyson said: Yes, you'll need to provide the unsent delivery methods if you would like them to be maintained. The use of models will be updated in the future to provide better and more succinct actions for updates like these. this is only affecting the unset invoice . Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.