Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code cleanup should trigger scan.
James Cole742c84269b3c
diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.phpindex e2372d7b7a..7eafb0069b 100644--- a/app/Http/Controllers/Json/RecurrenceController.php+++ b/app/Http/Controllers/Json/RecurrenceController.php@@ -107,17 +107,16 @@ class RecurrenceController extends Controller$repetition->weekend = (int)$request->get('weekend');$actualEnd = clone $end;- if('until_date' === $endsAt) {+ if ('until_date' === $endsAt) {$actualEnd = $endDate ?? clone $end;$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);}- if('times' === $endsAt) {+ if ('times' === $endsAt) {$occurrences = $this->recurring->getXOccurrences($repetition, $actualStart, $repetitions);}- if('times' !== $endsAt && 'until_date' !== $endsAt) {+ if ('times' !== $endsAt && 'until_date' !== $endsAt) {// 'forever'$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);-}/** @var Carbon $current */diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.phpindex 58d510ada1..16076efd43 100644--- a/app/Http/Requests/RecurrenceFormRequest.php+++ b/app/Http/Requests/RecurrenceFormRequest.php@@ -315,22 +315,22 @@ class RecurrenceFormRequest extends FormRequest// TODO either use 'withdrawal' or the strtolower() variant, not both.$type = $this->convertString('transaction_type');$throwError = true;- if('withdrawal' === $type) {+ if ('withdrawal' === $type) {$throwError = false;$sourceId = (int)$data['source_id'];$destinationId = (int)$data['withdrawal_destination_id'];}- if('deposit' === $type) {+ if ('deposit' === $type) {$throwError = false;$sourceId = (int)$data['deposit_source_id'];$destinationId = (int)$data['destination_id'];}- if('transfer' === $type) {+ if ('transfer' === $type) {$throwError = false;$sourceId = (int)$data['source_id'];$destinationId = (int)$data['destination_id'];}- if(true === $throwError) {+ if (true === $throwError) {throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));}diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 4ba3a787ce..cef6d344a5 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -331,7 +331,7 @@ class BudgetRepository implements BudgetRepositoryInterfacereturn;}if (null !== $dbNote) {- $dbNote->delete();+ $dbNote->delete();}}diff --git a/app/Services/Internal/Destroy/BillDestroyService.php b/app/Services/Internal/Destroy/BillDestroyService.phpindex 929242a6b7..d2b2522584 100644--- a/app/Services/Internal/Destroy/BillDestroyService.php+++ b/app/Services/Internal/Destroy/BillDestroyService.php@@ -37,6 +37,6 @@ class BillDestroyService*/public function destroy(Bill $bill): void{- $bill->delete();+ $bill->delete();}}diff --git a/app/Services/Internal/Destroy/BudgetDestroyService.php b/app/Services/Internal/Destroy/BudgetDestroyService.phpindex fe6bbd1126..cea4e6fd3e 100644--- a/app/Services/Internal/Destroy/BudgetDestroyService.php+++ b/app/Services/Internal/Destroy/BudgetDestroyService.php@@ -39,7 +39,7 @@ class BudgetDestroyService*/public function destroy(Budget $budget): void{- $budget->delete();+ $budget->delete();// also delete auto budget:foreach ($budget->autoBudgets()->get() as $autoBudget) {diff --git a/app/Services/Internal/Destroy/CategoryDestroyService.php b/app/Services/Internal/Destroy/CategoryDestroyService.phpindex 376ba11e60..ee00647357 100644--- a/app/Services/Internal/Destroy/CategoryDestroyService.php+++ b/app/Services/Internal/Destroy/CategoryDestroyService.php@@ -39,7 +39,7 @@ class CategoryDestroyService*/public function destroy(Category $category): void{- $category->delete();+ $category->delete();// also delete all relations between categories and transaction journals:DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();diff --git a/app/Services/Internal/Destroy/CurrencyDestroyService.php b/app/Services/Internal/Destroy/CurrencyDestroyService.phpindex a62dc2a070..70ecf99d43 100644--- a/app/Services/Internal/Destroy/CurrencyDestroyService.php+++ b/app/Services/Internal/Destroy/CurrencyDestroyService.php@@ -38,6 +38,6 @@ class CurrencyDestroyService*/public function destroy(TransactionCurrency $currency): void{- $currency->delete();+ $currency->delete();}}diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.phpindex a6701c49a3..bb7157aa5e 100644--- a/app/Services/Internal/Support/RecurringTransactionTrait.php+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php@@ -61,7 +61,7 @@ trait RecurringTransactionTraitif ('' === $note) {$dbNote = $recurrence->notes()->first();if (null !== $dbNote) {- $dbNote->delete();+ $dbNote->delete();}return true;@@ -373,8 +373,7 @@ trait RecurringTransactionTraitforeach ($recurrence->recurrenceTransactions as $transaction) {$transaction->recurrenceTransactionMeta()->delete();- $transaction->delete();-+ $transaction->delete();}}}diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.phpindex 5d01c99bf7..e8bc406803 100644--- a/app/Services/Internal/Update/CategoryUpdateService.php+++ b/app/Services/Internal/Update/CategoryUpdateService.php@@ -153,9 +153,7 @@ class CategoryUpdateServiceif ('' === $note) {$dbNote = $category->notes()->first();if (null !== $dbNote) {-- $dbNote->delete();-+ $dbNote->delete();}return;diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.phpindex 03f9a73874..dfce5f715f 100644--- a/app/Services/Internal/Update/RecurrenceUpdateService.php+++ b/app/Services/Internal/Update/RecurrenceUpdateService.php@@ -132,7 +132,7 @@ class RecurrenceUpdateServicereturn;}if (null !== $dbNote && '' === $text) {- $dbNote->delete();+ $dbNote->delete();}}diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.phpindex 90ca98e25a..ec559a59c9 100644--- a/app/Support/FireflyConfig.php+++ b/app/Support/FireflyConfig.php@@ -46,7 +46,7 @@ class FireflyConfigif (Cache::has($fullName)) {Cache::forget($fullName);}- Configuration::where('name', $name)->forceDelete();+ Configuration::where('name', $name)->forceDelete();}/**diff --git a/app/Support/Preferences.php b/app/Support/Preferences.phpindex 4d43830659..10390fe799 100644--- a/app/Support/Preferences.php+++ b/app/Support/Preferences.php@@ -113,7 +113,7 @@ class Preferencesif (Cache::has($fullName)) {Cache::forget($fullName);}- Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();+ Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();return true;}@@ -145,7 +145,7 @@ class Preferences$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);if (null !== $pref && null === $value) {- $pref->delete();+ $pref->delete();return new Preference();}