From 834b1afb38e4fd9cdb636dacefcf49a88e166d16 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 5 Jun 2015 13:39:24 +0200 Subject: [PATCH] Updated some code [skip ci] --- .scrutinizer.yml | 2 +- .travis.yml | 2 +- app/Http/Controllers/HomeController.php | 1 - app/Http/Controllers/NewUserController.php | 2 +- app/Models/Permission.php | 2 +- app/Models/Role.php | 2 +- .../Category/CategoryRepository.php | 1 - .../Shared/ComponentRepository.php | 41 ++++++++++--------- app/Support/CacheProperties.php | 16 ++------ resources/lang/nl/breadcrumbs.php | 8 ++-- resources/lang/nl/firefly.php | 12 +++--- resources/lang/nl/form.php | 8 ++-- resources/lang/nl/list.php | 2 +- 13 files changed, 45 insertions(+), 54 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 8486eef106..e36d2f3684 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,4 +2,4 @@ tools: external_code_coverage: timeout: 1800 # Timeout in seconds. - runs: 2 \ No newline at end of file + runs: 2 diff --git a/.travis.yml b/.travis.yml index a0ca8e95fe..150aeec78c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,4 @@ after_script: - CODECLIMATE_REPO_TOKEN=26489f9e854fcdf7e7660ba29c1455694685465b1f90329a79f7d2bf448acb61 ./vendor/bin/test-reporter --stdout > codeclimate.json - "curl -X POST -d @codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.1)' https://codeclimate.com/test_reports" - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml \ No newline at end of file + - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 695a522141..83ab8ffa33 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -6,7 +6,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Input; use Preferences; use Redirect; -use Route; use Session; use Steam; diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 1508a2448f..684a232a23 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -108,4 +108,4 @@ class NewUserController extends Controller return Redirect::route('index'); } -} \ No newline at end of file +} diff --git a/app/Models/Permission.php b/app/Models/Permission.php index e3c5943928..7b660eb32e 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -24,4 +24,4 @@ use Zizaco\Entrust\EntrustPermission; */ class Permission extends EntrustPermission { -} \ No newline at end of file +} diff --git a/app/Models/Role.php b/app/Models/Role.php index 543c0580fb..6476a4ee39 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -25,4 +25,4 @@ use Zizaco\Entrust\EntrustRole; */ class Role extends EntrustRole { -} \ No newline at end of file +} diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 30006ee96c..235663d83b 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -7,7 +7,6 @@ use Carbon\Carbon; use Crypt; use FireflyIII\Models\Category; use FireflyIII\Models\TransactionJournal; -use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; use FireflyIII\Repositories\Shared\ComponentRepository; /** diff --git a/app/Repositories/Shared/ComponentRepository.php b/app/Repositories/Shared/ComponentRepository.php index 3eb8434a37..d7b57bbfc5 100644 --- a/app/Repositories/Shared/ComponentRepository.php +++ b/app/Repositories/Shared/ComponentRepository.php @@ -4,6 +4,7 @@ namespace FireflyIII\Repositories\Shared; use Carbon\Carbon; use Illuminate\Database\Query\JoinClause; +use stdClass; /** * Class ComponentRepository @@ -15,42 +16,42 @@ class ComponentRepository /** - * @param $object - * @param Carbon $start - * @param Carbon $end + * @param stdClass $object + * @param Carbon $start + * @param Carbon $end * - * @param bool $shared + * @param bool $shared * * @return string */ - protected function spentInPeriod($object, Carbon $start, Carbon $end, $shared = false) + protected function spentInPeriod(stdClass $object, Carbon $start, Carbon $end, $shared = false) { if ($shared === true) { // shared is true. // always ignore transfers between accounts! $sum = $object->transactionjournals() - ->transactionTypes(['Withdrawal']) - ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount'); + ->transactionTypes(['Withdrawal']) + ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount'); } else { // do something else, SEE budgets. // get all journals in this month where the asset account is NOT shared. $sum = $object->transactionjournals() - ->before($end) - ->after($start) - ->transactionTypes(['Withdrawal']) - ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin( - 'account_meta', function (JoinClause $join) { - $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); - } - ) - ->where('account_meta.data', '!=', '"sharedAsset"') - ->get(['transaction_journals.*'])->sum('amount'); + ->before($end) + ->after($start) + ->transactionTypes(['Withdrawal']) + ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') + ->leftJoin( + 'account_meta', function (JoinClause $join) { + $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); + } + ) + ->where('account_meta.data', '!=', '"sharedAsset"') + ->get(['transaction_journals.*'])->sum('amount'); } return $sum; } -} \ No newline at end of file +} diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index 9bcc2c808b..f210309c59 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -75,26 +75,18 @@ class CacheProperties foreach ($this->properties as $property) { if ($property instanceof Collection || $property instanceof EloquentCollection) { - $this->md5 .= print_r($property->toArray(), true); + $this->md5 .= json_encode($property->toArray()); continue; } if ($property instanceof Carbon) { $this->md5 .= $property->toRfc3339String(); continue; } - - if (is_array($property)) { - $this->md5 .= print_r($property, true); - continue; - } - if (is_object($property)) { $this->md5 .= $property->__toString(); } - if (is_array($property)) { - $this->md5 .= print_r($property, true); - } - $this->md5 .= (string) $property; + + $this->md5 .= json_encode($property); } $this->md5 = md5($this->md5); @@ -107,4 +99,4 @@ class CacheProperties { Cache::forever($this->md5, $data); } -} \ No newline at end of file +} diff --git a/resources/lang/nl/breadcrumbs.php b/resources/lang/nl/breadcrumbs.php index 18e12fe0c5..bfed39b02a 100644 --- a/resources/lang/nl/breadcrumbs.php +++ b/resources/lang/nl/breadcrumbs.php @@ -45,10 +45,10 @@ return [ 'changePassword' => 'Verander je wachtwoord', // bills - 'bills' => 'Rekeningen', - 'newBill' => 'Nieuwe rekening', - 'edit_bill' => 'Wijzig rekening ":name"', - 'delete_bill' => 'Verwijder rekening ":name"', + 'bills' => 'Contracten', + 'newBill' => 'Nieuw contract', + 'edit_bill' => 'Wijzig contract ":name"', + 'delete_bill' => 'Verwijder contract ":name"', // reminders 'reminders' => 'Herinneringen', diff --git a/resources/lang/nl/firefly.php b/resources/lang/nl/firefly.php index 5156ff662b..7db9587382 100644 --- a/resources/lang/nl/firefly.php +++ b/resources/lang/nl/firefly.php @@ -45,7 +45,7 @@ return [ 'update_amount' => 'Bedrag bijwerken', // bills: - 'delete_bill' => 'Verwijder rekening ":name"', + 'delete_bill' => 'Verwijder contract ":name"', // accounts: 'details_for_asset' => 'Overzicht voor betaalrekening ":name"', @@ -128,8 +128,8 @@ return [ 'newTransfer' => 'Nieuwe overschrijving', 'moneyIn' => 'Inkomsten', 'moneyOut' => 'Uitgaven', - 'billsToPay' => 'Openstaande rekeningen', - 'billsPaid' => 'Betaalde rekeningen', + 'billsToPay' => 'Openstaande contracten', + 'billsPaid' => 'Betaalde contracten', 'viewDetails' => 'Meer info', 'divided' => 'verdeeld', 'toDivide' => 'te verdelen', @@ -161,7 +161,7 @@ return [ 'transfers' => 'Overschrijvingen', 'moneyManagement' => 'Geldbeheer', 'piggyBanks' => 'Spaarpotjes', - 'bills' => 'Rekeningen', + 'bills' => 'Contracten', 'createNew' => 'Nieuw', 'withdrawal' => 'Uitgave', 'deposit' => 'Inkomsten', @@ -170,7 +170,7 @@ return [ 'Withdrawal' => 'Uitgave', 'Deposit' => 'Inkomsten', 'Transfer' => 'Overschrijving', - 'bill' => 'Rekening', + 'bill' => 'Contracten', 'yes' => 'Ja', 'no' => 'Nee', 'amount' => 'Bedrag', @@ -227,7 +227,7 @@ return [ 'noBudget' => '(geen budget)', 'maxAmount' => 'Maximaal bedrag', 'minAmount' => 'Minimaal bedrag', - 'billEntry' => 'Bedrag voor deze rekening', + 'billEntry' => 'Bedrag voor dit contract', 'name' => 'Naam', 'date' => 'Datum', 'paid' => 'Betaald', diff --git a/resources/lang/nl/form.php b/resources/lang/nl/form.php index 4c1bcda15f..bcb086d5c2 100644 --- a/resources/lang/nl/form.php +++ b/resources/lang/nl/form.php @@ -58,7 +58,7 @@ return [ 'noBudget' => '(geen budget)', 'delete_account' => 'Verwijder rekening ":name"', - 'delete_bill' => 'Verwijder rekening ":name"', + 'delete_bill' => 'Verwijder contract ":name"', 'delete_budget' => 'Verwijder budget ":name"', 'delete_category' => 'Verwijder categorie ":name"', 'delete_currency' => 'Verwijder munteenheid ":name"', @@ -66,7 +66,7 @@ return [ 'delete_journal' => 'Verwijder transactie met omschrijving ":description"', 'account_areYouSure' => 'Weet je zeker dat je de rekening met naam ":name" wilt verwijderen?', - 'bill_areYouSure' => 'Weet je zeker dat je de rekening met naam ":name" wilt verwijderen?', + 'bill_areYouSure' => 'Weet je zeker dat je het contract met naam ":name" wilt verwijderen?', 'budget_areYouSure' => 'Weet je zeker dat je het budget met naam ":name" wilt verwijderen?', 'category_areYouSure' => 'Weet je zeker dat je het category met naam ":name" wilt verwijderen?', 'currency_areYouSure' => 'Weet je zeker dat je de munteenheid met naam ":name" wilt verwijderen?', @@ -78,8 +78,8 @@ return [ '|Ook alle :count transacties verbonden aan deze rekening worden verwijderd.', 'also_delete_piggyBanks' => 'Ook het spaarpotje verbonden aan deze rekening wordt verwijderd.' . '|Ook alle :count spaarpotjes verbonden aan deze rekening worden verwijderd.', - 'bill_keep_transactions' => 'De transactie verbonden aan deze rekening blijft bewaard.' . - '|De :count transacties verbonden aan deze rekening blijven bewaard.', + 'bill_keep_transactions' => 'De transactie verbonden aan dit contract blijft bewaard.' . + '|De :count transacties verbonden aan dit contract blijven bewaard.', 'budget_keep_transactions' => 'De transactie verbonden aan dit budget blijft bewaard.' . '|De :count transacties verbonden aan dit budget blijven bewaard.', 'category_keep_transactions' => 'De transactie verbonden aan deze categorie blijft bewaard.' . diff --git a/resources/lang/nl/list.php b/resources/lang/nl/list.php index 7ade859e8c..a9a8a30b02 100644 --- a/resources/lang/nl/list.php +++ b/resources/lang/nl/list.php @@ -23,7 +23,7 @@ return [ 'to' => 'Naar', 'budget' => 'Budget', 'category' => 'Categorie', - 'bill' => 'Rekening', + 'bill' => 'Contract', 'withdrawal' => 'Uitgave', 'deposit' => 'Inkomsten', 'transfer' => 'Overschrijving',