mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Fix minor issues.
This commit is contained in:
@@ -92,6 +92,7 @@ class ShowController extends Controller
|
|||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setUser($admin)->setTransactionGroup($transactionGroup)->withAPIInformation();
|
$collector->setUser($admin)->setTransactionGroup($transactionGroup)->withAPIInformation();
|
||||||
|
|
||||||
|
/** @var TransactionGroup $selectedGroup */
|
||||||
$selectedGroup = $collector->getGroups()->first();
|
$selectedGroup = $collector->getGroups()->first();
|
||||||
if (null === $selectedGroup) {
|
if (null === $selectedGroup) {
|
||||||
throw new NotFoundHttpException();
|
throw new NotFoundHttpException();
|
||||||
@@ -103,9 +104,6 @@ class ShowController extends Controller
|
|||||||
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
||||||
|
|
||||||
|
|
||||||
/** @var null|TransactionJournal $first */
|
|
||||||
$first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
|
|
||||||
$splits = $transactionGroup->transactionJournals()->count();
|
|
||||||
$splits = count($selectedGroup['transactions']);
|
$splits = count($selectedGroup['transactions']);
|
||||||
$keys = array_keys($selectedGroup['transactions']);
|
$keys = array_keys($selectedGroup['transactions']);
|
||||||
$first = $selectedGroup['transactions'][array_shift($keys)];
|
$first = $selectedGroup['transactions'][array_shift($keys)];
|
||||||
|
@@ -377,7 +377,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
|
|||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = $this->user->transactionJournals()->find($journalId);
|
$journal = $this->user->transactionJournals()->find($journalId);
|
||||||
|
|
||||||
return $journal->tags()->get();
|
return $journal->tags()->whereNull('deleted_at')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -32,13 +32,12 @@ use FireflyIII\Support\Facades\Amount;
|
|||||||
use FireflyIII\Support\Facades\Steam;
|
use FireflyIII\Support\Facades\Steam;
|
||||||
use FireflyIII\Support\Search\OperatorQuerySearch;
|
use FireflyIII\Support\Search\OperatorQuerySearch;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||||
|
use Override;
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFilter;
|
use Twig\TwigFilter;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
use Override;
|
|
||||||
|
|
||||||
use function Safe\parse_url;
|
use function Safe\parse_url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,14 +70,14 @@ class General extends AbstractExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Carbon $date */
|
/** @var Carbon $date */
|
||||||
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
||||||
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
||||||
$info = Steam::finalAccountBalance($account, $date);
|
$info = Steam::finalAccountBalance($account, $date);
|
||||||
$currency = Steam::getAccountCurrency($account);
|
$currency = Steam::getAccountCurrency($account);
|
||||||
$primary = Amount::getPrimaryCurrency();
|
$primary = Amount::getPrimaryCurrency();
|
||||||
$convertToPrimary = Amount::convertToPrimary();
|
$convertToPrimary = Amount::convertToPrimary();
|
||||||
$usePrimary = $convertToPrimary && $primary->id !== $currency->id;
|
$usePrimary = $convertToPrimary && $primary->id !== $currency->id;
|
||||||
$currency ??= $primary;
|
$currency ??= $primary;
|
||||||
$strings = [];
|
$strings = [];
|
||||||
foreach ($info as $key => $balance) {
|
foreach ($info as $key => $balance) {
|
||||||
if ('balance' === $key) {
|
if ('balance' === $key) {
|
||||||
@@ -119,15 +118,15 @@ class General extends AbstractExtension
|
|||||||
static function (int $size): string {
|
static function (int $size): string {
|
||||||
// less than one GB, more than one MB
|
// less than one GB, more than one MB
|
||||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||||
return round($size / (1024 * 1024), 2).' MB';
|
return round($size / (1024 * 1024), 2) . ' MB';
|
||||||
}
|
}
|
||||||
|
|
||||||
// less than one MB
|
// less than one MB
|
||||||
if ($size < (1024 * 1024)) {
|
if ($size < (1024 * 1024)) {
|
||||||
return round($size / 1024, 2).' KB';
|
return round($size / 1024, 2) . ' KB';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $size.' bytes';
|
return $size . ' bytes';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -141,9 +140,9 @@ class General extends AbstractExtension
|
|||||||
{
|
{
|
||||||
return new TwigFilter(
|
return new TwigFilter(
|
||||||
'mimeIcon',
|
'mimeIcon',
|
||||||
static fn (string $string): string => match ($string) {
|
static fn(string $string): string => match ($string) {
|
||||||
'application/pdf' => 'fa-file-pdf-o',
|
'application/pdf' => 'fa-file-pdf-o',
|
||||||
'image/png', 'image/jpeg', 'image/svg+xml', 'image/heic', 'image/heic-sequence', 'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
|
'image/webp', 'image/png', 'image/jpeg', 'image/svg+xml', 'image/heic', 'image/heic-sequence', 'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
|
||||||
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/x-iwork-pages-sffpages', 'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', 'application/vnd.sun.xml.writer.global', 'application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-web', 'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
|
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/x-iwork-pages-sffpages', 'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', 'application/vnd.sun.xml.writer.global', 'application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-web', 'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
|
||||||
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.stardivision.calc', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template' => 'fa-file-excel-o',
|
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.stardivision.calc', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template' => 'fa-file-excel-o',
|
||||||
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.sun.xml.impress', 'application/vnd.sun.xml.impress.template', 'application/vnd.stardivision.impress', 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
|
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.sun.xml.impress', 'application/vnd.sun.xml.impress.template', 'application/vnd.stardivision.impress', 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
|
||||||
@@ -168,7 +167,7 @@ class General extends AbstractExtension
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (string) $converter->convert($text);
|
return (string)$converter->convert($text);
|
||||||
},
|
},
|
||||||
['is_safe' => ['html']]
|
['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
@@ -182,8 +181,8 @@ class General extends AbstractExtension
|
|||||||
return new TwigFilter(
|
return new TwigFilter(
|
||||||
'phphost',
|
'phphost',
|
||||||
static function (string $string): string {
|
static function (string $string): string {
|
||||||
$proto = (string) parse_url($string, PHP_URL_SCHEME);
|
$proto = (string)parse_url($string, PHP_URL_SCHEME);
|
||||||
$host = (string) parse_url($string, PHP_URL_HOST);
|
$host = (string)parse_url($string, PHP_URL_HOST);
|
||||||
|
|
||||||
return e(sprintf('%s://%s', $proto, $host));
|
return e(sprintf('%s://%s', $proto, $host));
|
||||||
}
|
}
|
||||||
@@ -214,7 +213,7 @@ class General extends AbstractExtension
|
|||||||
{
|
{
|
||||||
return new TwigFunction(
|
return new TwigFunction(
|
||||||
'phpdate',
|
'phpdate',
|
||||||
static fn (string $str): string => date($str)
|
static fn(string $str): string => date($str)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,12 +269,12 @@ class General extends AbstractExtension
|
|||||||
'activeRoutePartialObjectType',
|
'activeRoutePartialObjectType',
|
||||||
static function ($context): string {
|
static function ($context): string {
|
||||||
[, $route, $objectType] = func_get_args();
|
[, $route, $objectType] = func_get_args();
|
||||||
$activeObjectType = $context['objectType'] ?? false;
|
$activeObjectType = $context['objectType'] ?? false;
|
||||||
|
|
||||||
if ($objectType === $activeObjectType
|
if ($objectType === $activeObjectType
|
||||||
&& false !== stripos(
|
&& false !== stripos(
|
||||||
(string) Route::getCurrentRoute()->getName(),
|
(string)Route::getCurrentRoute()->getName(),
|
||||||
(string) $route
|
(string)$route
|
||||||
)) {
|
)) {
|
||||||
return 'active';
|
return 'active';
|
||||||
}
|
}
|
||||||
@@ -376,7 +375,7 @@ class General extends AbstractExtension
|
|||||||
{
|
{
|
||||||
return new TwigFunction(
|
return new TwigFunction(
|
||||||
'carbonize',
|
'carbonize',
|
||||||
static fn (string $date): Carbon => new Carbon($date, config('app.timezone'))
|
static fn(string $date): Carbon => new Carbon($date, config('app.timezone'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user