Minor fixes for recurring invoices auto bill

This commit is contained in:
David Bomba 2021-08-31 13:12:17 +10:00
parent 146e1b764f
commit ded9e25c02

View File

@ -101,8 +101,8 @@ class UpdateRecurringInvoiceRequest extends Request
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
}
if (isset($input['auto_bill'])) {
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
if (array_key_exists('auto_bill', $input) && isset($input['auto_bill']) && $this->setAutoBillFlag($input['auto_bill'])) {
$input['auto_bill_enabled'] = true;
}
if (array_key_exists('documents', $input)) {
@ -123,13 +123,8 @@ class UpdateRecurringInvoiceRequest extends Request
*/
private function setAutoBillFlag($auto_bill) :bool
{
if ($auto_bill == 'always') {
if ($auto_bill == 'always')
return true;
}
// if($auto_bill == '')
// off / optin / optout will reset the status of this field to off to allow
// the client to choose whether to auto_bill or not.
return false;
}