From: Johan Cwiklinski Date: Sat, 9 Oct 2021 10:13:02 +0000 (+0200) Subject: Check if member is part of children X-Git-Tag: 0.9.5.1~33 X-Git-Url: https://git.agnieray.net/?a=commitdiff_plain;h=0d1f1f676bde5476af8adc1cb075b2c14e8aa84d;p=galette.git Check if member is part of children --- diff --git a/galette/lib/Galette/Entity/Contribution.php b/galette/lib/Galette/Entity/Contribution.php index d3884f5ce..834842b98 100644 --- a/galette/lib/Galette/Entity/Contribution.php +++ b/galette/lib/Galette/Entity/Contribution.php @@ -1454,7 +1454,12 @@ class Contribution ->enableDep('children') ->load($this->login->id); if ($parent->hasChildren()) { - return true; + foreach ($parent->children as $child) { + if ($child->id === $this->_member) { + return true; + } + } + return false; } return false; diff --git a/galette/lib/Galette/Entity/Transaction.php b/galette/lib/Galette/Entity/Transaction.php index 02fd3a97f..7f9fff60f 100644 --- a/galette/lib/Galette/Entity/Transaction.php +++ b/galette/lib/Galette/Entity/Transaction.php @@ -673,7 +673,12 @@ class Transaction ->enableDep('children') ->load($this->login->id); if ($parent->hasChildren()) { - return true; + foreach ($parent->children as $child) { + if ($child->id === $this->_member) { + return true; + } + } + return false; } return false;