mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Rearrange code [skip ci]
This commit is contained in:
parent
f19b99194c
commit
848cfabcba
@ -50,7 +50,7 @@ class CreateImport extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
@ -73,10 +73,10 @@ class UpgradeDatabase extends Command
|
||||
|
||||
|
||||
$subQuery = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->groupBy(['transaction_journals.id'])
|
||||
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->groupBy(['transaction_journals.id'])
|
||||
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
||||
|
||||
$result = DB::table(DB::raw('(' . $subQuery->toSql() . ') AS derived'))
|
||||
->mergeBindings($subQuery->getQuery())
|
||||
@ -98,9 +98,9 @@ class UpgradeDatabase extends Command
|
||||
try {
|
||||
/** @var Transaction $opposing */
|
||||
$opposing = Transaction::where('transaction_journal_id', $journalId)
|
||||
->where('amount', $amount)->where('identifier', '=', 0)
|
||||
->whereNotIn('id', $processed)
|
||||
->first();
|
||||
->where('amount', $amount)->where('identifier', '=', 0)
|
||||
->whereNotIn('id', $processed)
|
||||
->first();
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e->getMessage());
|
||||
$this->error('Firefly III could not find the "identifier" field in the "transactions" table.');
|
||||
|
@ -17,8 +17,6 @@ use Crypt;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
@ -103,12 +101,12 @@ class VerifyDatabase extends Command
|
||||
private function reportAccounts()
|
||||
{
|
||||
$set = Account::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')
|
||||
->leftJoin('users', 'accounts.user_id', '=', 'users.id')
|
||||
->groupBy(['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email'])
|
||||
->whereNull('transactions.account_id')
|
||||
->get(
|
||||
['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email']
|
||||
);
|
||||
->leftJoin('users', 'accounts.user_id', '=', 'users.id')
|
||||
->groupBy(['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email'])
|
||||
->whereNull('transactions.account_id')
|
||||
->get(
|
||||
['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email']
|
||||
);
|
||||
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
@ -125,10 +123,10 @@ class VerifyDatabase extends Command
|
||||
private function reportBudgetLimits()
|
||||
{
|
||||
$set = Budget::leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budgets.id')
|
||||
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
|
||||
->groupBy(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email'])
|
||||
->whereNull('budget_limits.id')
|
||||
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']);
|
||||
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
|
||||
->groupBy(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email'])
|
||||
->whereNull('budget_limits.id')
|
||||
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']);
|
||||
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
@ -147,20 +145,20 @@ class VerifyDatabase extends Command
|
||||
private function reportDeletedAccounts()
|
||||
{
|
||||
$set = Account::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->whereNotNull('accounts.deleted_at')
|
||||
->whereNotNull('transactions.id')
|
||||
->where(
|
||||
function (Builder $q) {
|
||||
$q->whereNull('transactions.deleted_at');
|
||||
$q->orWhereNull('transaction_journals.deleted_at');
|
||||
}
|
||||
)
|
||||
->get(
|
||||
['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id',
|
||||
'transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id',
|
||||
'transaction_journals.deleted_at as journal_deleted_at']
|
||||
);
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->whereNotNull('accounts.deleted_at')
|
||||
->whereNotNull('transactions.id')
|
||||
->where(
|
||||
function (Builder $q) {
|
||||
$q->whereNull('transactions.deleted_at');
|
||||
$q->orWhereNull('transaction_journals.deleted_at');
|
||||
}
|
||||
)
|
||||
->get(
|
||||
['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id',
|
||||
'transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id',
|
||||
'transaction_journals.deleted_at as journal_deleted_at']
|
||||
);
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
$date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at;
|
||||
@ -185,14 +183,17 @@ class VerifyDatabase extends Command
|
||||
];
|
||||
foreach ($configuration as $transactionType => $accountTypes) {
|
||||
$set = TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', 'accounts.account_type_id')
|
||||
->leftJoin('users', 'users.id', '=', 'transaction_journals.user_id')
|
||||
->where('transaction_types.type', $transactionType)
|
||||
->whereIn('account_types.type', $accountTypes)
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->get(['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type', 'transaction_types.type']);
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', 'accounts.account_type_id')
|
||||
->leftJoin('users', 'users.id', '=', 'transaction_journals.user_id')
|
||||
->where('transaction_types.type', $transactionType)
|
||||
->whereIn('account_types.type', $accountTypes)
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->get(
|
||||
['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type',
|
||||
'transaction_types.type']
|
||||
);
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
sprintf(
|
||||
@ -215,17 +216,17 @@ class VerifyDatabase extends Command
|
||||
private function reportJournals()
|
||||
{
|
||||
$set = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNotNull('transaction_journals.deleted_at')// USE THIS
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNotNull('transactions.id')
|
||||
->get(
|
||||
[
|
||||
'transaction_journals.id as journal_id',
|
||||
'transaction_journals.description',
|
||||
'transaction_journals.deleted_at as journal_deleted',
|
||||
'transactions.id as transaction_id',
|
||||
'transactions.deleted_at as transaction_deleted_at']
|
||||
);
|
||||
->whereNotNull('transaction_journals.deleted_at')// USE THIS
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNotNull('transactions.id')
|
||||
->get(
|
||||
[
|
||||
'transaction_journals.id as journal_id',
|
||||
'transaction_journals.description',
|
||||
'transaction_journals.deleted_at as journal_deleted',
|
||||
'transactions.id as transaction_id',
|
||||
'transactions.deleted_at as transaction_deleted_at']
|
||||
);
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
@ -241,9 +242,9 @@ class VerifyDatabase extends Command
|
||||
private function reportNoTransactions()
|
||||
{
|
||||
$set = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->groupBy('transaction_journals.id')
|
||||
->whereNull('transactions.transaction_journal_id')
|
||||
->get(['transaction_journals.id']);
|
||||
->groupBy('transaction_journals.id')
|
||||
->whereNull('transactions.transaction_journal_id')
|
||||
->get(['transaction_journals.id']);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
@ -262,11 +263,11 @@ class VerifyDatabase extends Command
|
||||
$class = sprintf('FireflyIII\Models\%s', ucfirst($name));
|
||||
$field = $name == 'tag' ? 'tag' : 'name';
|
||||
$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')
|
||||
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
|
||||
->distinct()
|
||||
->whereNull($name . '_transaction_journal.' . $name . '_id')
|
||||
->whereNull($plural . '.deleted_at')
|
||||
->get([$plural . '.id', $plural . '.' . $field . ' as name', $plural . '.user_id', 'users.email']);
|
||||
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
|
||||
->distinct()
|
||||
->whereNull($name . '_transaction_journal.' . $name . '_id')
|
||||
->whereNull($plural . '.deleted_at')
|
||||
->get([$plural . '.id', $plural . '.' . $field . ' as name', $plural . '.user_id', 'users.email']);
|
||||
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
@ -309,12 +310,12 @@ class VerifyDatabase extends Command
|
||||
private function reportTransactions()
|
||||
{
|
||||
$set = Transaction::leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNotNull('transactions.deleted_at')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->get(
|
||||
['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id',
|
||||
'transaction_journals.deleted_at']
|
||||
);
|
||||
->whereNotNull('transactions.deleted_at')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->get(
|
||||
['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id',
|
||||
'transaction_journals.deleted_at']
|
||||
);
|
||||
/** @var stdClass $entry */
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
@ -330,10 +331,10 @@ class VerifyDatabase extends Command
|
||||
private function reportTransfersBudgets()
|
||||
{
|
||||
$set = TransactionJournal::distinct()
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->leftJoin('budget_transaction_journal', 'transaction_journals.id', '=', 'budget_transaction_journal.transaction_journal_id')
|
||||
->where('transaction_types.type', TransactionType::TRANSFER)
|
||||
->whereNotNull('budget_transaction_journal.budget_id')->get(['transaction_journals.id']);
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->leftJoin('budget_transaction_journal', 'transaction_journals.id', '=', 'budget_transaction_journal.transaction_journal_id')
|
||||
->where('transaction_types.type', TransactionType::TRANSFER)
|
||||
->whereNotNull('budget_transaction_journal.budget_id')->get(['transaction_journals.id']);
|
||||
|
||||
/** @var TransactionJournal $entry */
|
||||
foreach ($set as $entry) {
|
||||
|
@ -293,55 +293,55 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
|
||||
{
|
||||
$accountIds = $this->accounts->pluck('id')->toArray();
|
||||
$this->workSet = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin(
|
||||
'transactions AS opposing', function (JoinClause $join) {
|
||||
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
|
||||
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'))
|
||||
->where('transactions.identifier', '=', DB::raw('opposing.identifier'));
|
||||
}
|
||||
)
|
||||
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
|
||||
->leftJoin('accounts AS opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id')
|
||||
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', 'transaction_types.id')
|
||||
->leftJoin('transaction_currencies', 'transaction_journals.transaction_currency_id', '=', 'transaction_currencies.id')
|
||||
->whereIn('transactions.account_id', $accountIds)
|
||||
->where('transaction_journals.user_id', $this->job->user_id)
|
||||
->where('transaction_journals.date', '>=', $this->start->format('Y-m-d'))
|
||||
->where('transaction_journals.date', '<=', $this->end->format('Y-m-d'))
|
||||
->where('transaction_journals.completed', 1)
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNull('opposing.deleted_at')
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transactions.identifier', 'ASC')
|
||||
->get(
|
||||
[
|
||||
'transactions.id',
|
||||
'transactions.amount',
|
||||
'transactions.description',
|
||||
'transactions.account_id',
|
||||
'accounts.name as account_name',
|
||||
'accounts.encrypted as account_name_encrypted',
|
||||
'transactions.identifier',
|
||||
->leftJoin(
|
||||
'transactions AS opposing', function (JoinClause $join) {
|
||||
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
|
||||
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'))
|
||||
->where('transactions.identifier', '=', DB::raw('opposing.identifier'));
|
||||
}
|
||||
)
|
||||
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
|
||||
->leftJoin('accounts AS opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id')
|
||||
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', 'transaction_types.id')
|
||||
->leftJoin('transaction_currencies', 'transaction_journals.transaction_currency_id', '=', 'transaction_currencies.id')
|
||||
->whereIn('transactions.account_id', $accountIds)
|
||||
->where('transaction_journals.user_id', $this->job->user_id)
|
||||
->where('transaction_journals.date', '>=', $this->start->format('Y-m-d'))
|
||||
->where('transaction_journals.date', '<=', $this->end->format('Y-m-d'))
|
||||
->where('transaction_journals.completed', 1)
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNull('opposing.deleted_at')
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transactions.identifier', 'ASC')
|
||||
->get(
|
||||
[
|
||||
'transactions.id',
|
||||
'transactions.amount',
|
||||
'transactions.description',
|
||||
'transactions.account_id',
|
||||
'accounts.name as account_name',
|
||||
'accounts.encrypted as account_name_encrypted',
|
||||
'transactions.identifier',
|
||||
|
||||
'opposing.id as opposing_id',
|
||||
'opposing.amount AS opposing_amount',
|
||||
'opposing.description as opposing_description',
|
||||
'opposing.account_id as opposing_account_id',
|
||||
'opposing_accounts.name as opposing_account_name',
|
||||
'opposing_accounts.encrypted as opposing_account_encrypted',
|
||||
'opposing.identifier as opposing_identifier',
|
||||
'opposing.id as opposing_id',
|
||||
'opposing.amount AS opposing_amount',
|
||||
'opposing.description as opposing_description',
|
||||
'opposing.account_id as opposing_account_id',
|
||||
'opposing_accounts.name as opposing_account_name',
|
||||
'opposing_accounts.encrypted as opposing_account_encrypted',
|
||||
'opposing.identifier as opposing_identifier',
|
||||
|
||||
'transaction_journals.id as transaction_journal_id',
|
||||
'transaction_journals.date',
|
||||
'transaction_journals.description as journal_description',
|
||||
'transaction_journals.encrypted as journal_encrypted',
|
||||
'transaction_journals.transaction_type_id',
|
||||
'transaction_types.type as transaction_type',
|
||||
'transaction_journals.transaction_currency_id',
|
||||
'transaction_currencies.code AS transaction_currency_code',
|
||||
'transaction_journals.id as transaction_journal_id',
|
||||
'transaction_journals.date',
|
||||
'transaction_journals.description as journal_description',
|
||||
'transaction_journals.encrypted as journal_encrypted',
|
||||
'transaction_journals.transaction_type_id',
|
||||
'transaction_types.type as transaction_type',
|
||||
'transaction_journals.transaction_currency_id',
|
||||
'transaction_currencies.code AS transaction_currency_code',
|
||||
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function collectVintageUploads():bool
|
||||
private function collectVintageUploads(): bool
|
||||
{
|
||||
// grab upload directory.
|
||||
$files = $this->uploadDisk->files();
|
||||
|
@ -21,17 +21,6 @@ namespace FireflyIII\Generator\Chart\Basic;
|
||||
interface GeneratorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Expects data as:
|
||||
*
|
||||
* key => value
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pieChart(array $data): array;
|
||||
|
||||
/**
|
||||
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
|
||||
*
|
||||
@ -57,6 +46,17 @@ interface GeneratorInterface
|
||||
*/
|
||||
public function multiSet(array $data): array;
|
||||
|
||||
/**
|
||||
* Expects data as:
|
||||
*
|
||||
* key => value
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pieChart(array $data): array;
|
||||
|
||||
/**
|
||||
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
|
||||
*
|
||||
|
@ -142,6 +142,35 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pieChart(array $entries): array
|
||||
{
|
||||
$data = [
|
||||
'datasets' => [
|
||||
0 => [],
|
||||
],
|
||||
'labels' => [],
|
||||
];
|
||||
$index = 0;
|
||||
foreach ($entries as $entry) {
|
||||
|
||||
if (bccomp($entry['amount'], '0') === -1) {
|
||||
$entry['amount'] = bcmul($entry['amount'], '-1');
|
||||
}
|
||||
|
||||
$data['datasets'][0]['data'][] = round($entry['amount'], 2);
|
||||
$data['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||
$data['labels'][] = $entry['name'];
|
||||
$index++;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $entries
|
||||
*
|
||||
@ -177,33 +206,4 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pieChart(array $entries): array
|
||||
{
|
||||
$data = [
|
||||
'datasets' => [
|
||||
0 => [],
|
||||
],
|
||||
'labels' => [],
|
||||
];
|
||||
$index = 0;
|
||||
foreach ($entries as $entry) {
|
||||
|
||||
if (bccomp($entry['amount'], '0') === -1) {
|
||||
$entry['amount'] = bcmul($entry['amount'], '-1');
|
||||
}
|
||||
|
||||
$data['datasets'][0]['data'][] = round($entry['amount'], 2);
|
||||
$data['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||
$data['labels'][] = $entry['name'];
|
||||
$index++;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function netWorth(Collection $entries) : array
|
||||
public function netWorth(Collection $entries): array
|
||||
{
|
||||
$format = (string)trans('config.month_and_day');
|
||||
$data = [
|
||||
|
@ -44,7 +44,7 @@ interface ReportChartGeneratorInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function netWorth(Collection $entries) : array;
|
||||
public function netWorth(Collection $entries): array;
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
|
@ -38,7 +38,7 @@ class BudgetEventHandler
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function storeRepetition(StoredBudgetLimit $budgetLimitEvent):bool
|
||||
public function storeRepetition(StoredBudgetLimit $budgetLimitEvent): bool
|
||||
{
|
||||
return $this->processRepetitionChange($budgetLimitEvent->budgetLimit, $budgetLimitEvent->end);
|
||||
}
|
||||
@ -61,7 +61,7 @@ class BudgetEventHandler
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function processRepetitionChange(BudgetLimit $budgetLimit, Carbon $date):bool
|
||||
private function processRepetitionChange(BudgetLimit $budgetLimit, Carbon $date): bool
|
||||
{
|
||||
$set = $budgetLimit->limitrepetitions()
|
||||
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
|
||||
|
@ -35,7 +35,7 @@ class UpdatedJournalEventHandler
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function processRules(UpdatedTransactionJournal $updatedJournalEvent):bool
|
||||
public function processRules(UpdatedTransactionJournal $updatedJournalEvent): bool
|
||||
{
|
||||
// get all the user's rule groups, with the rules, order by 'order'.
|
||||
$journal = $updatedJournalEvent->journal;
|
||||
|
@ -79,6 +79,22 @@ class BillLine
|
||||
$this->bill = $bill;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getLastHitDate(): Carbon
|
||||
{
|
||||
return $this->lastHitDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $lastHitDate
|
||||
*/
|
||||
public function setLastHitDate(Carbon $lastHitDate)
|
||||
{
|
||||
$this->lastHitDate = $lastHitDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -151,21 +167,5 @@ class BillLine
|
||||
$this->hit = $hit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $lastHitDate
|
||||
*/
|
||||
public function setLastHitDate(Carbon $lastHitDate)
|
||||
{
|
||||
$this->lastHitDate = $lastHitDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getLastHitDate(): Carbon
|
||||
{
|
||||
return $this->lastHitDate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class Help implements HelpInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRoute(string $route):bool
|
||||
public function hasRoute(string $route): bool
|
||||
{
|
||||
return Route::has($route);
|
||||
}
|
||||
@ -99,7 +99,7 @@ class Help implements HelpInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inCache(string $route, string $language):bool
|
||||
public function inCache(string $route, string $language): bool
|
||||
{
|
||||
$line = sprintf('help.%s.%s', $route, $language);
|
||||
$result = Cache::has($line);
|
||||
|
@ -34,7 +34,7 @@ interface HelpInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromGithub(string $language, string $route):string;
|
||||
public function getFromGithub(string $language, string $route): string;
|
||||
|
||||
/**
|
||||
* @param string $route
|
||||
|
@ -61,6 +61,7 @@ class ConfigurationController extends Controller
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$siteOwner = env('SITE_OWNER');
|
||||
|
||||
// email settings:
|
||||
$sendErrorMessage = [
|
||||
@ -71,7 +72,10 @@ class ConfigurationController extends Controller
|
||||
'mail_for_blocked_login' => FireflyConfig::get('mail_for_blocked_login', config('firefly.configuration.mail_for_blocked_login'))->data,
|
||||
];
|
||||
|
||||
return view('admin.configuration.index', compact('subTitle', 'subTitleIcon', 'singleUserMode', 'mustConfirmAccount', 'isDemoSite', 'sendErrorMessage'));
|
||||
return view(
|
||||
'admin.configuration.index',
|
||||
compact('subTitle', 'subTitleIcon', 'singleUserMode', 'mustConfirmAccount', 'isDemoSite', 'sendErrorMessage', 'siteOwner')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\BlockedUseOfDomain;
|
||||
use FireflyIII\Events\BlockedUseOfEmail;
|
||||
use FireflyIII\Events\RegisteredUser;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyConfig;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Http\Request;
|
||||
@ -114,7 +114,6 @@ class RegisterController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
$user = $this->create($request->all());
|
||||
|
||||
// trigger user registration event:
|
||||
|
@ -238,7 +238,7 @@ class AccountController extends Controller
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
|
||||
Log::debug('Default set is ', $defaultSet);
|
||||
$frontPage = Preferences::get('frontPageAccounts', $defaultSet);
|
||||
$frontPage = Preferences::get('frontPageAccounts', $defaultSet);
|
||||
Log::debug('Frontpage preference set is ', $frontPage->data);
|
||||
if (count($frontPage->data) === 0) {
|
||||
$frontPage->data = $defaultSet;
|
||||
|
@ -70,7 +70,7 @@ class BillController extends Controller
|
||||
strval(trans('firefly.paid')) => $paid,
|
||||
];
|
||||
|
||||
$data = $this->generator->pieChart($chartData);
|
||||
$data = $this->generator->pieChart($chartData);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
@ -127,7 +127,7 @@ class BillController extends Controller
|
||||
$chartData[2]['entries'][$date] = bcmul($entry->transaction_amount, '-1');
|
||||
}
|
||||
|
||||
$data = $this->generator->multiSet($chartData);
|
||||
$data = $this->generator->multiSet($chartData);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
|
@ -204,7 +204,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty('budget');
|
||||
$cache->addProperty('period');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
|
||||
// the expenses:
|
||||
@ -274,15 +274,15 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
// the expenses:
|
||||
$periods = Navigation::listOfPeriods($start, $end);
|
||||
$entries = $repository->getNoBudgetPeriodReport($accounts, $start, $end);
|
||||
$periods = Navigation::listOfPeriods($start, $end);
|
||||
$entries = $repository->getNoBudgetPeriodReport($accounts, $start, $end);
|
||||
|
||||
// join them:
|
||||
$result = [];
|
||||
foreach (array_keys($periods) as $period) {
|
||||
$nice = $periods[$period];
|
||||
$result[$nice] = [
|
||||
'spent' => isset($entries['entries'][$period]) ? $entries['entries'][$period] : '0',
|
||||
'spent' => isset($entries['entries'][$period]) ? $entries['entries'][$period] : '0',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,9 @@ class ReportController extends Controller
|
||||
* which means that giving it a 2 week "period" should be enough granularity.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function netWorth(Collection $accounts, Carbon $start, Carbon $end)
|
||||
@ -131,6 +132,7 @@ class ReportController extends Controller
|
||||
|
||||
/**
|
||||
* Shows sum income and expense, debet/credit: operations
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
@ -301,7 +303,7 @@ class ReportController extends Controller
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function arraySum($array) : string
|
||||
private function arraySum($array): string
|
||||
{
|
||||
$sum = '0';
|
||||
foreach ($array as $entry) {
|
||||
|
@ -121,7 +121,7 @@ class CurrencyController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
|
||||
public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
|
||||
{
|
||||
if (!$repository->canDeleteCurrency($currency)) {
|
||||
Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
|
||||
@ -170,7 +170,7 @@ class CurrencyController extends Controller
|
||||
|
||||
|
||||
if (!auth()->user()->hasRole('owner')) {
|
||||
Session::flash('warning', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
|
||||
Session::flash('warning', trans('firefly.ask_site_owner', ['site_owner' => env('SITE_OWNER')]));
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ namespace FireflyIII\Http\Controllers;
|
||||
use Carbon\Carbon;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Export\Processor;
|
||||
use FireflyIII\Export\ProcessorInterface;
|
||||
use FireflyIII\Http\Requests\ExportFormRequest;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
@ -208,7 +208,7 @@ class HomeController extends Controller
|
||||
'debugbar',
|
||||
'attachments.preview',
|
||||
'budgets.income',
|
||||
'currencies.default'
|
||||
'currencies.default',
|
||||
|
||||
|
||||
];
|
||||
|
@ -212,7 +212,7 @@ class PreferencesController extends Controller
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getDomain() : string
|
||||
private function getDomain(): string
|
||||
{
|
||||
$url = url()->to('/');
|
||||
$parts = parse_url($url);
|
||||
|
@ -36,7 +36,7 @@ class BalanceController extends Controller
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function general(BalanceReportHelperInterface $helper,Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@ namespace FireflyIII\Http\Controllers\Report;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
@ -57,6 +56,33 @@ class OperationsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('income-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
//return $cache->get();
|
||||
}
|
||||
$income = $this->getIncomeReport($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.income', compact('income'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
@ -101,33 +127,6 @@ class OperationsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('income-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
//return $cache->get();
|
||||
}
|
||||
$income = $this->getIncomeReport($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.income', compact('income'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
|
@ -80,7 +80,7 @@ class AccountFormRequest extends Request
|
||||
'name' => $nameRule,
|
||||
'openingBalance' => 'numeric',
|
||||
'iban' => 'iban',
|
||||
'BIC' => 'bic',
|
||||
'BIC' => 'bic',
|
||||
'virtualBalance' => 'numeric',
|
||||
'openingBalanceDate' => 'date',
|
||||
'currency_id' => 'exists:transaction_currencies,id',
|
||||
|
@ -161,6 +161,7 @@ class JournalFormRequest extends Request
|
||||
private function getFieldOrEmptyString(string $field): string
|
||||
{
|
||||
$string = $this->get($field) ?? '';
|
||||
|
||||
return trim($string);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class ReportFormRequest extends Request
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAccountList():Collection
|
||||
public function getAccountList(): Collection
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
@ -59,27 +59,6 @@ class ReportFormRequest extends Request
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCategoryList(): Collection
|
||||
{
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$set = $this->get('category');
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find(intval($categoryId));
|
||||
if (!is_null($category->id)) {
|
||||
$collection->push($category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
@ -101,6 +80,27 @@ class ReportFormRequest extends Request
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCategoryList(): Collection
|
||||
{
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$set = $this->get('category');
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find(intval($categoryId));
|
||||
if (!is_null($category->id)) {
|
||||
$collection->push($category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
* @throws FireflyException
|
||||
|
@ -35,7 +35,7 @@ class TagFormRequest extends Request
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function collectTagData() :array
|
||||
public function collectTagData(): array
|
||||
{
|
||||
if ($this->get('setTag') == 'true') {
|
||||
$latitude = $this->get('latitude');
|
||||
|
@ -67,7 +67,7 @@ Breadcrumbs::register(
|
||||
|
||||
Breadcrumbs::register(
|
||||
'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
|
||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
||||
$breadcrumbs->parent('accounts.index', $what);
|
||||
$breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
|
||||
|
@ -37,7 +37,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCertainty():int
|
||||
public function getCertainty(): int
|
||||
{
|
||||
return $this->certainty;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ class CsvSetup implements SetupInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getDataForColumnRoles():array
|
||||
private function getDataForColumnRoles(): array
|
||||
{
|
||||
Log::debug('Now in getDataForColumnRoles()');
|
||||
$config = $this->job->configuration;
|
||||
|
@ -200,10 +200,10 @@ class Account extends Model
|
||||
public function getOpeningBalanceAmount(): string
|
||||
{
|
||||
$journal = TransactionJournal::sortCorrectly()
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $this->id)
|
||||
->transactionTypes([TransactionType::OPENING_BALANCE])
|
||||
->first(['transaction_journals.*']);
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $this->id)
|
||||
->transactionTypes([TransactionType::OPENING_BALANCE])
|
||||
->first(['transaction_journals.*']);
|
||||
if (is_null($journal)) {
|
||||
return '0';
|
||||
}
|
||||
@ -230,10 +230,10 @@ class Account extends Model
|
||||
{
|
||||
$date = new Carbon('1900-01-01');
|
||||
$journal = TransactionJournal::sortCorrectly()
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $this->id)
|
||||
->transactionTypes([TransactionType::OPENING_BALANCE])
|
||||
->first(['transaction_journals.*']);
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $this->id)
|
||||
->transactionTypes([TransactionType::OPENING_BALANCE])
|
||||
->first(['transaction_journals.*']);
|
||||
if (is_null($journal)) {
|
||||
return $date;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class Transaction extends Model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isJoined(Builder $query, string $table):bool
|
||||
public static function isJoined(Builder $query, string $table): bool
|
||||
{
|
||||
$joins = $query->getQuery()->joins;
|
||||
if (is_null($joins)) {
|
||||
|
@ -65,9 +65,9 @@ class TransactionJournal extends TransactionJournalSupport
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$object = TransactionJournal::where('transaction_journals.id', $value)
|
||||
->with('transactionType')
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);
|
||||
->with('transactionType')
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);
|
||||
if (!is_null($object)) {
|
||||
return $object;
|
||||
}
|
||||
@ -113,7 +113,7 @@ class TransactionJournal extends TransactionJournalSupport
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteMeta(string $name):bool
|
||||
public function deleteMeta(string $name): bool
|
||||
{
|
||||
$this->transactionJournalMeta()->where('name', $name)->delete();
|
||||
|
||||
|
@ -14,17 +14,13 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\Account;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use DB;
|
||||
use FireflyIII\Helpers\Collection\Account as AccountCollection;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use stdClass;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ class TransactionJournalSupport extends Model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isJoined(Builder $query, string $table):bool
|
||||
public static function isJoined(Builder $query, string $table): bool
|
||||
{
|
||||
$joins = $query->getQuery()->joins;
|
||||
if (is_null($joins)) {
|
||||
|
@ -59,8 +59,8 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\User $user
|
||||
* @param array $list
|
||||
* @param \FireflyIII\User $user
|
||||
* @param array $list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ class General extends Twig_Extension
|
||||
protected function activeRoutePartial(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartial', function () : string {
|
||||
'activeRoutePartial', function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
@ -106,7 +106,7 @@ class General extends Twig_Extension
|
||||
protected function activeRoutePartialWhat(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartialWhat', function ($context) : string {
|
||||
'activeRoutePartialWhat', function ($context): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
@ -130,7 +130,7 @@ class General extends Twig_Extension
|
||||
protected function activeRouteStrict(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRouteStrict', function () : string {
|
||||
'activeRouteStrict', function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
|
||||
@ -149,7 +149,7 @@ class General extends Twig_Extension
|
||||
protected function balance(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'balance', function (Account $account = null) : string {
|
||||
'balance', function (Account $account = null): string {
|
||||
if (is_null($account)) {
|
||||
return 'NULL';
|
||||
}
|
||||
@ -166,7 +166,7 @@ class General extends Twig_Extension
|
||||
protected function env(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'env', function (string $name, string $default) : string {
|
||||
'env', function (string $name, string $default): string {
|
||||
return env($name, $default);
|
||||
}
|
||||
);
|
||||
@ -179,7 +179,7 @@ class General extends Twig_Extension
|
||||
protected function formatAmount(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmount', function (string $string) : string {
|
||||
'formatAmount', function (string $string): string {
|
||||
|
||||
return app('amount')->format($string);
|
||||
}, ['is_safe' => ['html']]
|
||||
@ -192,7 +192,7 @@ class General extends Twig_Extension
|
||||
protected function formatAmountPlain(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmountPlain', function (string $string) : string {
|
||||
'formatAmountPlain', function (string $string): string {
|
||||
|
||||
return app('amount')->format($string, false);
|
||||
}, ['is_safe' => ['html']]
|
||||
@ -205,7 +205,7 @@ class General extends Twig_Extension
|
||||
protected function formatFilesize(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'filesize', function (int $size) : string {
|
||||
'filesize', function (int $size): string {
|
||||
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
@ -228,7 +228,7 @@ class General extends Twig_Extension
|
||||
protected function formatJournal(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatJournal', function (TransactionJournal $journal) : string {
|
||||
'formatJournal', function (TransactionJournal $journal): string {
|
||||
return app('amount')->formatJournal($journal);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
@ -240,7 +240,7 @@ class General extends Twig_Extension
|
||||
protected function getAccountRole(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'getAccountRole', function (string $name) : string {
|
||||
'getAccountRole', function (string $name): string {
|
||||
return Config::get('firefly.accountRoles.' . $name);
|
||||
}
|
||||
);
|
||||
@ -252,7 +252,7 @@ class General extends Twig_Extension
|
||||
protected function getCurrencyCode(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getCurrencyCode', function () : string {
|
||||
'getCurrencyCode', function (): string {
|
||||
return app('amount')->getCurrencyCode();
|
||||
}
|
||||
);
|
||||
@ -264,7 +264,7 @@ class General extends Twig_Extension
|
||||
protected function getCurrencySymbol(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getCurrencySymbol', function () : string {
|
||||
'getCurrencySymbol', function (): string {
|
||||
return app('amount')->getCurrencySymbol();
|
||||
}
|
||||
);
|
||||
@ -276,7 +276,7 @@ class General extends Twig_Extension
|
||||
protected function mimeIcon(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'mimeIcon', function (string $string) : string {
|
||||
'mimeIcon', function (string $string): string {
|
||||
switch ($string) {
|
||||
default:
|
||||
return 'fa-file-o';
|
||||
@ -296,7 +296,7 @@ class General extends Twig_Extension
|
||||
protected function phpdate()
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'phpdate', function (string $str) : string {
|
||||
'phpdate', function (string $str): string {
|
||||
return date($str);
|
||||
}
|
||||
);
|
||||
@ -308,7 +308,7 @@ class General extends Twig_Extension
|
||||
private function getAmountFromJournal()
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getAmount', function (TransactionJournal $journal) : string {
|
||||
'getAmount', function (TransactionJournal $journal): string {
|
||||
return TransactionJournal::amount($journal);
|
||||
}
|
||||
);
|
||||
|
@ -110,9 +110,9 @@ class Transaction extends Twig_Extension
|
||||
|
||||
$amount = strval(
|
||||
TransactionModel::where('transaction_journal_id', $journalId)
|
||||
->whereNull('deleted_at')
|
||||
->where('amount', '<', 0)
|
||||
->sum('amount')
|
||||
->whereNull('deleted_at')
|
||||
->where('amount', '<', 0)
|
||||
->sum('amount')
|
||||
);
|
||||
|
||||
if ($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) {
|
||||
@ -203,10 +203,10 @@ class Transaction extends Twig_Extension
|
||||
$journalId = $transaction->journal_id;
|
||||
/** @var TransactionModel $other */
|
||||
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);
|
||||
$name = intval($other->encrypted) === 1 ? Crypt::decrypt($other->name) : $other->name;
|
||||
$id = $other->account_id;
|
||||
$type = $other->type;
|
||||
@ -275,10 +275,10 @@ class Transaction extends Twig_Extension
|
||||
$journalId = $transaction->journal_id;
|
||||
/** @var TransactionModel $other */
|
||||
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where('identifier', $transaction->identifier)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);
|
||||
$name = intval($other->encrypted) === 1 ? Crypt::decrypt($other->name) : $other->name;
|
||||
$id = $other->account_id;
|
||||
$type = $other->type;
|
||||
|
27
app/User.php
27
app/User.php
@ -188,6 +188,20 @@ class User extends Authenticatable
|
||||
return $this->hasMany('FireflyIII\Models\Rule');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sendPasswordResetNotification($token)
|
||||
{
|
||||
$ip = Request::ip();
|
||||
|
||||
event(new RequestedNewPassword($this, $token, $ip));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
@ -212,18 +226,5 @@ class User extends Authenticatable
|
||||
return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function sendPasswordResetNotification($token)
|
||||
{
|
||||
$ip = Request::ip();
|
||||
|
||||
event(new RequestedNewPassword($this, $token, $ip));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ return [
|
||||
'setting_is_demo_site' => 'Demo site',
|
||||
'setting_is_demo_site_explain' => 'If you check this box, this installation will behave as if it is the demo site, which can have weird side effects.',
|
||||
'setting_send_email_notifications' => 'Send email notifications',
|
||||
'setting_send_email_explain' => 'Firefly III can send you email notifications about certain events. They will be sent to <code>:email</code>. This email address can be set in the <code>.env</code> file.',
|
||||
'setting_send_email_explain' => 'Firefly III can send you email notifications about certain events. They will be sent to <code>:site_owner</code>. This email address can be set in the <code>.env</code> file.',
|
||||
'mail_for_lockout_help' => 'When a user is locked out',
|
||||
'mail_for_blocked_domain_help' => 'When a user tries to register using a blocked domain',
|
||||
'mail_for_blocked_email_help' => 'When a user tries to register using a blocked email address',
|
||||
|
@ -426,7 +426,7 @@ return [
|
||||
'deleted_currency' => 'Valuta :name verwijderd',
|
||||
'created_currency' => 'Nieuwe valuta :name opgeslagen',
|
||||
'updated_currency' => 'Valuta :name bijgewerkt',
|
||||
'ask_site_owner' => 'Vraag :owner of deze valuta wilt toevoegen, verwijderen of wijzigen.',
|
||||
'ask_site_owner' => 'Vraag :site_owner of deze valuta wilt toevoegen, verwijderen of wijzigen.',
|
||||
'currencies_intro' => 'Firefly III ondersteunt diverse valuta die je hier kan instellen en bewerken.',
|
||||
'make_default_currency' => 'maak standaard',
|
||||
'default_currency' => 'standaard',
|
||||
|
@ -76,11 +76,11 @@
|
||||
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'setting_send_email_notifications'|_ }}</h3>
|
||||
<h3 class="box-title">{{ trans('firefly.setting_send_email_notifications') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p class="text-info">
|
||||
{{ 'setting_send_email_explain'|_ }}
|
||||
{{ trans('firefly.setting_send_email_explain',{site_owner: siteOwner})|raw }}
|
||||
</p>
|
||||
{{ ExpandedForm.checkbox('mail_for_lockout','1', sendErrorMessage.mail_for_lockout, {helpText: trans('firefly.mail_for_lockout_help')}) }}
|
||||
{{ ExpandedForm.checkbox('mail_for_blocked_domain','1', sendErrorMessage.mail_for_blocked_domain, {helpText: trans('firefly.mail_for_blocked_domain_help')}) }}
|
||||
|
Loading…
Reference in New Issue
Block a user