mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Auto commit for release 'develop' on 2025-01-01
This commit is contained in:
parent
c11a5384da
commit
f727a38b69
@ -58,12 +58,12 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
|
|
||||||
// refresh the transaction type.
|
// refresh the transaction type.
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = User::find($journal['user_id']);
|
$user = User::find($journal['user_id']);
|
||||||
|
|
||||||
/** @var TransactionJournal $journalObj */
|
/** @var TransactionJournal $journalObj */
|
||||||
$journalObj = $user->transactionJournals()->find($journal['transaction_journal_id']);
|
$journalObj = $user->transactionJournals()->find($journal['transaction_journal_id']);
|
||||||
|
|
||||||
$piggyBank = $this->findPiggyBank($user, $actionValue);
|
$piggyBank = $this->findPiggyBank($user, $actionValue);
|
||||||
if (null === $piggyBank) {
|
if (null === $piggyBank) {
|
||||||
Log::info(
|
Log::info(
|
||||||
sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $actionValue, $this->action->id, $this->action->rule_id)
|
sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $actionValue, $this->action->id, $this->action->rule_id)
|
||||||
@ -78,7 +78,7 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
/** @var Transaction $destination */
|
/** @var Transaction $destination */
|
||||||
$destination = $journalObj->transactions()->where('amount', '>', 0)->first();
|
$destination = $journalObj->transactions()->where('amount', '>', 0)->first();
|
||||||
|
|
||||||
$accounts = $this->getAccounts($journalObj);
|
$accounts = $this->getAccounts($journalObj);
|
||||||
Log::debug(sprintf('Source account is #%d: "%s"', $accounts['source']->id, $accounts['source']->name));
|
Log::debug(sprintf('Source account is #%d: "%s"', $accounts['source']->id, $accounts['source']->name));
|
||||||
Log::debug(sprintf('Destination account is #%d: "%s"', $accounts['destination']->id, $accounts['source']->name));
|
Log::debug(sprintf('Destination account is #%d: "%s"', $accounts['destination']->id, $accounts['source']->name));
|
||||||
|
|
||||||
@ -130,6 +130,7 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
if ($this->isConnected($piggyBank, $accounts['source']) && $this->isConnected($piggyBank, $accounts['destination'])) {
|
if ($this->isConnected($piggyBank, $accounts['source']) && $this->isConnected($piggyBank, $accounts['destination'])) {
|
||||||
Log::info(sprintf('Piggy bank is linked to BOTH source ("#%d") and destination ("#%d"), so no action will be taken.', $accounts['source']->id, $accounts['destination']->id));
|
Log::info(sprintf('Piggy bank is linked to BOTH source ("#%d") and destination ("#%d"), so no action will be taken.', $accounts['source']->id, $accounts['destination']->id));
|
||||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_link_piggy', ['name' => $actionValue])));
|
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_link_piggy', ['name' => $actionValue])));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Log::info(sprintf('Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', $accounts['source']->id, $accounts['destination']->id));
|
Log::info(sprintf('Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', $accounts['source']->id, $accounts['destination']->id));
|
||||||
@ -143,6 +144,7 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
/** @var PiggyBankRepositoryInterface $repository */
|
/** @var PiggyBankRepositoryInterface $repository */
|
||||||
$repository = app(PiggyBankRepositoryInterface::class);
|
$repository = app(PiggyBankRepositoryInterface::class);
|
||||||
$repository->setUser($user);
|
$repository->setUser($user);
|
||||||
|
|
||||||
return $repository->findByName($name);
|
return $repository->findByName($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,11 +154,11 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
$repository->setUser($journal->user);
|
$repository->setUser($journal->user);
|
||||||
|
|
||||||
// how much can we remove from this piggy bank?
|
// how much can we remove from this piggy bank?
|
||||||
$toRemove = $repository->getCurrentAmount($piggyBank, $account);
|
$toRemove = $repository->getCurrentAmount($piggyBank, $account);
|
||||||
Log::debug(sprintf('Amount is %s, max to remove is %s', $amount, $toRemove));
|
Log::debug(sprintf('Amount is %s, max to remove is %s', $amount, $toRemove));
|
||||||
|
|
||||||
// if $amount is bigger than $toRemove, shrink it.
|
// if $amount is bigger than $toRemove, shrink it.
|
||||||
$amount = -1 === bccomp($amount, $toRemove) ? $amount : $toRemove;
|
$amount = -1 === bccomp($amount, $toRemove) ? $amount : $toRemove;
|
||||||
Log::debug(sprintf('Amount is now %s', $amount));
|
Log::debug(sprintf('Amount is now %s', $amount));
|
||||||
|
|
||||||
// if amount is zero, stop.
|
// if amount is zero, stop.
|
||||||
@ -185,7 +187,7 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
|
|
||||||
// how much can we add to the piggy bank?
|
// how much can we add to the piggy bank?
|
||||||
if (0 !== bccomp($piggyBank->target_amount, '0')) {
|
if (0 !== bccomp($piggyBank->target_amount, '0')) {
|
||||||
$toAdd = bcsub($piggyBank->target_amount, $repository->getCurrentAmount($piggyBank, $account));
|
$toAdd = bcsub($piggyBank->target_amount, $repository->getCurrentAmount($piggyBank, $account));
|
||||||
Log::debug(sprintf('Max amount to add to piggy bank is %s, amount is %s', $toAdd, $amount));
|
Log::debug(sprintf('Max amount to add to piggy bank is %s, amount is %s', $toAdd, $amount));
|
||||||
|
|
||||||
// update amount to fit:
|
// update amount to fit:
|
||||||
@ -234,7 +236,7 @@ class UpdatePiggybank implements ActionInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $account->id, $account->name));
|
Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $account->id, $account->name));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"apply_rules_checkbox": "Regels toepassen",
|
"apply_rules_checkbox": "Regels toepassen",
|
||||||
"fire_webhooks_checkbox": "Webhooks starten",
|
"fire_webhooks_checkbox": "Webhooks starten",
|
||||||
"no_budget_pointer": "Je hebt nog geen budgetten. Maak er een aantal op de <a href=\"budgets\">budgetten<\/a>-pagina. Met budgetten kan je je uitgaven beter bijhouden.",
|
"no_budget_pointer": "Je hebt nog geen budgetten. Maak er een aantal op de <a href=\"budgets\">budgetten<\/a>-pagina. Met budgetten kan je je uitgaven beter bijhouden.",
|
||||||
"no_bill_pointer": "You seem to have no subscription yet. You should create some on the <a href=\"subscriptions\">subscription<\/a>-page. Subscriptions can help you keep track of expenses.",
|
"no_bill_pointer": "Je hebt nog geen abonnementen. Maak er een aantal op de <a href=\"subscriptions\">abonnementenpagina<\/a>. Met abonnementen kan je uitgaven bijhouden.",
|
||||||
"source_account": "Bronrekening",
|
"source_account": "Bronrekening",
|
||||||
"hidden_fields_preferences": "Je kan meer transactieopties inschakelen in je <a href=\"preferences\">instellingen<\/a>.",
|
"hidden_fields_preferences": "Je kan meer transactieopties inschakelen in je <a href=\"preferences\">instellingen<\/a>.",
|
||||||
"destination_account": "Doelrekening",
|
"destination_account": "Doelrekening",
|
||||||
|
@ -23,57 +23,57 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'main_message' => 'Action ":action", present in rule ":rule", could not be applied to transaction #:group: :error',
|
'main_message' => 'Action ":action", present in rule ":rule", could not be applied to transaction #:group: :error',
|
||||||
'find_or_create_tag_failed' => 'Could not find or create tag ":tag"',
|
'find_or_create_tag_failed' => 'Could not find or create tag ":tag"',
|
||||||
'tag_already_added' => 'Tag ":tag" is already linked to this transaction',
|
'tag_already_added' => 'Tag ":tag" is already linked to this transaction',
|
||||||
'inspect_transaction' => 'Inspect transaction ":title" @ Firefly III',
|
'inspect_transaction' => 'Inspect transaction ":title" @ Firefly III',
|
||||||
'inspect_rule' => 'Inspect rule ":title" @ Firefly III',
|
'inspect_rule' => 'Inspect rule ":title" @ Firefly III',
|
||||||
'journal_other_user' => 'This transaction doesn\'t belong to the user',
|
'journal_other_user' => 'This transaction doesn\'t belong to the user',
|
||||||
'no_such_journal' => 'This transaction doesn\'t exist',
|
'no_such_journal' => 'This transaction doesn\'t exist',
|
||||||
'journal_already_no_budget' => 'This transaction has no budget, so it cannot be removed',
|
'journal_already_no_budget' => 'This transaction has no budget, so it cannot be removed',
|
||||||
'journal_already_no_category' => 'This transaction had no category, so it cannot be removed',
|
'journal_already_no_category' => 'This transaction had no category, so it cannot be removed',
|
||||||
'journal_already_no_notes' => 'This transaction had no notes, so they cannot be removed',
|
'journal_already_no_notes' => 'This transaction had no notes, so they cannot be removed',
|
||||||
'journal_not_found' => 'Firefly III can\'t find the requested transaction',
|
'journal_not_found' => 'Firefly III can\'t find the requested transaction',
|
||||||
'split_group' => 'Firefly III cannot execute this action on a transaction with multiple splits',
|
'split_group' => 'Firefly III cannot execute this action on a transaction with multiple splits',
|
||||||
'is_already_withdrawal' => 'This transaction is already a withdrawal',
|
'is_already_withdrawal' => 'This transaction is already a withdrawal',
|
||||||
'is_already_deposit' => 'This transaction is already a deposit',
|
'is_already_deposit' => 'This transaction is already a deposit',
|
||||||
'is_already_transfer' => 'This transaction is already a transfer',
|
'is_already_transfer' => 'This transaction is already a transfer',
|
||||||
'is_not_transfer' => 'This transaction is not a transfer',
|
'is_not_transfer' => 'This transaction is not a transfer',
|
||||||
'complex_error' => 'Something complicated went wrong. Sorry about that. Please inspect the logs of Firefly III',
|
'complex_error' => 'Something complicated went wrong. Sorry about that. Please inspect the logs of Firefly III',
|
||||||
'no_valid_opposing' => 'Conversion failed because there is no valid account named ":account"',
|
'no_valid_opposing' => 'Conversion failed because there is no valid account named ":account"',
|
||||||
'new_notes_empty' => 'The notes to be set are empty',
|
'new_notes_empty' => 'The notes to be set are empty',
|
||||||
'unsupported_transaction_type_withdrawal' => 'Firefly III cannot convert a ":type" to a withdrawal',
|
'unsupported_transaction_type_withdrawal' => 'Firefly III cannot convert a ":type" to a withdrawal',
|
||||||
'unsupported_transaction_type_deposit' => 'Firefly III cannot convert a ":type" to a deposit',
|
'unsupported_transaction_type_deposit' => 'Firefly III cannot convert a ":type" to a deposit',
|
||||||
'unsupported_transaction_type_transfer' => 'Firefly III cannot convert a ":type" to a transfer',
|
'unsupported_transaction_type_transfer' => 'Firefly III cannot convert a ":type" to a transfer',
|
||||||
'already_has_source_asset' => 'This transaction already has ":name" as the source asset account',
|
'already_has_source_asset' => 'This transaction already has ":name" as the source asset account',
|
||||||
'already_has_destination_asset' => 'This transaction already has ":name" as the destination asset account',
|
'already_has_destination_asset' => 'This transaction already has ":name" as the destination asset account',
|
||||||
'already_has_destination' => 'This transaction already has ":name" as the destination account',
|
'already_has_destination' => 'This transaction already has ":name" as the destination account',
|
||||||
'already_has_source' => 'This transaction already has ":name" as the source account',
|
'already_has_source' => 'This transaction already has ":name" as the source account',
|
||||||
'already_linked_to_subscription' => 'The transaction is already linked to subscription ":name"',
|
'already_linked_to_subscription' => 'The transaction is already linked to subscription ":name"',
|
||||||
'already_linked_to_category' => 'The transaction is already linked to category ":name"',
|
'already_linked_to_category' => 'The transaction is already linked to category ":name"',
|
||||||
'already_linked_to_budget' => 'The transaction is already linked to budget ":name"',
|
'already_linked_to_budget' => 'The transaction is already linked to budget ":name"',
|
||||||
'cannot_find_subscription' => 'Firefly III can\'t find subscription ":name"',
|
'cannot_find_subscription' => 'Firefly III can\'t find subscription ":name"',
|
||||||
'no_notes_to_move' => 'The transaction has no notes to move to the description field',
|
'no_notes_to_move' => 'The transaction has no notes to move to the description field',
|
||||||
'no_tags_to_remove' => 'The transaction has no tags to remove',
|
'no_tags_to_remove' => 'The transaction has no tags to remove',
|
||||||
'not_withdrawal' => 'The transaction is not a withdrawal',
|
'not_withdrawal' => 'The transaction is not a withdrawal',
|
||||||
'not_deposit' => 'The transaction is not a deposit',
|
'not_deposit' => 'The transaction is not a deposit',
|
||||||
'cannot_find_tag' => 'Firefly III can\'t find tag ":tag"',
|
'cannot_find_tag' => 'Firefly III can\'t find tag ":tag"',
|
||||||
'cannot_find_asset' => 'Firefly III can\'t find asset account ":name"',
|
'cannot_find_asset' => 'Firefly III can\'t find asset account ":name"',
|
||||||
'cannot_find_accounts' => 'Firefly III can\'t find the source or destination account',
|
'cannot_find_accounts' => 'Firefly III can\'t find the source or destination account',
|
||||||
'cannot_find_source_transaction' => 'Firefly III can\'t find the source transaction',
|
'cannot_find_source_transaction' => 'Firefly III can\'t find the source transaction',
|
||||||
'cannot_find_destination_transaction' => 'Firefly III can\'t find the destination transaction',
|
'cannot_find_destination_transaction' => 'Firefly III can\'t find the destination transaction',
|
||||||
'cannot_find_source_transaction_account' => 'Firefly III can\'t find the source transaction account',
|
'cannot_find_source_transaction_account' => 'Firefly III can\'t find the source transaction account',
|
||||||
'cannot_find_destination_transaction_account' => 'Firefly III can\'t find the destination transaction account',
|
'cannot_find_destination_transaction_account' => 'Firefly III can\'t find the destination transaction account',
|
||||||
'cannot_find_piggy' => 'Firefly III can\'t find a piggy bank named ":name"',
|
'cannot_find_piggy' => 'Firefly III can\'t find a piggy bank named ":name"',
|
||||||
'no_link_piggy' => 'This transaction\'s accounts are not linked to the piggy bank, so no action will be taken',
|
'no_link_piggy' => 'This transaction\'s accounts are not linked to the piggy bank, so no action will be taken',
|
||||||
'both_link_piggy' => 'This transaction\'s accounts are both linked to the piggy bank, so no action will be taken',
|
'both_link_piggy' => 'This transaction\'s accounts are both linked to the piggy bank, so no action will be taken',
|
||||||
'cannot_unlink_tag' => 'Tag ":tag" isn\'t linked to this transaction',
|
'cannot_unlink_tag' => 'Tag ":tag" isn\'t linked to this transaction',
|
||||||
'cannot_find_budget' => 'Firefly III can\'t find budget ":name"',
|
'cannot_find_budget' => 'Firefly III can\'t find budget ":name"',
|
||||||
'cannot_find_category' => 'Firefly III can\'t find category ":name"',
|
'cannot_find_category' => 'Firefly III can\'t find category ":name"',
|
||||||
'cannot_set_budget' => 'Firefly III can\'t set budget ":name" to a transaction of type ":type"',
|
'cannot_set_budget' => 'Firefly III can\'t set budget ":name" to a transaction of type ":type"',
|
||||||
'journal_invalid_amount' => 'Firefly III can\'t set amount ":amount" because it is not a valid number.',
|
'journal_invalid_amount' => 'Firefly III can\'t set amount ":amount" because it is not a valid number.',
|
||||||
'cannot_remove_zero_piggy' => 'Cannot remove zero amount from piggy bank ":name"',
|
'cannot_remove_zero_piggy' => 'Cannot remove zero amount from piggy bank ":name"',
|
||||||
'cannot_remove_from_piggy' => 'Cannot remove ":amount" from piggy bank ":name"',
|
'cannot_remove_from_piggy' => 'Cannot remove ":amount" from piggy bank ":name"',
|
||||||
'cannot_add_zero_piggy' => 'Cannot add zero amount to piggy bank ":name"',
|
'cannot_add_zero_piggy' => 'Cannot add zero amount to piggy bank ":name"',
|
||||||
'cannot_add_to_piggy' => 'Cannot add ":amount" to piggy bank ":name"',
|
'cannot_add_to_piggy' => 'Cannot add ":amount" to piggy bank ":name"',
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user