Unverified Commit 4ecf6baf authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚑 fix(sinaps) Respect quotite tag in affectations

issue #5918
parent e36d23d9
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
Copyright (C) 2017-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -361,18 +361,23 @@ class sinapsRequest
continue;
}
if (isset($role->personneRessource->affectations->affectation)) {
$quotiteMax = NULL;
foreach ($role->personneRessource->affectations->affectation as $affectation) {
if (!$this->checkValidite($affectation, $now)) {
continue;
}
$UUID = $this->getUUIDFromReferenceCroisee($identifiantApplication, $affectation->referenceCroisee);
$quotite = (isset($affectation->quotite) ? (int)$affectation->quotite : 0);
if (!empty($UUID)) {
$entite = $ldapUuidToCodeEntiteCallback($UUID);
if (isset($entite['supannTypeEntite'])) {
$values['supannAccount']['supannTypeEntiteAffectation'][] = $entite['supannTypeEntite'];
}
$values['supannAccount']['supannEntiteAffectation'][] = $entite['supannCodeEntite'];
$values['supannAccount']['supannEntiteAffectationPrincipale'] = $entite['supannCodeEntite'];
if (($quotiteMax === NULL) || ($quotite > $quotiteMax)) {
$quotiteMax = $quotite;
$values['supannAccount']['supannEntiteAffectationPrincipale'] = $entite['supannCodeEntite'];
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment