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-02-08
This commit is contained in:
@@ -45,7 +45,6 @@ class StoredGroupEventHandler
|
||||
$this->triggerWebhooks($event);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method grabs all the users rules and processes them.
|
||||
*/
|
||||
@@ -58,14 +57,14 @@ class StoredGroupEventHandler
|
||||
}
|
||||
app('log')->debug('Now in StoredGroupEventHandler::processRules()');
|
||||
|
||||
$journals = $storedGroupEvent->transactionGroup->transactionJournals;
|
||||
$array = [];
|
||||
$journals = $storedGroupEvent->transactionGroup->transactionJournals;
|
||||
$array = [];
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$array[] = $journal->id;
|
||||
}
|
||||
$journalIds = implode(',', $array);
|
||||
$journalIds = implode(',', $array);
|
||||
app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
|
||||
|
||||
// collect rules:
|
||||
@@ -74,10 +73,10 @@ class StoredGroupEventHandler
|
||||
|
||||
// add the groups to the rule engine.
|
||||
// it should run the rules in the group and cancel the group if necessary.
|
||||
$groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal');
|
||||
$groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal');
|
||||
|
||||
// create and fire rule engine.
|
||||
$newRuleEngine = app(RuleEngineInterface::class);
|
||||
$newRuleEngine = app(RuleEngineInterface::class);
|
||||
$newRuleEngine->setUser($storedGroupEvent->transactionGroup->user);
|
||||
$newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]);
|
||||
$newRuleEngine->setRuleGroups($groups);
|
||||
@@ -86,7 +85,7 @@ class StoredGroupEventHandler
|
||||
|
||||
private function recalculateCredit(StoredTransactionGroup $event): void
|
||||
{
|
||||
$group = $event->transactionGroup;
|
||||
$group = $event->transactionGroup;
|
||||
|
||||
/** @var CreditRecalculateService $object */
|
||||
$object = app(CreditRecalculateService::class);
|
||||
@@ -100,14 +99,14 @@ class StoredGroupEventHandler
|
||||
private function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void
|
||||
{
|
||||
app('log')->debug(__METHOD__);
|
||||
$group = $storedGroupEvent->transactionGroup;
|
||||
$group = $storedGroupEvent->transactionGroup;
|
||||
if (false === $storedGroupEvent->fireWebhooks) {
|
||||
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $group->user;
|
||||
$user = $group->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
|
@@ -41,7 +41,8 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class UpdatedGroupEventHandler
|
||||
{
|
||||
public function runAllHandlers(UpdatedTransactionGroup $event): void {
|
||||
public function runAllHandlers(UpdatedTransactionGroup $event): void
|
||||
{
|
||||
$this->unifyAccounts($event);
|
||||
$this->processRules($event);
|
||||
$this->recalculateCredit($event);
|
||||
@@ -49,7 +50,6 @@ class UpdatedGroupEventHandler
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method will check all the rules when a journal is updated.
|
||||
*/
|
||||
|
@@ -407,6 +407,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -419,6 +420,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s%%', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -431,6 +433,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereNotLike('journal_meta.data', sprintf('%%%s"', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -443,6 +446,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('"%s%%', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -455,6 +459,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('%%%s"', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -467,6 +472,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->whereLike('journal_meta.data', sprintf('"%s%%', $internalReference));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -699,6 +705,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'external_id');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($externalId)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -708,6 +715,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->where('journal_meta.data', '=', json_encode($url));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -720,6 +728,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'internal_reference');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($internalReference)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -729,6 +738,7 @@ trait MetaCollection
|
||||
$this->query->where('journal_meta.name', '=', 'recurrence_id');
|
||||
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($recurringId)));
|
||||
$this->query->whereNull('journal_meta.deleted_at');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -56,20 +56,23 @@ abstract class Node
|
||||
|
||||
}
|
||||
|
||||
public function equals(Node $compare): bool
|
||||
public function equals(self $compare): bool
|
||||
{
|
||||
if ($compare->isProhibited(false) !== $this->isProhibited(false)) {
|
||||
Log::debug('Return false because prohibited status is different');
|
||||
|
||||
return false;
|
||||
}
|
||||
if ($compare instanceof NodeGroup) {
|
||||
if (count($compare->getNodes()) !== count($this->getNodes())) {
|
||||
Log::debug(sprintf('Return false because node count is different. Original is %d, compare is %d', count($this->getNodes()), count($compare->getNodes())));
|
||||
// var_dump($this);
|
||||
// var_dump($compare);
|
||||
// exit;
|
||||
|
||||
// var_dump($this);
|
||||
// var_dump($compare);
|
||||
// exit;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var int $index
|
||||
* @var Node $node
|
||||
@@ -79,12 +82,16 @@ abstract class Node
|
||||
Log::debug('Return false because nodes are different!');
|
||||
var_dump($this);
|
||||
var_dump($compare);
|
||||
|
||||
exit;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ class QueryParser implements QueryParserInterface
|
||||
|
||||
while ($this->position < strlen($this->query)) {
|
||||
$char = $this->query[$this->position];
|
||||
//Log::debug(sprintf('Char #%d: %s', $this->position, $char));
|
||||
// Log::debug(sprintf('Char #%d: %s', $this->position, $char));
|
||||
|
||||
// If we're in a quoted string, we treat all characters except another quote as ordinary characters
|
||||
if ($inQuotes) {
|
||||
|
@@ -125,7 +125,7 @@ class Steam
|
||||
foreach ($set as $entry) {
|
||||
// get date object
|
||||
$carbon = new Carbon($entry->date, $entry->date_tz);
|
||||
$carbonKey = $carbon->format('Y-m-d');
|
||||
$carbonKey = $carbon->format('Y-m-d');
|
||||
// make sure sum is a string:
|
||||
$sumOfDay = (string) (null === $entry->sum_of_day ? '0' : $entry->sum_of_day);
|
||||
|
||||
@@ -150,7 +150,7 @@ class Steam
|
||||
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $nativeSumOfDay);
|
||||
}
|
||||
// just set it.
|
||||
$balances[$carbonKey] = $currentBalance;
|
||||
$balances[$carbonKey] = $currentBalance;
|
||||
Log::debug(sprintf('Updated entry [%s]', $carbonKey), $currentBalance);
|
||||
}
|
||||
$cache->store($balances);
|
||||
@@ -274,8 +274,8 @@ class Steam
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty($date);
|
||||
if ($cache->has()) {
|
||||
// Log::debug(sprintf('CACHED finalAccountBalance(#%d, %s)', $account->id, $date->format('Y-m-d H:i:s')));
|
||||
// return $cache->get();
|
||||
// Log::debug(sprintf('CACHED finalAccountBalance(#%d, %s)', $account->id, $date->format('Y-m-d H:i:s')));
|
||||
// return $cache->get();
|
||||
}
|
||||
Log::debug(sprintf('finalAccountBalance(#%d, %s)', $account->id, $date->format('Y-m-d H:i:s')));
|
||||
|
||||
|
@@ -116,7 +116,7 @@ class AmountFormat extends AbstractExtension
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currency = TransactionCurrency::whereCode($code)->first();
|
||||
if(null === $currency) {
|
||||
if (null === $currency) {
|
||||
Log::error(sprintf('Could not find currency with code "%s". Fallback to native currency.', $code));
|
||||
$currency = Amount::getNativeCurrency();
|
||||
Log::error(sprintf('Fallback currency is "%s".', $currency->code));
|
||||
|
@@ -72,7 +72,7 @@ class General extends AbstractExtension
|
||||
$default = Amount::getNativeCurrency();
|
||||
$convertToNative = Amount::convertToNative();
|
||||
$useNative = $convertToNative && $default->id !== $currency->id;
|
||||
$currency = null === $currency ? $default : $currency;
|
||||
$currency = null === $currency ? $default : $currency;
|
||||
$strings = [];
|
||||
foreach ($info as $key => $balance) {
|
||||
if ('balance' === $key) {
|
||||
|
Reference in New Issue
Block a user