mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Strict comparisons.
This commit is contained in:
parent
c03ab269f0
commit
22144b78ea
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ Homestead.json
|
|||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
.env
|
.env
|
||||||
public/google*.html
|
public/google*.html
|
||||||
|
report.html
|
||||||
|
@ -50,10 +50,10 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->argument('task') == 'update') {
|
if ($this->argument('task') === 'update') {
|
||||||
$this->updateInstructions();
|
$this->updateInstructions();
|
||||||
}
|
}
|
||||||
if ($this->argument('task') == 'install') {
|
if ($this->argument('task') === 'install') {
|
||||||
$this->installInstructions();
|
$this->installInstructions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ class VerifyDatabase extends Command
|
|||||||
{
|
{
|
||||||
$plural = str_plural($name);
|
$plural = str_plural($name);
|
||||||
$class = sprintf('FireflyIII\Models\%s', ucfirst($name));
|
$class = sprintf('FireflyIII\Models\%s', ucfirst($name));
|
||||||
$field = $name == 'tag' ? 'tag' : 'name';
|
$field = $name === 'tag' ? 'tag' : 'name';
|
||||||
$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')
|
$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')
|
||||||
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
|
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
|
||||||
->distinct()
|
->distinct()
|
||||||
|
@ -88,7 +88,7 @@ final class Entry
|
|||||||
$entry->budget_name = $object->budget_name ?? '';
|
$entry->budget_name = $object->budget_name ?? '';
|
||||||
|
|
||||||
// update description when transaction description is different:
|
// update description when transaction description is different:
|
||||||
if (!is_null($object->description) && $object->description != $entry->description) {
|
if (!is_null($object->description) && $object->description !== $entry->description) {
|
||||||
$entry->description = $entry->description . ' (' . $object->description . ')';
|
$entry->description = $entry->description . ' (' . $object->description . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,13 +147,13 @@ class BalanceLine
|
|||||||
if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
|
if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
|
||||||
return $this->getBudget()->name;
|
return $this->getBudget()->name;
|
||||||
}
|
}
|
||||||
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
|
if ($this->getRole() === self::ROLE_DEFAULTROLE) {
|
||||||
return strval(trans('firefly.no_budget'));
|
return strval(trans('firefly.no_budget'));
|
||||||
}
|
}
|
||||||
if ($this->getRole() == self::ROLE_TAGROLE) {
|
if ($this->getRole() === self::ROLE_TAGROLE) {
|
||||||
return strval(trans('firefly.coveredWithTags'));
|
return strval(trans('firefly.coveredWithTags'));
|
||||||
}
|
}
|
||||||
if ($this->getRole() == self::ROLE_DIFFROLE) {
|
if ($this->getRole() === self::ROLE_DIFFROLE) {
|
||||||
return strval(trans('firefly.leftUnbalanced'));
|
return strval(trans('firefly.leftUnbalanced'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class Bill
|
|||||||
{
|
{
|
||||||
$set = $this->bills->sortBy(
|
$set = $this->bills->sortBy(
|
||||||
function (BillLine $bill) {
|
function (BillLine $bill) {
|
||||||
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
|
$active = intval($bill->getBill()->active) === 0 ? 1 : 0;
|
||||||
$name = $bill->getBill()->name;
|
$name = $bill->getBill()->name;
|
||||||
|
|
||||||
return $active . $name;
|
return $active . $name;
|
||||||
|
@ -244,7 +244,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
|||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$leftEntry = $tagsLeft->filter(
|
$leftEntry = $tagsLeft->filter(
|
||||||
function (Tag $tag) use ($account) {
|
function (Tag $tag) use ($account) {
|
||||||
return $tag->account_id == $account->id;
|
return $tag->account_id === $account->id;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$left = '0';
|
$left = '0';
|
||||||
|
@ -56,7 +56,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
foreach ($set as $budget) {
|
foreach ($set as $budget) {
|
||||||
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
|
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
|
||||||
if ($budgetLimits->count() == 0) { // no budget limit(s) for this budget
|
if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget
|
||||||
|
|
||||||
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range
|
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range
|
||||||
if (bccomp($spent, '0') === -1) {
|
if (bccomp($spent, '0') === -1) {
|
||||||
|
@ -316,7 +316,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
||||||
'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
|
@ -153,7 +153,7 @@ class AttachmentController extends Controller
|
|||||||
$image = 'images/page_green.png';
|
$image = 'images/page_green.png';
|
||||||
|
|
||||||
|
|
||||||
if ($attachment->mime == 'application/pdf') {
|
if ($attachment->mime === 'application/pdf') {
|
||||||
$image = 'images/page_white_acrobat.png';
|
$image = 'images/page_white_acrobat.png';
|
||||||
}
|
}
|
||||||
$file = public_path($image);
|
$file = public_path($image);
|
||||||
|
@ -175,7 +175,7 @@ class BillController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
||||||
{
|
{
|
||||||
if (intval($bill->active) == 0) {
|
if (intval($bill->active) === 0) {
|
||||||
$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
|
$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
|
||||||
|
|
||||||
return redirect(URL::previous());
|
return redirect(URL::previous());
|
||||||
@ -206,7 +206,7 @@ class BillController extends Controller
|
|||||||
/** @var Carbon $date */
|
/** @var Carbon $date */
|
||||||
$date = session('start');
|
$date = session('start');
|
||||||
$year = $date->year;
|
$year = $date->year;
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$yearAverage = $repository->getYearAverage($bill, $date);
|
$yearAverage = $repository->getYearAverage($bill, $date);
|
||||||
$overallAverage = $repository->getOverallAverage($bill);
|
$overallAverage = $repository->getOverallAverage($bill);
|
||||||
|
@ -81,7 +81,7 @@ class BudgetController extends Controller
|
|||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
$end = session('end', Carbon::now()->endOfMonth());
|
$end = session('end', Carbon::now()->endOfMonth());
|
||||||
$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);
|
$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);
|
||||||
if ($amount == 0) {
|
if ($amount === 0) {
|
||||||
$budgetLimit = null;
|
$budgetLimit = null;
|
||||||
}
|
}
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
@ -293,7 +293,7 @@ class BudgetController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -318,7 +318,7 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.without_budget_between',
|
'firefly.without_budget_between',
|
||||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
@ -357,7 +357,7 @@ class BudgetController extends Controller
|
|||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = session('first', Carbon::create()->startOfYear());
|
$start = session('first', Carbon::create()->startOfYear());
|
||||||
$end = new Carbon;
|
$end = new Carbon;
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$limits = $this->getLimits($budget, $start, $end);
|
$limits = $this->getLimits($budget, $start, $end);
|
||||||
$repetition = null;
|
$repetition = null;
|
||||||
@ -384,11 +384,11 @@ class BudgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
||||||
{
|
{
|
||||||
if ($budgetLimit->budget->id != $budget->id) {
|
if ($budgetLimit->budget->id !== $budget->id) {
|
||||||
throw new FireflyException('This budget limit is not part of this budget.');
|
throw new FireflyException('This budget limit is not part of this budget.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.budget_in_period', [
|
'firefly.budget_in_period', [
|
||||||
|
@ -199,7 +199,7 @@ class CategoryController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -224,7 +224,7 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.without_category_between',
|
'firefly.without_category_between',
|
||||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
@ -247,7 +247,7 @@ class CategoryController extends Controller
|
|||||||
// default values:
|
// default values:
|
||||||
$subTitle = $category->name;
|
$subTitle = $category->name;
|
||||||
$subTitleIcon = 'fa-bar-chart';
|
$subTitleIcon = 'fa-bar-chart';
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$loop = 0;
|
$loop = 0;
|
||||||
@ -308,7 +308,7 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.journals_in_period_for_category',
|
'firefly.journals_in_period_for_category',
|
||||||
['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
||||||
@ -463,7 +463,7 @@ class CategoryController extends Controller
|
|||||||
$accountRepository = app(AccountRepositoryInterface::class);
|
$accountRepository = app(AccountRepositoryInterface::class);
|
||||||
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$first = $repository->firstUseDate($category);
|
$first = $repository->firstUseDate($category);
|
||||||
if ($first->year == 1900) {
|
if ($first->year === 1900) {
|
||||||
$first = new Carbon;
|
$first = new Carbon;
|
||||||
}
|
}
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
|
@ -124,7 +124,7 @@ class BudgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit)
|
public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit)
|
||||||
{
|
{
|
||||||
if ($budgetLimit->budget->id != $budget->id) {
|
if ($budgetLimit->budget->id !== $budget->id) {
|
||||||
throw new FireflyException('This budget limit is not part of this budget.');
|
throw new FireflyException('This budget limit is not part of this budget.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
$start = $repository->firstUseDate($category);
|
$start = $repository->firstUseDate($category);
|
||||||
|
|
||||||
if ($start->year == 1900) {
|
if ($start->year === 1900) {
|
||||||
$start = new Carbon;
|
$start = new Carbon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class CategoryReportController extends Controller
|
|||||||
// remove all empty entries to prevent cluttering:
|
// remove all empty entries to prevent cluttering:
|
||||||
$newSet = [];
|
$newSet = [];
|
||||||
foreach ($chartData as $key => $entry) {
|
foreach ($chartData as $key => $entry) {
|
||||||
if (!array_sum($entry['entries']) == 0) {
|
if (!array_sum($entry['entries']) === 0) {
|
||||||
$newSet[$key] = $chartData[$key];
|
$newSet[$key] = $chartData[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class TagReportController extends Controller
|
|||||||
// remove all empty entries to prevent cluttering:
|
// remove all empty entries to prevent cluttering:
|
||||||
$newSet = [];
|
$newSet = [];
|
||||||
foreach ($chartData as $key => $entry) {
|
foreach ($chartData as $key => $entry) {
|
||||||
if (!array_sum($entry['entries']) == 0) {
|
if (!array_sum($entry['entries']) === 0) {
|
||||||
$newSet[$key] = $chartData[$key];
|
$newSet[$key] = $chartData[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class HomeController extends Controller
|
|||||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||||
$count = $repository->count($types);
|
$count = $repository->count($types);
|
||||||
|
|
||||||
if ($count == 0) {
|
if ($count === 0) {
|
||||||
return redirect(route('new-user.index'));
|
return redirect(route('new-user.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ class JsonController extends Controller
|
|||||||
$keys = array_keys(config('firefly.rule-triggers'));
|
$keys = array_keys(config('firefly.rule-triggers'));
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
if ($key != 'user_action') {
|
if ($key !== 'user_action') {
|
||||||
$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
|
$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class NewUserController extends Controller
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
$message = strval(trans('firefly.stored_new_accounts_new_user'));
|
$message = strval(trans('firefly.stored_new_accounts_new_user'));
|
||||||
if ($count == 1) {
|
if ($count === 1) {
|
||||||
$message = strval(trans('firefly.stored_new_account_new_user'));
|
$message = strval(trans('firefly.stored_new_account_new_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ class RuleController extends Controller
|
|||||||
// build trigger array from response
|
// build trigger array from response
|
||||||
$triggers = $this->getValidTriggerList($request);
|
$triggers = $this->getValidTriggerList($request);
|
||||||
|
|
||||||
if (count($triggers) == 0) {
|
if (count($triggers) === 0) {
|
||||||
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
|
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,10 +298,10 @@ class RuleController extends Controller
|
|||||||
|
|
||||||
// Warn the user if only a subset of transactions is returned
|
// Warn the user if only a subset of transactions is returned
|
||||||
$warning = '';
|
$warning = '';
|
||||||
if (count($matchingTransactions) == $limit) {
|
if (count($matchingTransactions) === $limit) {
|
||||||
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);
|
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);
|
||||||
}
|
}
|
||||||
if (count($matchingTransactions) == 0) {
|
if (count($matchingTransactions) === 0) {
|
||||||
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);
|
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ class RuleController extends Controller
|
|||||||
|
|
||||||
/** @var RuleTrigger $entry */
|
/** @var RuleTrigger $entry */
|
||||||
foreach ($rule->ruleTriggers as $entry) {
|
foreach ($rule->ruleTriggers as $entry) {
|
||||||
if ($entry->trigger_type != 'user_action') {
|
if ($entry->trigger_type !== 'user_action') {
|
||||||
$count = ($index + 1);
|
$count = ($index + 1);
|
||||||
$triggers[] = view(
|
$triggers[] = view(
|
||||||
'rules.partials.trigger',
|
'rules.partials.trigger',
|
||||||
|
@ -253,7 +253,7 @@ class RuleGroupController extends Controller
|
|||||||
$data = [
|
$data = [
|
||||||
'title' => $request->input('title'),
|
'title' => $request->input('title'),
|
||||||
'description' => $request->input('description'),
|
'description' => $request->input('description'),
|
||||||
'active' => intval($request->input('active')) == 1,
|
'active' => intval($request->input('active')) === 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
$repository->update($ruleGroup, $data);
|
$repository->update($ruleGroup, $data);
|
||||||
|
@ -51,6 +51,10 @@ class SearchController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request, SearchInterface $searcher)
|
public function index(Request $request, SearchInterface $searcher)
|
||||||
{
|
{
|
||||||
|
$query = $request->get('q');
|
||||||
|
|
||||||
|
return view('search.index',compact('query'));
|
||||||
|
|
||||||
// yes, hard coded values:
|
// yes, hard coded values:
|
||||||
$minSearchLen = 1;
|
$minSearchLen = 1;
|
||||||
$limit = 20;
|
$limit = 20;
|
||||||
|
@ -236,7 +236,7 @@ class TagController extends Controller
|
|||||||
// default values:
|
// default values:
|
||||||
$subTitle = $tag->tag;
|
$subTitle = $tag->tag;
|
||||||
$subTitleIcon = 'fa-tag';
|
$subTitleIcon = 'fa-tag';
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$loop = 0;
|
$loop = 0;
|
||||||
@ -301,7 +301,7 @@ class TagController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.journals_in_period_for_tag',
|
'firefly.journals_in_period_for_tag',
|
||||||
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
|
@ -86,7 +86,7 @@ class MassController extends Controller
|
|||||||
foreach ($ids as $journalId) {
|
foreach ($ids as $journalId) {
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = $repository->find(intval($journalId));
|
$journal = $repository->find(intval($journalId));
|
||||||
if (!is_null($journal->id) && $journalId == $journal->id) {
|
if (!is_null($journal->id) && $journalId === $journal->id) {
|
||||||
$set->push($journal);
|
$set->push($journal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class TransactionController extends Controller
|
|||||||
// default values:
|
// default values:
|
||||||
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);
|
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);
|
||||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||||
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
|
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$loop = 0;
|
$loop = 0;
|
||||||
@ -131,7 +131,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moment != 'all' && $loop > 1) {
|
if ($moment !== 'all' && $loop > 1) {
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.title_' . $what . '_between',
|
'firefly.title_' . $what . '_between',
|
||||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||||
|
@ -37,7 +37,7 @@ class TagFormRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function collectTagData(): array
|
public function collectTagData(): array
|
||||||
{
|
{
|
||||||
if ($this->get('setTag') == 'true') {
|
if ($this->get('setTag') === 'true') {
|
||||||
$latitude = $this->string('latitude');
|
$latitude = $this->string('latitude');
|
||||||
$longitude = $this->string('longitude');
|
$longitude = $this->string('longitude');
|
||||||
$zoomLevel = $this->integer('zoomLevel');
|
$zoomLevel = $this->integer('zoomLevel');
|
||||||
|
@ -36,10 +36,10 @@ class Amount implements ConverterInterface
|
|||||||
$decimalPosition = $len - 3;
|
$decimalPosition = $len - 3;
|
||||||
$decimal = null;
|
$decimal = null;
|
||||||
|
|
||||||
if (($len > 2 && $value{$decimalPosition} == '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) {
|
if (($len > 2 && $value{$decimalPosition} === '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) {
|
||||||
$decimal = '.';
|
$decimal = '.';
|
||||||
}
|
}
|
||||||
if ($len > 2 && $value{$decimalPosition} == ',') {
|
if ($len > 2 && $value{$decimalPosition} === ',') {
|
||||||
$decimal = ',';
|
$decimal = ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class AssetAccountIbans implements MapperInterface
|
|||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
||||||
}
|
}
|
||||||
if (strlen($iban) == 0) {
|
if (strlen($iban) === 0) {
|
||||||
$list[$account->id] = $account->name;
|
$list[$account->id] = $account->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class OpposingAccountIbans implements MapperInterface
|
|||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
||||||
}
|
}
|
||||||
if (strlen($iban) == 0) {
|
if (strlen($iban) === 0) {
|
||||||
$list[$account->id] = $account->name;
|
$list[$account->id] = $account->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,11 +152,9 @@ class ImportRoutine
|
|||||||
Log::debug(sprintf('Linking journal #%d to tag #%d...', $journalId, $tagId));
|
Log::debug(sprintf('Linking journal #%d to tag #%d...', $journalId, $tagId));
|
||||||
DB::table('tag_transaction_journal')->insert(['transaction_journal_id' => $journalId, 'tag_id' => $tagId]);
|
DB::table('tag_transaction_journal')->insert(['transaction_journal_id' => $journalId, 'tag_id' => $tagId]);
|
||||||
}
|
}
|
||||||
Log::debug('Done!');
|
|
||||||
Log::info(sprintf('Linked %d journals to tag #%d ("%s")', $this->journals->count(), $tag->id, $tag->tag));
|
Log::info(sprintf('Linked %d journals to tag #%d ("%s")', $this->journals->count(), $tag->id, $tag->tag));
|
||||||
|
|
||||||
return $tag;
|
return $tag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,7 +103,7 @@ class AbnAmroDescription implements SpecificInterface
|
|||||||
$this->row[8] = $matches[4]; // 'opposing-account-name'
|
$this->row[8] = $matches[4]; // 'opposing-account-name'
|
||||||
$this->row[7] = $matches[4]; // 'description'
|
$this->row[7] = $matches[4]; // 'description'
|
||||||
|
|
||||||
if ($matches[1] == 'GEA') {
|
if ($matches[1] === 'GEA') {
|
||||||
$this->row[7] = 'GEA ' . $matches[4]; // 'description'
|
$this->row[7] = 'GEA ' . $matches[4]; // 'description'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class MailError extends Job implements ShouldQueue
|
|||||||
Mail::send(
|
Mail::send(
|
||||||
['emails.error-html', 'emails.error-text'], $args,
|
['emails.error-html', 'emails.error-text'], $args,
|
||||||
function (Message $message) use ($email) {
|
function (Message $message) use ($email) {
|
||||||
if ($email != 'mail@example.com') {
|
if ($email !== 'mail@example.com') {
|
||||||
$message->to($email, $email)->subject('Caught an error in Firely III');
|
$message->to($email, $email)->subject('Caught an error in Firely III');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ class Account extends Model
|
|||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($set as $account) {
|
foreach ($set as $account) {
|
||||||
if ($account->name == $fields['name']) {
|
if ($account->name === $fields['name']) {
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ class Account extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ class Account extends Model
|
|||||||
public function getMeta(string $fieldName): string
|
public function getMeta(string $fieldName): string
|
||||||
{
|
{
|
||||||
foreach ($this->accountMeta as $meta) {
|
foreach ($this->accountMeta as $meta) {
|
||||||
if ($meta->name == $fieldName) {
|
if ($meta->name === $fieldName) {
|
||||||
return strval($meta->data);
|
return strval($meta->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class Attachment extends Model
|
|||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
|
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class Bill extends Model
|
|||||||
public static function routeBinder(Bill $value)
|
public static function routeBinder(Bill $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ class Bill extends Model
|
|||||||
public function getMatchAttribute($value)
|
public function getMatchAttribute($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->match_encrypted) == 1) {
|
if (intval($this->match_encrypted) === 1) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class Bill extends Model
|
|||||||
public function getNameAttribute($value)
|
public function getNameAttribute($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (intval($this->name_encrypted) == 1) {
|
if (intval($this->name_encrypted) === 1) {
|
||||||
return Crypt::decrypt($value);
|
return Crypt::decrypt($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class Budget extends Model
|
|||||||
$set = $query->get(['budgets.*']);
|
$set = $query->get(['budgets.*']);
|
||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
foreach ($set as $budget) {
|
foreach ($set as $budget) {
|
||||||
if ($budget->name == $fields['name']) {
|
if ($budget->name === $fields['name']) {
|
||||||
return $budget;
|
return $budget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ class Budget extends Model
|
|||||||
public static function routeBinder(Budget $value)
|
public static function routeBinder(Budget $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class Category extends Model
|
|||||||
$set = $query->get(['categories.*']);
|
$set = $query->get(['categories.*']);
|
||||||
/** @var Category $category */
|
/** @var Category $category */
|
||||||
foreach ($set as $category) {
|
foreach ($set as $category) {
|
||||||
if ($category->name == $fields['name']) {
|
if ($category->name === $fields['name']) {
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ class Category extends Model
|
|||||||
public static function routeBinder(Category $value)
|
public static function routeBinder(Category $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class ImportJob extends Model
|
|||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value) === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ class ImportJob extends Model
|
|||||||
*/
|
*/
|
||||||
public function getExtendedStatusAttribute($value)
|
public function getExtendedStatusAttribute($value)
|
||||||
{
|
{
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value) === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class PiggyBank extends Model
|
|||||||
public static function routeBinder(PiggyBank $value)
|
public static function routeBinder(PiggyBank $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->account->user_id == auth()->user()->id) {
|
if ($value->account->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class Rule extends Model
|
|||||||
public static function routeBinder(Rule $value)
|
public static function routeBinder(Rule $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class RuleGroup extends Model
|
|||||||
public static function routeBinder(RuleGroup $value)
|
public static function routeBinder(RuleGroup $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class Tag extends Model
|
|||||||
$set = $query->get(['tags.*']);
|
$set = $query->get(['tags.*']);
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($set as $tag) {
|
foreach ($set as $tag) {
|
||||||
if ($tag->tag == $fields['tag']) {
|
if ($tag->tag === $fields['tag']) {
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ class Tag extends Model
|
|||||||
public static function routeBinder(Tag $value)
|
public static function routeBinder(Tag $value)
|
||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
if ($value->user_id == auth()->user()->id) {
|
if ($value->user_id === auth()->user()->id) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ class TransactionJournal extends Model
|
|||||||
public function isDeposit(): bool
|
public function isDeposit(): bool
|
||||||
{
|
{
|
||||||
if (!is_null($this->transaction_type_type)) {
|
if (!is_null($this->transaction_type_type)) {
|
||||||
return $this->transaction_type_type == TransactionType::DEPOSIT;
|
return $this->transaction_type_type === TransactionType::DEPOSIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->transactionType->isDeposit();
|
return $this->transactionType->isDeposit();
|
||||||
@ -220,7 +220,7 @@ class TransactionJournal extends Model
|
|||||||
public function isOpeningBalance(): bool
|
public function isOpeningBalance(): bool
|
||||||
{
|
{
|
||||||
if (!is_null($this->transaction_type_type)) {
|
if (!is_null($this->transaction_type_type)) {
|
||||||
return $this->transaction_type_type == TransactionType::OPENING_BALANCE;
|
return $this->transaction_type_type === TransactionType::OPENING_BALANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->transactionType->isOpeningBalance();
|
return $this->transactionType->isOpeningBalance();
|
||||||
@ -233,7 +233,7 @@ class TransactionJournal extends Model
|
|||||||
public function isTransfer(): bool
|
public function isTransfer(): bool
|
||||||
{
|
{
|
||||||
if (!is_null($this->transaction_type_type)) {
|
if (!is_null($this->transaction_type_type)) {
|
||||||
return $this->transaction_type_type == TransactionType::TRANSFER;
|
return $this->transaction_type_type === TransactionType::TRANSFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->transactionType->isTransfer();
|
return $this->transactionType->isTransfer();
|
||||||
@ -246,7 +246,7 @@ class TransactionJournal extends Model
|
|||||||
public function isWithdrawal(): bool
|
public function isWithdrawal(): bool
|
||||||
{
|
{
|
||||||
if (!is_null($this->transaction_type_type)) {
|
if (!is_null($this->transaction_type_type)) {
|
||||||
return $this->transaction_type_type == TransactionType::WITHDRAWAL;
|
return $this->transaction_type_type === TransactionType::WITHDRAWAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->transactionType->isWithdrawal();
|
return $this->transactionType->isWithdrawal();
|
||||||
|
@ -179,7 +179,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
{
|
{
|
||||||
// update the account:
|
// update the account:
|
||||||
$account->name = $data['name'];
|
$account->name = $data['name'];
|
||||||
$account->active = $data['active'] == '1' ? true : false;
|
$account->active = $data['active'] === '1' ? true : false;
|
||||||
$account->virtual_balance = $data['virtualBalance'];
|
$account->virtual_balance = $data['virtualBalance'];
|
||||||
$account->iban = $data['iban'];
|
$account->iban = $data['iban'];
|
||||||
$account->save();
|
$account->save();
|
||||||
@ -460,12 +460,12 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
// update transactions:
|
// update transactions:
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($journal->transactions()->get() as $transaction) {
|
foreach ($journal->transactions()->get() as $transaction) {
|
||||||
if ($account->id == $transaction->account_id) {
|
if ($account->id === $transaction->account_id) {
|
||||||
$transaction->amount = $amount;
|
$transaction->amount = $amount;
|
||||||
$transaction->transaction_currency_id = $currencyId;
|
$transaction->transaction_currency_id = $currencyId;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
}
|
}
|
||||||
if ($account->id != $transaction->account_id) {
|
if ($account->id !== $transaction->account_id) {
|
||||||
$transaction->amount = bcmul($amount, '-1');
|
$transaction->amount = bcmul($amount, '-1');
|
||||||
$transaction->transaction_currency_id = $currencyId;
|
$transaction->transaction_currency_id = $currencyId;
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
|
@ -116,7 +116,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$set = $set->sortBy(
|
$set = $set->sortBy(
|
||||||
function (Bill $bill) {
|
function (Bill $bill) {
|
||||||
|
|
||||||
$int = $bill->active == 1 ? 0 : 1;
|
$int = $bill->active === 1 ? 0 : 1;
|
||||||
|
|
||||||
return $int . strtolower($bill->name);
|
return $int . strtolower($bill->name);
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$set = $set->sortBy(
|
$set = $set->sortBy(
|
||||||
function (Bill $bill) {
|
function (Bill $bill) {
|
||||||
|
|
||||||
$int = $bill->active == 1 ? 0 : 1;
|
$int = $bill->active === 1 ? 0 : 1;
|
||||||
|
|
||||||
return $int . strtolower($bill->name);
|
return $int . strtolower($bill->name);
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($bill->id == $journal->bill_id) {
|
if ($bill->id === $journal->bill_id) {
|
||||||
// if no match, but bill used to match, remove it:
|
// if no match, but bill used to match, remove it:
|
||||||
$journal->bill_id = null;
|
$journal->bill_id = null;
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
@ -73,7 +73,7 @@ trait UpdateJournalsTrait
|
|||||||
protected function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data)
|
protected function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data)
|
||||||
{
|
{
|
||||||
$set = $journal->transactions()->where('amount', '>', 0)->get();
|
$set = $journal->transactions()->where('amount', '>', 0)->get();
|
||||||
if ($set->count() != 1) {
|
if ($set->count() !== 1) {
|
||||||
throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
|
throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
|
||||||
}
|
}
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
@ -98,7 +98,7 @@ trait UpdateJournalsTrait
|
|||||||
{
|
{
|
||||||
// should be one:
|
// should be one:
|
||||||
$set = $journal->transactions()->where('amount', '<', 0)->get();
|
$set = $journal->transactions()->where('amount', '<', 0)->get();
|
||||||
if ($set->count() != 1) {
|
if ($set->count() !== 1) {
|
||||||
throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
|
throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));
|
||||||
}
|
}
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
@ -140,7 +140,7 @@ trait UpdateJournalsTrait
|
|||||||
DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete();
|
DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete();
|
||||||
}
|
}
|
||||||
// if count is zero, delete them all:
|
// if count is zero, delete them all:
|
||||||
if (count($ids) == 0) {
|
if (count($ids) === 0) {
|
||||||
DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete();
|
DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
$rule->rule_group_id = $data['rule_group_id'];
|
$rule->rule_group_id = $data['rule_group_id'];
|
||||||
$rule->order = ($order + 1);
|
$rule->order = ($order + 1);
|
||||||
$rule->active = 1;
|
$rule->active = 1;
|
||||||
$rule->stop_processing = intval($data['stop_processing']) == 1;
|
$rule->stop_processing = intval($data['stop_processing']) === 1;
|
||||||
$rule->title = $data['title'];
|
$rule->title = $data['title'];
|
||||||
$rule->description = strlen($data['description']) > 0 ? $data['description'] : null;
|
$rule->description = strlen($data['description']) > 0 ? $data['description'] : null;
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* changed to an advancePayment.
|
* changed to an advancePayment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($tag->tagMode == 'balancingAct' || $tag->tagMode == 'nothing') {
|
if ($tag->tagMode === 'balancingAct' || $tag->tagMode === 'nothing') {
|
||||||
foreach ($tag->transactionjournals as $journal) {
|
foreach ($tag->transactionjournals as $journal) {
|
||||||
if ($journal->isTransfer()) {
|
if ($journal->isTransfer()) {
|
||||||
return false;
|
return false;
|
||||||
@ -394,7 +394,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if already has transaction journals, must match ALL asset account id's:
|
// if already has transaction journals, must match ALL asset account id's:
|
||||||
if ($deposits > 0 || $withdrawals == 1) {
|
if ($deposits > 0 || $withdrawals === 1) {
|
||||||
Log::debug('Need to match all asset accounts.');
|
Log::debug('Need to match all asset accounts.');
|
||||||
|
|
||||||
return $this->matchAll($journal, $tag);
|
return $this->matchAll($journal, $tag);
|
||||||
|
@ -52,7 +52,7 @@ class RemoveTag implements ActionInterface
|
|||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
$tag = $journal->user->tags()->get()->filter(
|
$tag = $journal->user->tags()->get()->filter(
|
||||||
function (Tag $tag) use ($name) {
|
function (Tag $tag) use ($name) {
|
||||||
return $tag->tag == $name;
|
return $tag->tag === $name;
|
||||||
}
|
}
|
||||||
)->first();
|
)->first();
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class SetBudget implements ActionInterface
|
|||||||
$budgets = $repository->getActiveBudgets();
|
$budgets = $repository->getActiveBudgets();
|
||||||
$budget = $budgets->filter(
|
$budget = $budgets->filter(
|
||||||
function (Budget $current) use ($search) {
|
function (Budget $current) use ($search) {
|
||||||
return $current->name == $search;
|
return $current->name === $search;
|
||||||
}
|
}
|
||||||
)->first();
|
)->first();
|
||||||
if (is_null($budget)) {
|
if (is_null($budget)) {
|
||||||
@ -65,7 +65,7 @@ class SetBudget implements ActionInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($journal->transactionType->type == TransactionType::TRANSFER) {
|
if ($journal->transactionType->type === TransactionType::TRANSFER) {
|
||||||
Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a transfer.', $journal->id, $search));
|
Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a transfer.', $journal->id, $search));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -254,7 +254,7 @@ final class Processor
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$result = ($hitTriggers == $foundTriggers && $foundTriggers > 0);
|
$result = ($hitTriggers === $foundTriggers && $foundTriggers > 0);
|
||||||
Log::debug('Result of triggered()', ['hitTriggers' => $hitTriggers, 'foundTriggers' => $foundTriggers, 'result' => $result]);
|
Log::debug('Result of triggered()', ['hitTriggers' => $hitTriggers, 'foundTriggers' => $foundTriggers, 'result' => $result]);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -75,7 +75,7 @@ class CacheProperties
|
|||||||
*/
|
*/
|
||||||
public function has(): bool
|
public function has(): bool
|
||||||
{
|
{
|
||||||
if (getenv('APP_ENV') == 'testing') {
|
if (getenv('APP_ENV') === 'testing') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->md5();
|
$this->md5();
|
||||||
|
@ -96,7 +96,7 @@ class Navigation
|
|||||||
// if the range is custom, the end of the period
|
// if the range is custom, the end of the period
|
||||||
// is another X days (x is the difference between start)
|
// is another X days (x is the difference between start)
|
||||||
// and end added to $theCurrentEnd
|
// and end added to $theCurrentEnd
|
||||||
if ($repeatFreq == 'custom') {
|
if ($repeatFreq === 'custom') {
|
||||||
/** @var Carbon $tStart */
|
/** @var Carbon $tStart */
|
||||||
$tStart = session('start', Carbon::now()->startOfMonth());
|
$tStart = session('start', Carbon::now()->startOfMonth());
|
||||||
/** @var Carbon $tEnd */
|
/** @var Carbon $tEnd */
|
||||||
@ -393,7 +393,7 @@ class Navigation
|
|||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
if ($repeatFreq == 'half-year' || $repeatFreq == '6M') {
|
if ($repeatFreq === 'half-year' || $repeatFreq === '6M') {
|
||||||
$month = $date->month;
|
$month = $date->month;
|
||||||
$date->startOfYear();
|
$date->startOfYear();
|
||||||
if ($month >= 7) {
|
if ($month >= 7) {
|
||||||
@ -496,7 +496,7 @@ class Navigation
|
|||||||
|
|
||||||
return $end;
|
return $end;
|
||||||
}
|
}
|
||||||
if ($range == '6M') {
|
if ($range === '6M') {
|
||||||
if ($start->month >= 7) {
|
if ($start->month >= 7) {
|
||||||
$end->endOfYear();
|
$end->endOfYear();
|
||||||
|
|
||||||
@ -532,7 +532,7 @@ class Navigation
|
|||||||
|
|
||||||
return $start;
|
return $start;
|
||||||
}
|
}
|
||||||
if ($range == '6M') {
|
if ($range === '6M') {
|
||||||
if ($start->month >= 7) {
|
if ($start->month >= 7) {
|
||||||
$start->startOfYear()->addMonths(6);
|
$start->startOfYear()->addMonths(6);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class General extends Twig_Extension
|
|||||||
$what = $args[2]; // name of the route.
|
$what = $args[2]; // name of the route.
|
||||||
$activeWhat = $context['what'] ?? false;
|
$activeWhat = $context['what'] ?? false;
|
||||||
|
|
||||||
if ($what == $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
||||||
return 'active';
|
return 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ class General extends Twig_Extension
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$route = $args[0]; // name of the route.
|
$route = $args[0]; // name of the route.
|
||||||
|
|
||||||
if (Route::getCurrentRoute()->getName() == $route) {
|
if (Route::getCurrentRoute()->getName() === $route) {
|
||||||
return 'active';
|
return 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class Journal extends Twig_Extension
|
|||||||
$array = [];
|
$array = [];
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
if ($entry->accountType->type == AccountType::CASH) {
|
if ($entry->accountType->type === AccountType::CASH) {
|
||||||
$array[] = '<span class="text-success">(cash)</span>';
|
$array[] = '<span class="text-success">(cash)</span>';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ class Journal extends Twig_Extension
|
|||||||
$array = [];
|
$array = [];
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
if ($entry->accountType->type == 'Cash account') {
|
if ($entry->accountType->type === AccountType::CASH) {
|
||||||
$array[] = '<span class="text-success">(cash)</span>';
|
$array[] = '<span class="text-success">(cash)</span>';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class Rule extends Twig_Extension
|
|||||||
$ruleTriggers = array_keys(Config::get('firefly.rule-triggers'));
|
$ruleTriggers = array_keys(Config::get('firefly.rule-triggers'));
|
||||||
$possibleTriggers = [];
|
$possibleTriggers = [];
|
||||||
foreach ($ruleTriggers as $key) {
|
foreach ($ruleTriggers as $key) {
|
||||||
if ($key != 'user_action') {
|
if ($key !== 'user_action') {
|
||||||
$possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
|
$possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
|
|
||||||
foreach ($this->roles as $role) {
|
foreach ($this->roles as $role) {
|
||||||
if ($role->name == $name) {
|
if ($role->name === $name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ class FireflyValidator extends Validator
|
|||||||
// count budgets, should have at least one
|
// count budgets, should have at least one
|
||||||
$count = $budgets->filter(
|
$count = $budgets->filter(
|
||||||
function (Budget $budget) use ($value) {
|
function (Budget $budget) use ($value) {
|
||||||
return $budget->name == $value;
|
return $budget->name === $value;
|
||||||
}
|
}
|
||||||
)->count();
|
)->count();
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ class FireflyValidator extends Validator
|
|||||||
|
|
||||||
/** @var AccountMeta $entry */
|
/** @var AccountMeta $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
if ($entry->data == $value) {
|
if ($entry->data === $value) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ class FireflyValidator extends Validator
|
|||||||
/** @var PiggyBank $entry */
|
/** @var PiggyBank $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$fieldValue = $this->tryDecrypt($entry->name);
|
$fieldValue = $this->tryDecrypt($entry->name);
|
||||||
if ($fieldValue == $value) {
|
if ($fieldValue === $value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ class FireflyValidator extends Validator
|
|||||||
$set = $user->accounts()->where('account_type_id', $type->id)->get();
|
$set = $user->accounts()->where('account_type_id', $type->id)->get();
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
if ($entry->name == $value) {
|
if ($entry->name === $value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ class FireflyValidator extends Validator
|
|||||||
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
if ($entry->name == $value) {
|
if ($entry->name === $value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ class FireflyValidator extends Validator
|
|||||||
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
if ($entry->name == $value) {
|
if ($entry->name === $value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,7 +534,7 @@ class FireflyValidator extends Validator
|
|||||||
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
|
||||||
/** @var Account $entry */
|
/** @var Account $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
if ($entry->name == $value) {
|
if ($entry->name === $value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user