diff --git a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php index 7f2d1faad95d..4421cf5d69ed 100644 --- a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php @@ -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; }