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

🚑 fix(supann) Fix saving of attributes of supannCMS

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