Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
ldap
Commits
32126161
Commit
32126161
authored
Nov 06, 2020
by
David Surville
Browse files
Mise à jour des fonctions setUnicaenTermsOfUse et setSupannRefId
parent
a8c7f080
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenLdap/Entity/Base/People.php
View file @
32126161
...
...
@@ -1513,6 +1513,10 @@ class People extends Entity
{
$value
=
$this
->
preFormat
(
$value
);
if
(
empty
(
$value
))
{
$this
->
appendOrNot
(
'supannRefId'
,
$value
,
$append
);
}
foreach
(
$value
as
$v
)
{
if
(
preg_match
(
self
::
$attribute_with_label_pattern
,
$v
,
$matches
))
{
if
(
$append
)
{
...
...
@@ -1573,7 +1577,34 @@ class People extends Entity
public
function
setUnicaenTermsOfUse
(
$value
=
null
,
$append
=
false
)
{
$value
=
$this
->
preFormat
(
$value
);
$this
->
appendOrNot
(
'unicaenTermsOfUse'
,
$value
,
$append
);
if
(
empty
(
$value
))
{
$this
->
appendOrNot
(
'unicaenTermsOfUse'
,
$value
,
$append
);
}
foreach
(
$value
as
$v
)
{
if
(
preg_match
(
self
::
$attribute_with_label_pattern
,
$v
,
$matches
))
{
if
(
$append
)
{
$this
->
appendOrNot
(
'unicaenTermsOfUse'
,
$v
,
true
);
}
else
{
$label
=
$matches
[
'etiquette'
];
$identifiant
=
$matches
[
'identifiant'
];
$currentValues
=
$this
->
preFormat
(
$this
->
unicaenTermsOfUse
);
array_walk
(
$currentValues
,
function
(
&
$cv
)
use
(
$label
,
$identifiant
)
{
if
(
preg_match
(
"/^"
.
$label
.
"(?<identifiant>.+)$/"
,
$cv
,
$matches
))
{
if
(
$matches
[
'identifiant'
]
!=
$identifiant
)
{
$this
->
remove
(
'unicaenTermsOfUse'
,
$cv
);
$cv
=
null
;
}
}
});
if
(
!
in_array
(
$v
,
$currentValues
))
{
$currentValues
[]
=
$v
;
}
$this
->
appendOrNot
(
'unicaenTermsOfUse'
,
array_filter
(
$currentValues
),
false
);
}
}
}
return
$this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment