Skip to content

Firefly III: a personal finances manager

Code cleanup.

James Cole2d2f18e5388c
diff --git a/app/Models/Account.php b/app/Models/Account.php
index bda55d8c8b..581c0d48e2 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -11,22 +11,22 @@ use Watson\Validating\ValidatingTrait;
* Class Account
*
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property integer $user_id
- * @property integer $account_type_id
- * @property string $name
- * @property boolean $active
- * @property boolean $encrypted
- * @property float $virtual_balance
- * @property string $virtual_balance_encrypted
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
- * @property-read \FireflyIII\Models\AccountType $accountType
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property integer $user_id
+ * @property integer $account_type_id
+ * @property string $name
+ * @property boolean $active
+ * @property boolean $encrypted
+ * @property float $virtual_balance
+ * @property string $virtual_balance_encrypted
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
+ * @property-read \FireflyIII\Models\AccountType $accountType
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index 7279f6094c..3cd0f95fbe 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -8,13 +8,13 @@ use Watson\Validating\ValidatingTrait;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $account_id
- * @property string $name
- * @property string $data
- * @property-read \FireflyIII\Models\Account $account
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $account_id
+ * @property string $name
+ * @property string $data
+ * @property-read \FireflyIII\Models\Account $account
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereUpdatedAt($value)
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index ebf51de3df..10c10a1ef4 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -7,12 +7,12 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property string $type
- * @property boolean $editable
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $type
+ * @property boolean $editable
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereUpdatedAt($value)
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index c3fdce553c..845d110cf5 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -8,25 +8,25 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore Class Bill
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $user_id
- * @property string $name
- * @property string $match
- * @property float $amount_min
- * @property string $amount_min_encrypted
- * @property float $amount_max
- * @property string $amount_max_encrypted
- * @property \Carbon\Carbon $date
- * @property boolean $active
- * @property boolean $automatch
- * @property string $repeat_freq
- * @property integer $skip
- * @property boolean $name_encrypted
- * @property boolean $match_encrypted
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $user_id
+ * @property string $name
+ * @property string $match
+ * @property float $amount_min
+ * @property string $amount_min_encrypted
+ * @property float $amount_max
+ * @property string $amount_max_encrypted
+ * @property \Carbon\Carbon $date
+ * @property boolean $active
+ * @property boolean $automatch
+ * @property string $repeat_freq
+ * @property integer $skip
+ * @property boolean $name_encrypted
+ * @property boolean $match_encrypted
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index bb186cb493..7de89a558e 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -9,17 +9,17 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property string $name
- * @property integer $user_id
- * @property boolean $active
- * @property boolean $encrypted
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property string $name
+ * @property integer $user_id
+ * @property boolean $active
+ * @property boolean $encrypted
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index 3ef24e24ac..921f37d9db 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -7,17 +7,17 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $budget_id
- * @property \Carbon\Carbon $startdate
- * @property float $amount
- * @property string $amount_encrypted
- * @property boolean $repeats
- * @property string $repeat_freq
- * @property-read \FireflyIII\Models\Budget $budget
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $budget_id
+ * @property \Carbon\Carbon $startdate
+ * @property float $amount
+ * @property string $amount_encrypted
+ * @property boolean $repeats
+ * @property string $repeat_freq
+ * @property-read \FireflyIII\Models\Budget $budget
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereUpdatedAt($value)
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 8833cf1a2d..30b1601f50 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -8,15 +8,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* Class Category
*
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property string $name
- * @property integer $user_id
- * @property boolean $encrypted
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property string $name
+ * @property integer $user_id
+ * @property boolean $encrypted
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value)
diff --git a/app/Models/Component.php b/app/Models/Component.php
index 4e543d830e..ac43425ad7 100644
--- a/app/Models/Component.php
+++ b/app/Models/Component.php
@@ -8,13 +8,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property string $name
- * @property integer $user_id
- * @property string $class
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property string $name
+ * @property integer $user_id
+ * @property string $class
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUpdatedAt($value)
diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.php
index 580ef92977..1adffb5e18 100644
--- a/app/Models/LimitRepetition.php
+++ b/app/Models/LimitRepetition.php
@@ -7,15 +7,15 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $budget_limit_id
- * @property \Carbon\Carbon $startdate
- * @property \Carbon\Carbon $enddate
- * @property float $amount
- * @property string $amount_encrypted
- * @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $budget_limit_id
+ * @property \Carbon\Carbon $startdate
+ * @property \Carbon\Carbon $enddate
+ * @property float $amount
+ * @property string $amount_encrypted
+ * @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereUpdatedAt($value)
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 9601cc946f..6d4b904d81 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -9,25 +9,25 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property integer $account_id
- * @property string $name
- * @property float $targetamount
- * @property string $targetamount_encrypted
- * @property \Carbon\Carbon $startdate
- * @property \Carbon\Carbon $targetdate
- * @property string $reminder
- * @property integer $reminder_skip
- * @property boolean $remind_me
- * @property integer $order
- * @property boolean $encrypted
- * @property-read \FireflyIII\Models\Account $account
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property integer $account_id
+ * @property string $name
+ * @property float $targetamount
+ * @property string $targetamount_encrypted
+ * @property \Carbon\Carbon $startdate
+ * @property \Carbon\Carbon $targetdate
+ * @property string $reminder
+ * @property integer $reminder_skip
+ * @property boolean $remind_me
+ * @property integer $order
+ * @property boolean $encrypted
+ * @property-read \FireflyIII\Models\Account $account
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index 2d2d37bc9b..2c03dadace 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -7,16 +7,16 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $piggy_bank_id
- * @property integer $transaction_journal_id
- * @property \Carbon\Carbon $date
- * @property float $amount
- * @property string $amount_encrypted
- * @property-read \FireflyIII\Models\PiggyBank $piggyBank
- * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $piggy_bank_id
+ * @property integer $transaction_journal_id
+ * @property \Carbon\Carbon $date
+ * @property float $amount
+ * @property string $amount_encrypted
+ * @property-read \FireflyIII\Models\PiggyBank $piggyBank
+ * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereUpdatedAt($value)
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index 221d491ede..deccd7bbde 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -9,15 +9,15 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $piggy_bank_id
- * @property \Carbon\Carbon $startdate
- * @property \Carbon\Carbon $targetdate
- * @property float $currentamount
- * @property string $currentamount_encrypted
- * @property-read \FireflyIII\Models\PiggyBank $piggyBank
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $piggy_bank_id
+ * @property \Carbon\Carbon $startdate
+ * @property \Carbon\Carbon $targetdate
+ * @property float $currentamount
+ * @property string $currentamount_encrypted
+ * @property-read \FireflyIII\Models\PiggyBank $piggyBank
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereUpdatedAt($value)
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index bce89c26fb..a25fd850e6 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -8,15 +8,15 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $user_id
- * @property string $name
- * @property string $name_encrypted
- * @property string $data
- * @property string $data_encrypted
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $user_id
+ * @property string $name
+ * @property string $name_encrypted
+ * @property string $data
+ * @property string $data_encrypted
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUpdatedAt($value)
diff --git a/app/Models/Reminder.php b/app/Models/Reminder.php
index 079d18b20e..d46cf56e74 100644
--- a/app/Models/Reminder.php
+++ b/app/Models/Reminder.php
@@ -10,20 +10,20 @@ use Illuminate\Database\Eloquent\Model;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $user_id
- * @property \Carbon\Carbon $startdate
- * @property \Carbon\Carbon $enddate
- * @property boolean $active
- * @property boolean $notnow
- * @property integer $remindersable_id
- * @property string $remindersable_type
- * @property string $metadata
- * @property boolean $encrypted
- * @property-read \ $remindersable
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $user_id
+ * @property \Carbon\Carbon $startdate
+ * @property \Carbon\Carbon $enddate
+ * @property boolean $active
+ * @property boolean $notnow
+ * @property integer $remindersable_id
+ * @property string $remindersable_type
+ * @property string $metadata
+ * @property boolean $encrypted
+ * @property-read \ $remindersable
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereUpdatedAt($value)
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 5e4335c081..2d973f4bf1 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -10,20 +10,20 @@ use Watson\Validating\ValidatingTrait;
* Class Tag
*
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property string $deleted_at
- * @property integer $user_id
- * @property string $tag
- * @property string $tagMode
- * @property \Carbon\Carbon $date
- * @property string $description
- * @property float $latitude
- * @property float $longitude
- * @property integer $zoomLevel
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $deleted_at
+ * @property integer $user_id
+ * @property string $tag
+ * @property string $tagMode
+ * @property \Carbon\Carbon $date
+ * @property string $description
+ * @property float $latitude
+ * @property float $longitude
+ * @property integer $zoomLevel
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value)
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index dda3393095..8b375090d3 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -11,17 +11,17 @@ use Watson\Validating\ValidatingTrait;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property integer $account_id
- * @property integer $transaction_journal_id
- * @property string $description
- * @property float $amount
- * @property string $amount_encrypted
- * @property-read \FireflyIII\Models\Account $account
- * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property integer $account_id
+ * @property integer $transaction_journal_id
+ * @property string $description
+ * @property float $amount
+ * @property string $amount_encrypted
+ * @property-read \FireflyIII\Models\Account $account
+ * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereUpdatedAt($value)
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index be9ce8c810..edc8797aca 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -8,14 +8,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property string $code
- * @property string $name
- * @property string $symbol
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property string $code
+ * @property string $name
+ * @property string $symbol
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereUpdatedAt($value)
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index d51e534cf2..9ef702872c 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -8,14 +8,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property integer $user_id
- * @property string $relation
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property integer $user_id
+ * @property string $relation
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value)
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index fbb49e93f8..236c8a8ed4 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -13,34 +13,34 @@ use Watson\Validating\ValidatingTrait;
*
* @package FireflyIII\Models
* @SuppressWarnings (PHPMD.TooManyMethods)
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property integer $user_id
- * @property integer $transaction_type_id
- * @property integer $bill_id
- * @property integer $transaction_currency_id
- * @property string $description
- * @property boolean $completed
- * @property \Carbon\Carbon $date
- * @property boolean $encrypted
- * @property integer $order
- * @property-read \FireflyIII\Models\Bill $bill
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
- * @property-read mixed $actual_amount
- * @property-read mixed $amount
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
- * @property-read mixed $asset_account
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
- * @property-read mixed $corrected_actual_amount
- * @property-read mixed $destination_account
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
- * @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
- * @property-read \FireflyIII\Models\TransactionType $transactionType
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
- * @property-read \FireflyIII\User $user
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property integer $user_id
+ * @property integer $transaction_type_id
+ * @property integer $bill_id
+ * @property integer $transaction_currency_id
+ * @property string $description
+ * @property boolean $completed
+ * @property \Carbon\Carbon $date
+ * @property boolean $encrypted
+ * @property integer $order
+ * @property-read \FireflyIII\Models\Bill $bill
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
+ * @property-read mixed $actual_amount
+ * @property-read mixed $amount
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
+ * @property-read mixed $asset_account
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
+ * @property-read mixed $corrected_actual_amount
+ * @property-read mixed $destination_account
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
+ * @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
+ * @property-read \FireflyIII\Models\TransactionType $transactionType
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
+ * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUpdatedAt($value)
@@ -60,6 +60,7 @@ use Watson\Validating\ValidatingTrait;
* @method static \FireflyIII\Models\TransactionJournal onDate($date)
* @method static \FireflyIII\Models\TransactionJournal transactionTypes($types)
* @method static \FireflyIII\Models\TransactionJournal withRelevantData()
+ * @property-read mixed $expense_account
*/
class TransactionJournal extends Model
{
@@ -196,22 +197,21 @@ class TransactionJournal extends Model
*/
public function getAssetAccountAttribute()
{
- $positive = true; // the asset account is in the transaction with the positive amount.
- if ($this->transactionType->type === 'Withdrawal') {
- $positive = false;
- }
- /** @var Transaction $transaction */
- foreach ($this->transactions()->get() as $transaction) {
- if (floatval($transaction->amount) > 0 && $positive === true) {
- return $transaction->account;
- }
- if (floatval($transaction->amount) < 0 && $positive === false) {
- return $transaction->account;
- }
+ // if it's a deposit, it's the one thats positive
+ // if it's a withdrawal, it's the one thats negative
+ // otherwise, it's either (return first one):
+
+ switch ($this->transactionType->type) {
+ case 'Deposit':
+ return $this->transactions()->where('amount', '>', 0)->first()->account;
+ break;
+ case 'Withdrawal':
+ return $this->transactions()->where('amount', '<', 0)->first()->account;
}
return $this->transactions()->first()->account;
+
}
/**
@@ -285,6 +285,28 @@ class TransactionJournal extends Model
return $this->transactions()->first()->account;
}
+ /**
+ * @return Account
+ */
+ public function getExpenseAccountAttribute()
+ {
+ // if it's a deposit, it's the one thats negative
+ // if it's a withdrawal, it's the one thats positive
+ // otherwise, it's either (return first one):
+
+ switch ($this->transactionType->type) {
+ case 'Deposit':
+ return $this->transactions()->where('amount', '<', 0)->first()->account;
+ break;
+ case 'Withdrawal':
+ return $this->transactions()->where('amount', '>', 0)->first()->account;
+
+ }
+
+ return $this->transactions()->first()->account;
+
+ }
+
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index bfea460fa2..697b0e8432 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -8,12 +8,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*
* @codeCoverageIgnore
* @package FireflyIII\Models
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property \Carbon\Carbon $deleted_at
- * @property string $type
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property \Carbon\Carbon $deleted_at
+ * @property string $type
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereUpdatedAt($value)
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 290d967503..190808cfb0 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -5,13 +5,10 @@ namespace FireflyIII\Repositories\Bill;
use Auth;
use Carbon\Carbon;
use DB;
-use FireflyIII\Models\Account;
-use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
-use Log;
use Navigation;
/**
@@ -268,27 +265,8 @@ class BillRepository implements BillRepositoryInterface
$amountMatch = false;
$wordMatch = false;
$matches = explode(',', $bill->match);
- $description = strtolower($journal->description);
-
- /*
- * Attach expense account to description for more narrow matching.
- */
- $transactions = $journal->transactions()->get();
-
- /** @var Transaction $transaction */
- foreach ($transactions as $transaction) {
- /** @var Account $account */
- $account = $transaction->account()->first();
- /** @var AccountType $type */
- $type = $account->accountType()->first();
- if ($type->type == 'Expense account' || $type->type == 'Beneficiary account') {
- $description .= ' ' . strtolower($account->name);
- }
- }
- Log::debug('Final description: ' . $description);
- Log::debug('Matches searched: ' . join(':', $matches));
-
- $count = 0;
+ $description = strtolower($journal->description) . ' ' . strtolower($journal->expense_account->name);
+ $count = 0;
foreach ($matches as $word) {
if (!(strpos($description, strtolower($word)) === false)) {
$count++;
@@ -296,37 +274,24 @@ class BillRepository implements BillRepositoryInterface
}
if ($count >= count($matches)) {
$wordMatch = true;
- Log::debug('word match is true');
- } else {
- Log::debug('Count: ' . $count . ', count(matches): ' . count($matches));
}
/*
* Match amount.
*/
-
- if (count($transactions) > 1) {
-
- $amount = max(floatval($transactions[0]->amount), floatval($transactions[1]->amount));
- $min = floatval($bill->amount_min);
- $max = floatval($bill->amount_max);
- if ($amount >= $min && $amount <= $max) {
- $amountMatch = true;
- Log::debug('Amount match is true!');
- }
+ if ($journal->amount >= $bill->amount_min && $journal->amount <= $bill->amount_max) {
+ $amountMatch = true;
}
-
/*
* If both, update!
*/
if ($wordMatch && $amountMatch) {
- Log::debug('TOTAL match is true!');
$journal->bill()->associate($bill);
$journal->save();
} else {
- if ((!$wordMatch || !$amountMatch) && $bill->id == $journal->bill_id) {
+ if ($bill->id == $journal->bill_id) {
// if no match, but bill used to match, remove it:
$journal->bill_id = null;
$journal->save();
diff --git a/app/User.php b/app/User.php
index 2f28eb1c93..3a97465ee8 100644
--- a/app/User.php
+++ b/app/User.php
@@ -10,21 +10,21 @@ use Illuminate\Database\Eloquent\Model;
* Class User
*
* @package FireflyIII
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property string $email
- * @property string $password
- * @property string $reset
- * @property string $remember_token
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $email
+ * @property string $password
+ * @property string $reset
+ * @property string $remember_token
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereUpdatedAt($value)