Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Model/Listeners/SelectAccountListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,18 @@ public function onFlushCallback(OnFlushEventArgs $args): void
$this->entitiesToRecompute[] = $identity;
}

// 2) nemá full data přístup, má nastavený selectedAccount, ale odpovídající profil je neaktivní
// 2) nemá full data přístup, má nastavený selectedAccount, ale nemá pro něj
// (ani pro jeho nadřazený účet) aktivní profil. Parent-aware shoda je konzistentní
// s Identity::getProfile() i s tím, že SelectAccountForm nabízí přes getSubaccounts()
// i subúčty - majitel holdingu má profil jen na nadřazeném účtu.
if (!$hasFullData && $selectedAccount) {
$parentAccount = $selectedAccount->getParent();
$profileIsActive = false;
foreach ($identity->getProfiles() as $_profile) {
if ($_profile->getAccount() === $selectedAccount && $_profile->getIsActive()) {
if (
$_profile->getIsActive()
&& ($_profile->getAccount() === $selectedAccount || $_profile->getAccount() === $parentAccount)
) {
$profileIsActive = true;
break;
}
Expand Down