diff --git a/local/conf/LSobjects/config.LSobjects.LSsupannPerson.php b/local/conf/LSobjects/config.LSobjects.LSsupannPerson.php index 3b074f2..f9e3624 100644 --- a/local/conf/LSobjects/config.LSobjects.LSsupannPerson.php +++ b/local/conf/LSobjects/config.LSobjects.LSsupannPerson.php @@ -22,6 +22,27 @@ require('referentiels.php'); +$checked = false; +function check_edupersonaffiliation($object) { + global $checked; + $values = $object->getValue('eduPersonAffiliation'); + + if (!$checked && in_array('affiliate', $values) && in_array('member', $values)) { + $checked = true; + return false; + } + return true; +} +function check_edupersonprimaryaffiliation($object) { + $primary = $object->getValue('eduPersonPrimaryAffiliation'); + $affiliations = $object->getValue('eduPersonAffiliation'); + $intersection = array_intersect($primary, $affiliations); + + if (! $intersection) { + return false; + } + return true; +} $GLOBALS['LSobjects']['LSsupannPerson'] = array ( 'objectclass' => array( 'inetOrgPerson', @@ -745,6 +766,12 @@ $GLOBALS['LSobjects']['LSsupannPerson'] = array ( 'html_options' => array ( 'possible_values' => $liste_affiliations ), + 'validation' => array( + array( + 'msg' => 'Les valeurs affiliate et member sont incompatibles', + 'function' => 'check_edupersonaffiliation', + ), + ), 'multiple' => 1, 'rights' => array( 'self' => 'r', @@ -766,6 +793,12 @@ $GLOBALS['LSobjects']['LSsupannPerson'] = array ( 'html_options' => array ( 'possible_values' => $liste_affiliations ), + 'validation' => array( + array( + 'msg' => 'Le profil principal doit faire faire partie des profils', + 'function' => 'check_edupersonprimaryaffiliation', + ), + ), 'multiple' => 0, 'rights' => array( 'self' => 'r',