Commit 733cb2f0 authored by Côme Chilliet's avatar Côme Chilliet

🚑 fix(supann) Fix saving of attributes of supannCMS

issue #6015
parent 2d7f4046
......@@ -61,10 +61,6 @@ class SupannCMSAffectationAttribute extends SupannCompositeAttribute
function supannGetValues (&$values)
{
if ($this->attributes[3]->getValue() !== TRUE) {
/* Card is not valid */
return;
}
foreach ($this->attributes as &$attribute) {
$shortname = preg_replace('/^([^_]+)_.*$/', '\\1', $attribute->getLdapName());
if ($shortname == 'none') {
......@@ -77,14 +73,27 @@ class SupannCMSAffectationAttribute extends SupannCompositeAttribute
if ($value == '') {
continue;
}
$values[$shortname][$value] = $value;
if ($this->attributes[3]->getValue() === TRUE) {
/* Card is valid */
$values[$shortname][$value] = $value;
}
}
unset($attribute);
$format = $this->attributes[1]->getValue();
$id = $this->attributes[2]->getValue();
$supannCMSIdEtiquette = '{'.$format.'}'.$id;
$supannCMSId = 'x-'.strtolower(str_replace(':', '-', $format)).';'.$id;
$values['supannCMSIdEtiquette'][$supannCMSIdEtiquette] = $supannCMSIdEtiquette;
$values['supannCMSId'][$supannCMSId] = $supannCMSId;
if ($this->attributes[3]->getValue() === TRUE) {
/* Card is valid */
$format = $this->attributes[1]->getValue();
$id = $this->attributes[2]->getValue();
$supannCMSIdEtiquette = '{'.$format.'}'.$id;
$supannCMSId = 'x-'.strtolower(str_replace(':', '-', $format)).';'.$id;
$values['supannCMSIdEtiquette'][$supannCMSIdEtiquette] = $supannCMSIdEtiquette;
$values['supannCMSId'][$supannCMSId] = $supannCMSId;
} else {
if (!isset($values['supannCMSIdEtiquette'])) {
$values['supannCMSIdEtiquette'] = [];
}
if (!isset($values['supannCMSId'])) {
$values['supannCMSId'] = [];
}
}
}
}
......@@ -63,9 +63,7 @@ class TaggedAttribute extends SetAttribute
$attrs[$this->getLdapName().';'.$tag] = [];
}
}
if (empty($this->value)) {
$attrs[$this->getLdapName()] = [];
} else {
if (!empty($this->value)) {
foreach ($this->value as $value) {
list($tag, $tagvalue) = explode(';', $value, 2);
if (empty($tag)) {
......
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