From e83c63e0de147fe212d3963e55ec198c5baafa5c Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 28 Mar 2015 12:10:24 +0100 Subject: [PATCH] =?UTF-8?q?Ajoute=20un=20v=C3=A9rification=20de=20coh?= =?UTF-8?q?=C3=A9rence=20sur=20les=20attributs=20eduPersonAffiliation=20et?= =?UTF-8?q?=20eduPersonPrimaryAffiliation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config.LSobjects.LSsupannPerson.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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',