mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Fix a few small bugs and rearrange code.
This commit is contained in:
@@ -30,31 +30,31 @@ use Symfony\Component\ExpressionLanguage\SyntaxError;
|
||||
class ActionExpression
|
||||
{
|
||||
private static array $NAMES = [
|
||||
'transaction_group_id',
|
||||
'user_id',
|
||||
'user_group_id',
|
||||
// 'transaction_group_id',
|
||||
// 'user_id',
|
||||
// 'user_group_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'transaction_group_title',
|
||||
'group_created_at',
|
||||
'group_updated_at',
|
||||
'transaction_journal_id',
|
||||
'transaction_type_id',
|
||||
// 'transaction_journal_id',
|
||||
// 'transaction_type_id',
|
||||
'description',
|
||||
'date',
|
||||
'order',
|
||||
// 'order',
|
||||
'transaction_type_type',
|
||||
'source_transaction_id',
|
||||
// 'source_transaction_id',
|
||||
'source_account_id',
|
||||
'reconciled',
|
||||
// 'reconciled',
|
||||
'amount',
|
||||
'currency_id',
|
||||
// 'currency_id',
|
||||
'currency_code',
|
||||
'currency_name',
|
||||
'currency_symbol',
|
||||
'currency_decimal_places',
|
||||
'foreign_amount',
|
||||
'foreign_currency_id',
|
||||
// 'foreign_currency_id',
|
||||
'foreign_currency_code',
|
||||
'foreign_currency_name',
|
||||
'foreign_currency_symbol',
|
||||
@@ -71,14 +71,14 @@ class ActionExpression
|
||||
'budget_id',
|
||||
'budget_name',
|
||||
'tags',
|
||||
'attachments',
|
||||
// 'attachments',
|
||||
'interest_date',
|
||||
'payment_date',
|
||||
'invoice_date',
|
||||
'book_date',
|
||||
'due_date',
|
||||
'process_date',
|
||||
'destination_transaction_id',
|
||||
// 'destination_transaction_id',
|
||||
'notes',
|
||||
];
|
||||
|
||||
|
||||
@@ -32,24 +32,34 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new ExpressionFunction('constant', function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
|
||||
}, function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return $str;
|
||||
}
|
||||
new ExpressionFunction(
|
||||
'constant',
|
||||
function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
|
||||
},
|
||||
// @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return (string) $str;
|
||||
}
|
||||
|
||||
return strtolower($str.'!');
|
||||
}),
|
||||
new ExpressionFunction('enum', function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'?');
|
||||
}, function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return $str;
|
||||
return strtolower($str.'!');
|
||||
}
|
||||
),
|
||||
new ExpressionFunction(
|
||||
'enum',
|
||||
function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'?');
|
||||
},
|
||||
// @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return (string) $str;
|
||||
}
|
||||
|
||||
return strtolower($str).'?';
|
||||
}),
|
||||
return strtolower($str).'?';
|
||||
}
|
||||
),
|
||||
|
||||
ExpressionFunction::fromPhp('substr'),
|
||||
ExpressionFunction::fromPhp('strlen'),
|
||||
|
||||
Reference in New Issue
Block a user