Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Final changes to bills
James Colea56a6df557bd
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.phpindex d8d7e2d9f2..f5cb3bf78e 100644--- a/app/Http/Controllers/Bill/IndexController.php+++ b/app/Http/Controllers/Bill/IndexController.php@@ -203,6 +203,7 @@ class IndexController extends Controller'quarterly' => '4','monthly' => '12','weekly' => '52.17',+ 'daily' => '365.24',];$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.phpindex 39f01d8d22..aec73c412a 100644--- a/app/Http/Requests/BillStoreRequest.php+++ b/app/Http/Requests/BillStoreRequest.php@@ -68,7 +68,7 @@ class BillStoreRequest extends FormRequest'amount_max' => 'required|numeric|gt:0|max:1000000000','transaction_currency_id' => 'required|exists:transaction_currencies,id','date' => 'required|date',- 'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',+ 'repeat_freq' => sprintf('required|in:%s', join(',', config('firefly.bill_periods'))),'skip' => 'required|integer|gte:0|lte:31','active' => 'boolean',];diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.phpindex 4e6a4bd066..259fe629d3 100644--- a/app/Http/Requests/BillUpdateRequest.php+++ b/app/Http/Requests/BillUpdateRequest.php@@ -72,7 +72,7 @@ class BillUpdateRequest extends FormRequest'amount_max' => 'required|numeric|gt:0|max:1000000000','transaction_currency_id' => 'required|exists:transaction_currencies,id','date' => 'required|date',- 'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',+ 'repeat_freq' => sprintf('required|in:%s', join(',', config('firefly.bill_periods'))),'skip' => 'required|integer|gte:0|lte:31','active' => 'boolean',];diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.phpindex 995dd48de9..b56417b7ce 100644--- a/app/Transformers/BillTransformer.php+++ b/app/Transformers/BillTransformer.php@@ -267,6 +267,9 @@ class BillTransformer extends AbstractTransformer$nextExpectedMatch->addDay();$currentStart = clone $nextExpectedMatch;$loop++;+ if($loop > 4) {+ break;+ }}$simple = $set->map(static function (Carbon $date) {