mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-20 19:42:02 +00:00
Various code cleanup.
This commit is contained in:
@@ -277,8 +277,8 @@ This will be the last release to support PHP 7.0.
|
|||||||
- Can now make rules for attachments, see [issue 608](https://github.com/firefly-iii/firefly-iii/issues/608), as suggested by [dzaikos](https://github.com/dzaikos).
|
- Can now make rules for attachments, see [issue 608](https://github.com/firefly-iii/firefly-iii/issues/608), as suggested by [dzaikos](https://github.com/dzaikos).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by forcaeluz
|
- Fixed [issue 629](https://github.com/firefly-iii/firefly-iii/issues/629), reported by @forcaeluz
|
||||||
- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by welbert
|
- Fixed [issue 630](https://github.com/firefly-iii/firefly-iii/issues/630), reported by @welbert
|
||||||
- And more various bug fixes.
|
- And more various bug fixes.
|
||||||
|
|
||||||
## [4.3.8] - 2017-04-08
|
## [4.3.8] - 2017-04-08
|
||||||
|
@@ -50,7 +50,7 @@ interface JournalCollectorInterface
|
|||||||
*
|
*
|
||||||
* @return JournalCollectorInterface
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function amountMore(string $amount): JournalCollectorInterface;
|
public function amountIs(string $amount): JournalCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $amount
|
* @param string $amount
|
||||||
@@ -64,7 +64,7 @@ interface JournalCollectorInterface
|
|||||||
*
|
*
|
||||||
* @return JournalCollectorInterface
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function amountIs(string $amount): JournalCollectorInterface;
|
public function amountMore(string $amount): JournalCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -223,7 +223,7 @@ class CurrencyController extends Controller
|
|||||||
$isOwner = false;
|
$isOwner = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('currencies.index', compact('currencies', 'defaultCurrency','isOwner'));
|
return view('currencies.index', compact('currencies', 'defaultCurrency', 'isOwner'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -116,7 +116,7 @@ class HomeController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// last few lines
|
// last few lines
|
||||||
$logContent = 'Truncated from this point <----|'.substr($logContent, -4096);
|
$logContent = 'Truncated from this point <----|' . substr($logContent, -4096);
|
||||||
|
|
||||||
return view('debug', compact('phpVersion', 'extensions', 'carbon', 'now', 'drivers', 'currentDriver', 'userAgent', 'phpOs', 'interface', 'logContent'));
|
return view('debug', compact('phpVersion', 'extensions', 'carbon', 'now', 'drivers', 'currentDriver', 'userAgent', 'phpOs', 'interface', 'logContent'));
|
||||||
|
|
||||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
|
@@ -93,7 +93,7 @@ class NewUserController extends Controller
|
|||||||
// also store currency preference from input:
|
// also store currency preference from input:
|
||||||
$currency = $currencyRepository->find(intval($request->input('amount_currency_id_bank_balance')));
|
$currency = $currencyRepository->find(intval($request->input('amount_currency_id_bank_balance')));
|
||||||
|
|
||||||
if(!is_null($currency->id)) {
|
if (!is_null($currency->id)) {
|
||||||
// store currency preference:
|
// store currency preference:
|
||||||
Preferences::set('currencyPreference', $currency->code);
|
Preferences::set('currencyPreference', $currency->code);
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
@@ -43,10 +43,10 @@ class StartFireflySession extends StartSession
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
// public function handle($request, Closure $next)
|
// public function handle($request, Closure $next)
|
||||||
// {
|
// {
|
||||||
// return parent::handle($request, $next); // defer to the right stuff
|
// return parent::handle($request, $next); // defer to the right stuff
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store the current URL for the request if necessary.
|
* Store the current URL for the request if necessary.
|
||||||
|
@@ -126,6 +126,7 @@ class AbnAmroDescription implements SpecificInterface
|
|||||||
/**
|
/**
|
||||||
* Parses the current description in SEPA format
|
* Parses the current description in SEPA format
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
*
|
||||||
* @return bool true if the description is SEPA format, false otherwise
|
* @return bool true if the description is SEPA format, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function parseSepaDescription()
|
protected function parseSepaDescription()
|
||||||
|
@@ -33,8 +33,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Specifics;
|
namespace FireflyIII\Import\Specifics;
|
||||||
|
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SnsDescription
|
* Class SnsDescription
|
||||||
*
|
*
|
||||||
@@ -65,8 +63,9 @@ class SnsDescription implements SpecificInterface
|
|||||||
*/
|
*/
|
||||||
public function run(array $row): array
|
public function run(array $row): array
|
||||||
{
|
{
|
||||||
$row[17] = ltrim($row[17],"'");
|
$row[17] = ltrim($row[17], "'");
|
||||||
$row[17] = rtrim($row[17],"'");
|
$row[17] = rtrim($row[17], "'");
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Watson\Validating\ValidatingTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionCurrency
|
* Class TransactionCurrency
|
||||||
|
@@ -66,7 +66,7 @@ class TransactionJournal extends Model
|
|||||||
'completed' => 'boolean',
|
'completed' => 'boolean',
|
||||||
];
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $dates = ['date','interest_date', 'book_date', 'process_date'];
|
protected $dates = ['date', 'interest_date', 'book_date', 'process_date'];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $fillable
|
protected $fillable
|
||||||
= ['user_id', 'transaction_type_id', 'bill_id', 'interest_date', 'book_date', 'process_date',
|
= ['user_id', 'transaction_type_id', 'bill_id', 'interest_date', 'book_date', 'process_date',
|
||||||
|
@@ -297,7 +297,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
protected function storeInitialBalance(Account $account, array $data): TransactionJournal
|
protected function storeInitialBalance(Account $account, array $data): TransactionJournal
|
||||||
{
|
{
|
||||||
$amount = strval($data['openingBalance']);
|
$amount = strval($data['openingBalance']);
|
||||||
Log::debug(sprintf('Submitted amount is %s',$amount));
|
Log::debug(sprintf('Submitted amount is %s', $amount));
|
||||||
|
|
||||||
if (bccomp($amount, '0') === 0) {
|
if (bccomp($amount, '0') === 0) {
|
||||||
return new TransactionJournal;
|
return new TransactionJournal;
|
||||||
@@ -326,7 +326,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$secondAmount = bcmul($amount, '-1');
|
$secondAmount = bcmul($amount, '-1');
|
||||||
Log::debug(sprintf('First amount is %s, second amount is %s', $firstAmount, $secondAmount));
|
Log::debug(sprintf('First amount is %s, second amount is %s', $firstAmount, $secondAmount));
|
||||||
|
|
||||||
if (bccomp($amount,'0') === -1) {
|
if (bccomp($amount, '0') === -1) {
|
||||||
Log::debug(sprintf('%s is a negative number.', $amount));
|
Log::debug(sprintf('%s is a negative number.', $amount));
|
||||||
$firstAccount = $opposing;
|
$firstAccount = $opposing;
|
||||||
$secondAccount = $account;
|
$secondAccount = $account;
|
||||||
@@ -508,8 +508,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
protected function validOpeningBalanceData(array $data): bool
|
protected function validOpeningBalanceData(array $data): bool
|
||||||
{
|
{
|
||||||
$data['openingBalance'] = strval($data['openingBalance'] ?? '');
|
$data['openingBalance'] = strval($data['openingBalance'] ?? '');
|
||||||
if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0 &&
|
if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0
|
||||||
isset($data['openingBalanceDate'])) {
|
&& isset($data['openingBalanceDate'])) {
|
||||||
Log::debug('Array has valid opening balance data.');
|
Log::debug('Array has valid opening balance data.');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -24,10 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support;
|
namespace FireflyIII\Support;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Transaction as TransactionModel;
|
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\Models\TransactionType;
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Preferences as Prefs;
|
use Preferences as Prefs;
|
||||||
|
@@ -28,7 +28,6 @@ use Carbon\Carbon;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Steam;
|
use Steam;
|
||||||
|
|
||||||
|
@@ -25,9 +25,7 @@ namespace FireflyIII\Support\Twig;
|
|||||||
|
|
||||||
|
|
||||||
use FireflyIII\Models\Account as AccountModel;
|
use FireflyIII\Models\Account as AccountModel;
|
||||||
use FireflyIII\Models\Transaction as TransactionModel;
|
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFilter;
|
use Twig_SimpleFilter;
|
||||||
use Twig_SimpleFunction;
|
use Twig_SimpleFunction;
|
||||||
|
@@ -29,10 +29,11 @@ use FireflyIII\Models\AccountType;
|
|||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
|
use FireflyIII\Support\Twig\Extension\TransactionJournal as TransactionJournalExtension;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFilter;
|
use Twig_SimpleFilter;
|
||||||
use Twig_SimpleFunction;
|
use Twig_SimpleFunction;
|
||||||
use FireflyIII\Support\Twig\Extension\TransactionJournal as TransactionJournalExtension;
|
|
||||||
/**
|
/**
|
||||||
* Class Journal
|
* Class Journal
|
||||||
*
|
*
|
||||||
@@ -82,7 +83,6 @@ class Journal extends Twig_Extension
|
|||||||
public function getFilters(): array
|
public function getFilters(): array
|
||||||
{
|
{
|
||||||
$filters = [
|
$filters = [
|
||||||
$this->typeIcon(),
|
|
||||||
new Twig_SimpleFilter('journalTotalAmount', [TransactionJournalExtension::class, 'totalAmount'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('journalTotalAmount', [TransactionJournalExtension::class, 'totalAmount'], ['is_safe' => ['html']]),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -227,38 +227,4 @@ class Journal extends Twig_Extension
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 5.
|
|
||||||
*
|
|
||||||
* @return Twig_SimpleFilter
|
|
||||||
*/
|
|
||||||
protected function typeIcon(): Twig_SimpleFilter
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFilter(
|
|
||||||
'typeIcon', function (TransactionJournal $journal): string {
|
|
||||||
|
|
||||||
switch (true) {
|
|
||||||
case $journal->isWithdrawal():
|
|
||||||
$txt = sprintf('<i class="fa fa-long-arrow-left fa-fw" title="%s"></i>', trans('firefly.withdrawal'));
|
|
||||||
break;
|
|
||||||
case $journal->isDeposit():
|
|
||||||
$txt = sprintf('<i class="fa fa-long-arrow-right fa-fw" title="%s"></i>', trans('firefly.deposit'));
|
|
||||||
break;
|
|
||||||
case $journal->isTransfer():
|
|
||||||
$txt = sprintf('<i class="fa fa-fw fa-exchange" title="%s"></i>', trans('firefly.transfer'));
|
|
||||||
break;
|
|
||||||
case $journal->isOpeningBalance():
|
|
||||||
$txt = sprintf('<i class="fa-fw fa fa-star-o" title="%s"></i>', trans('firefly.openingBalance'));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$txt = '';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $txt;
|
|
||||||
}, ['is_safe' => ['html']]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -23,12 +23,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Twig;
|
namespace FireflyIII\Support\Twig;
|
||||||
|
|
||||||
use FireflyIII\Models\Transaction as TransactionModel;
|
|
||||||
use FireflyIII\Support\Twig\Extension\Transaction as TransactionExtension;
|
use FireflyIII\Support\Twig\Extension\Transaction as TransactionExtension;
|
||||||
use Steam;
|
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFilter;
|
use Twig_SimpleFilter;
|
||||||
use Twig_SimpleFunction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Transaction
|
* Class Transaction
|
||||||
@@ -46,6 +43,7 @@ class Transaction extends Twig_Extension
|
|||||||
new Twig_SimpleFilter('transactionIcon', [TransactionExtension::class, 'icon'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('transactionIcon', [TransactionExtension::class, 'icon'], ['is_safe' => ['html']]),
|
||||||
new Twig_SimpleFilter('transactionDescription', [TransactionExtension::class, 'description']),
|
new Twig_SimpleFilter('transactionDescription', [TransactionExtension::class, 'description']),
|
||||||
new Twig_SimpleFilter('transactionIsSplit', [TransactionExtension::class, 'isSplit'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('transactionIsSplit', [TransactionExtension::class, 'isSplit'], ['is_safe' => ['html']]),
|
||||||
|
new Twig_SimpleFilter('transactionReconciled', [TransactionExtension::class, 'isReconciled'], ['is_safe' => ['html']]),
|
||||||
new Twig_SimpleFilter('transactionHasAtt', [TransactionExtension::class, 'hasAttachments'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('transactionHasAtt', [TransactionExtension::class, 'hasAttachments'], ['is_safe' => ['html']]),
|
||||||
new Twig_SimpleFilter('transactionAmount', [TransactionExtension::class, 'amount'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('transactionAmount', [TransactionExtension::class, 'amount'], ['is_safe' => ['html']]),
|
||||||
new Twig_SimpleFilter('transactionArrayAmount', [TransactionExtension::class, 'amountArray'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('transactionArrayAmount', [TransactionExtension::class, 'amountArray'], ['is_safe' => ['html']]),
|
||||||
@@ -58,19 +56,6 @@ class Transaction extends Twig_Extension
|
|||||||
return $filters;
|
return $filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getFunctions(): array
|
|
||||||
{
|
|
||||||
$functions = [
|
|
||||||
$this->transactionIdBudgets(),
|
|
||||||
$this->transactionIdCategories(),
|
|
||||||
];
|
|
||||||
|
|
||||||
return $functions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the extension.
|
* Returns the name of the extension.
|
||||||
*
|
*
|
||||||
@@ -80,110 +65,4 @@ class Transaction extends Twig_Extension
|
|||||||
{
|
{
|
||||||
return 'transaction';
|
return 'transaction';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Twig_SimpleFunction
|
|
||||||
*/
|
|
||||||
public function transactionIdBudgets(): Twig_SimpleFunction
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFunction(
|
|
||||||
'transactionIdBudgets', function (int $transactionId): string {
|
|
||||||
$transaction = TransactionModel::find($transactionId);
|
|
||||||
|
|
||||||
return $this->getTransactionBudgets($transaction);
|
|
||||||
}, ['is_safe' => ['html']]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Twig_SimpleFunction
|
|
||||||
*/
|
|
||||||
public function transactionIdCategories(): Twig_SimpleFunction
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFunction(
|
|
||||||
'transactionIdCategories', function (int $transactionId): string {
|
|
||||||
$transaction = TransactionModel::find($transactionId);
|
|
||||||
|
|
||||||
return $this->getTransactionCategories($transaction);
|
|
||||||
}, ['is_safe' => ['html']]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TransactionModel $transaction
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function getTransactionBudgets(TransactionModel $transaction): string
|
|
||||||
{
|
|
||||||
// journal has a budget:
|
|
||||||
if (isset($transaction->transaction_journal_budget_id)) {
|
|
||||||
$name = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name);
|
|
||||||
|
|
||||||
return sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$transaction->transaction_journal_budget_id]), $name, $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction has a budget
|
|
||||||
if (isset($transaction->transaction_budget_id)) {
|
|
||||||
$name = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name);
|
|
||||||
|
|
||||||
return sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$transaction->transaction_budget_id]), $name, $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// see if the transaction has a budget:
|
|
||||||
$budgets = $transaction->budgets()->get();
|
|
||||||
if ($budgets->count() === 0) {
|
|
||||||
$budgets = $transaction->transactionJournal()->first()->budgets()->get();
|
|
||||||
}
|
|
||||||
if ($budgets->count() > 0) {
|
|
||||||
$str = [];
|
|
||||||
foreach ($budgets as $budget) {
|
|
||||||
$str[] = sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$budget->id]), $budget->name, $budget->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return join(', ', $str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TransactionModel $transaction
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function getTransactionCategories(TransactionModel $transaction): string
|
|
||||||
{
|
|
||||||
// journal has a category:
|
|
||||||
if (isset($transaction->transaction_journal_category_id)) {
|
|
||||||
$name = Steam::decrypt(intval($transaction->transaction_journal_category_encrypted), $transaction->transaction_journal_category_name);
|
|
||||||
|
|
||||||
return sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$transaction->transaction_journal_category_id]), $name, $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction has a category:
|
|
||||||
if (isset($transaction->transaction_category_id)) {
|
|
||||||
$name = Steam::decrypt(intval($transaction->transaction_category_encrypted), $transaction->transaction_category_name);
|
|
||||||
|
|
||||||
return sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$transaction->transaction_category_id]), $name, $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// see if the transaction has a category:
|
|
||||||
$categories = $transaction->categories()->get();
|
|
||||||
if ($categories->count() === 0) {
|
|
||||||
$categories = $transaction->transactionJournal()->first()->categories()->get();
|
|
||||||
}
|
|
||||||
if ($categories->count() > 0) {
|
|
||||||
$str = [];
|
|
||||||
foreach ($categories as $category) {
|
|
||||||
$str[] = sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$category->id]), $category->name, $category->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return join(', ', $str);
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,12 @@ class SetBudget implements ActionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($journal->transactionType->type !== TransactionType::WITHDRAWAL) {
|
if ($journal->transactionType->type !== TransactionType::WITHDRAWAL) {
|
||||||
Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.', $journal->id, $search, $journal->transactionType->type));
|
Log::debug(
|
||||||
|
sprintf(
|
||||||
|
'RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.', $journal->id, $search,
|
||||||
|
$journal->transactionType->type
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,7 @@ class AbstractTrigger
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractTrigger constructor.
|
* AbstractTrigger constructor.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
@@ -57,6 +58,7 @@ class AbstractTrigger
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
* @param string $triggerValue
|
* @param string $triggerValue
|
||||||
* @param bool $stopProcessing
|
* @param bool $stopProcessing
|
||||||
*
|
*
|
||||||
@@ -73,6 +75,7 @@ class AbstractTrigger
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
* @param RuleTrigger $trigger
|
* @param RuleTrigger $trigger
|
||||||
*
|
*
|
||||||
* @return AbstractTrigger
|
* @return AbstractTrigger
|
||||||
@@ -89,6 +92,7 @@ class AbstractTrigger
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
* @param string $triggerValue
|
* @param string $triggerValue
|
||||||
*
|
*
|
||||||
* @return AbstractTrigger
|
* @return AbstractTrigger
|
||||||
|
@@ -47,6 +47,7 @@ final class UserAction extends AbstractTrigger implements TriggerInterface
|
|||||||
* false.
|
* false.
|
||||||
*
|
*
|
||||||
* @param null $value
|
* @param null $value
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -60,6 +61,7 @@ final class UserAction extends AbstractTrigger implements TriggerInterface
|
|||||||
* This trigger is always triggered, because the rule that it is a part of has been pre-selected on this condition.
|
* This trigger is always triggered, because the rule that it is a part of has been pre-selected on this condition.
|
||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
30
composer.lock
generated
30
composer.lock
generated
@@ -3952,16 +3952,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "5.2.2",
|
"version": "5.2.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "8ed1902a57849e117b5651fc1a5c48110946c06b"
|
"reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d",
|
||||||
"reference": "8ed1902a57849e117b5651fc1a5c48110946c06b",
|
"reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3970,7 +3970,7 @@
|
|||||||
"php": "^7.0",
|
"php": "^7.0",
|
||||||
"phpunit/php-file-iterator": "^1.4.2",
|
"phpunit/php-file-iterator": "^1.4.2",
|
||||||
"phpunit/php-text-template": "^1.2.1",
|
"phpunit/php-text-template": "^1.2.1",
|
||||||
"phpunit/php-token-stream": "^1.4.11 || ^2.0",
|
"phpunit/php-token-stream": "^2.0",
|
||||||
"sebastian/code-unit-reverse-lookup": "^1.0.1",
|
"sebastian/code-unit-reverse-lookup": "^1.0.1",
|
||||||
"sebastian/environment": "^3.0",
|
"sebastian/environment": "^3.0",
|
||||||
"sebastian/version": "^2.0.1",
|
"sebastian/version": "^2.0.1",
|
||||||
@@ -4012,7 +4012,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2017-08-03T12:40:43+00:00"
|
"time": "2017-11-03T13:47:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
@@ -4390,30 +4390,30 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/comparator",
|
"name": "sebastian/comparator",
|
||||||
"version": "2.0.2",
|
"version": "2.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||||
"reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a"
|
"reference": "1174d9018191e93cb9d719edec01257fc05f8158"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a",
|
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158",
|
||||||
"reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a",
|
"reference": "1174d9018191e93cb9d719edec01257fc05f8158",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.0",
|
"php": "^7.0",
|
||||||
"sebastian/diff": "^2.0",
|
"sebastian/diff": "^2.0",
|
||||||
"sebastian/exporter": "^3.0"
|
"sebastian/exporter": "^3.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^6.0"
|
"phpunit/phpunit": "^6.4"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.0.x-dev"
|
"dev-master": "2.1.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -4444,13 +4444,13 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Provides the functionality to compare PHP values for equality",
|
"description": "Provides the functionality to compare PHP values for equality",
|
||||||
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
"homepage": "https://github.com/sebastianbergmann/comparator",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"comparator",
|
"comparator",
|
||||||
"compare",
|
"compare",
|
||||||
"equality"
|
"equality"
|
||||||
],
|
],
|
||||||
"time": "2017-08-03T07:14:59+00:00"
|
"time": "2017-11-03T07:16:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/diff",
|
"name": "sebastian/diff",
|
||||||
|
Reference in New Issue
Block a user