mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Various strict code things.
This commit is contained in:
@@ -101,7 +101,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
*/
|
||||
private function getWebhooks(): Collection
|
||||
{
|
||||
return $this->user->webhooks()->where('active', 1)->where('trigger', $this->trigger)->get(['webhooks.*']);
|
||||
return $this->user->webhooks()->where('active', true)->where('trigger', $this->trigger)->get(['webhooks.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -497,7 +497,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) {
|
||||
$q1->where('attachments.attachable_type', TransactionJournal::class);
|
||||
$q1->where('attachments.uploaded', 1);
|
||||
$q1->where('attachments.uploaded', true);
|
||||
$q1->orWhereNull('attachments.attachable_type');
|
||||
}
|
||||
);
|
||||
|
@@ -259,7 +259,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
if (0 !== count($types)) {
|
||||
$query->accountTypeIn($types);
|
||||
}
|
||||
$query->where('active', 1);
|
||||
$query->where('active', true);
|
||||
$query->orderBy('accounts.account_type_id', 'ASC');
|
||||
$query->orderBy('accounts.order', 'ASC');
|
||||
$query->orderBy('accounts.name', 'ASC');
|
||||
@@ -640,7 +640,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
public function searchAccount(string $query, array $types, int $limit): Collection
|
||||
{
|
||||
$dbQuery = $this->user->accounts()
|
||||
->where('active', 1)
|
||||
->where('active', true)
|
||||
->orderBy('accounts.order', 'ASC')
|
||||
->orderBy('accounts.account_type_id', 'ASC')
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
@@ -669,7 +669,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$dbQuery = $this->user->accounts()->distinct()
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', 1)
|
||||
->where('accounts.active', true)
|
||||
->orderBy('accounts.order', 'ASC')
|
||||
->orderBy('accounts.account_type_id', 'ASC')
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
|
@@ -166,7 +166,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
public function getActiveBills(): Collection
|
||||
{
|
||||
return $this->user->bills()
|
||||
->where('active', 1)
|
||||
->where('active', true)
|
||||
->orderBy('bills.name', 'ASC')
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),]);
|
||||
}
|
||||
|
@@ -197,7 +197,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
*/
|
||||
public function getActiveBudgets(): Collection
|
||||
{
|
||||
return $this->user->budgets()->where('active', 1)
|
||||
return $this->user->budgets()->where('active', true)
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
@@ -282,7 +282,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
$search->where('name', 'LIKE', sprintf('%%%s%%', $query));
|
||||
}
|
||||
$search->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', 1);
|
||||
->orderBy('name', 'ASC')->where('active', true);
|
||||
|
||||
return $search->take($limit)->get();
|
||||
}
|
||||
|
@@ -448,7 +448,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
*/
|
||||
public function searchCurrency(string $search, int $limit): Collection
|
||||
{
|
||||
$query = TransactionCurrency::where('enabled', 1);
|
||||
$query = TransactionCurrency::where('enabled', true);
|
||||
if ('' !== $search) {
|
||||
$query->where('name', 'LIKE', sprintf('%%%s%%', $search));
|
||||
}
|
||||
|
@@ -211,8 +211,8 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
{
|
||||
$collection = $this->user->rules()
|
||||
->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id')
|
||||
->where('rules.active', 1)
|
||||
->where('rule_groups.active', 1)
|
||||
->where('rules.active', true)
|
||||
->where('rule_groups.active', true)
|
||||
->orderBy('rule_groups.order', 'ASC')
|
||||
->orderBy('rules.order', 'ASC')
|
||||
->orderBy('rules.id', 'ASC')
|
||||
@@ -238,8 +238,8 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
{
|
||||
$collection = $this->user->rules()
|
||||
->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id')
|
||||
->where('rules.active', 1)
|
||||
->where('rule_groups.active', 1)
|
||||
->where('rules.active', true)
|
||||
->where('rule_groups.active', true)
|
||||
->orderBy('rule_groups.order', 'ASC')
|
||||
->orderBy('rules.order', 'ASC')
|
||||
->orderBy('rules.id', 'ASC')
|
||||
|
@@ -150,7 +150,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*/
|
||||
public function getActiveGroups(): Collection
|
||||
{
|
||||
return $this->user->ruleGroups()->with(['rules'])->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get(['rule_groups.*']);
|
||||
return $this->user->ruleGroups()->with(['rules'])->where('rule_groups.active', true)->orderBy('order', 'ASC')->get(['rule_groups.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
public function getActiveRules(RuleGroup $group): Collection
|
||||
{
|
||||
return $group->rules()
|
||||
->where('rules.active', 1)
|
||||
->where('rules.active', true)
|
||||
->get(['rules.*']);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
|
||||
->where('rule_triggers.trigger_type', 'user_action')
|
||||
->where('rule_triggers.trigger_value', 'store-journal')
|
||||
->where('rules.active', 1)
|
||||
->where('rules.active', true)
|
||||
->get(['rules.*']);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
|
||||
->where('rule_triggers.trigger_type', 'user_action')
|
||||
->where('rule_triggers.trigger_value', 'update-journal')
|
||||
->where('rules.active', 1)
|
||||
->where('rules.active', true)
|
||||
->get(['rules.*']);
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
*/
|
||||
public function maxOrder(): int
|
||||
{
|
||||
return (int)$this->user->ruleGroups()->where('active', 1)->max('order');
|
||||
return (int)$this->user->ruleGroups()->where('active', true)->max('order');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,7 +337,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
$this->user->ruleGroups()->where('active', false)->update(['order' => 0]);
|
||||
$set = $this->user
|
||||
->ruleGroups()
|
||||
->where('active', 1)
|
||||
->where('active', true)
|
||||
->whereNull('deleted_at')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('title', 'DESC')
|
||||
|
@@ -102,7 +102,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
$journals = $group->transactionJournals->pluck('id')->toArray();
|
||||
$set = Attachment::whereIn('attachable_id', $journals)
|
||||
->where('attachable_type', TransactionJournal::class)
|
||||
->where('uploaded', 1)
|
||||
->where('uploaded', true)
|
||||
->whereNull('deleted_at')->get();
|
||||
|
||||
$result = [];
|
||||
|
@@ -46,7 +46,7 @@ class BudgetList implements BinderInterface
|
||||
if (auth()->check()) {
|
||||
|
||||
if ('allBudgets' === $value) {
|
||||
return auth()->user()->budgets()->where('active', 1)
|
||||
return auth()->user()->budgets()->where('active', true)
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
@@ -63,7 +63,7 @@ class BudgetList implements BinderInterface
|
||||
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->budgets()
|
||||
->where('active', 1)
|
||||
->where('active', true)
|
||||
->whereIn('id', $list)
|
||||
->get();
|
||||
|
||||
|
@@ -383,7 +383,7 @@ class SearchRuleEngine implements RuleEngineInterface
|
||||
{
|
||||
Log::debug(sprintf('SearchRuleEngine:: Will now execute actions on transaction journal #%d', $transaction['transaction_journal_id']));
|
||||
/** @var RuleAction $ruleAction */
|
||||
foreach ($rule->ruleActions()->where('active', 1)->get() as $ruleAction) {
|
||||
foreach ($rule->ruleActions()->where('active', true)->get() as $ruleAction) {
|
||||
$break = $this->processRuleAction($ruleAction, $transaction);
|
||||
if (true === $break) {
|
||||
break;
|
||||
@@ -458,8 +458,15 @@ class SearchRuleEngine implements RuleEngineInterface
|
||||
// start a search query for individual each trigger:
|
||||
$total = new Collection;
|
||||
$count = 0;
|
||||
|
||||
/** @var Collection $triggers */
|
||||
$triggers = $rule->ruleTriggers;
|
||||
|
||||
/** @var RuleTrigger $ruleTrigger */
|
||||
foreach ($rule->ruleTriggers()->where('active', 1)->get() as $ruleTrigger) {
|
||||
foreach ($triggers as $ruleTrigger) {
|
||||
if (false === $ruleTrigger->active) {
|
||||
continue;
|
||||
}
|
||||
if ('user_action' === $ruleTrigger->trigger_type) {
|
||||
Log::debug('Skip trigger type.');
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user