Skip to content
Snippets Groups Projects
Commit b176c524 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

factorisation

parent 4efb0d70
No related branches found
No related tags found
No related merge requests found
...@@ -199,4 +199,26 @@ sub loc { ...@@ -199,4 +199,26 @@ sub loc {
return $self->stash('l10n')->maketext(@_); return $self->stash('l10n')->maketext(@_);
} }
sub mock_contacts {
my $self = shift;
my $sp = shift;
my $config = $self->app()->config();
my $entityid = $sp->entityid();
my $contacts =
$config->{$entityid}->{contacts} ||
$config->{service}->{contacts};
if ($contacts) {
if ($contacts =~ /^\+(.+)/) {
# complement original contacts
$sp->contacts($sp->contacts(), $self->string_to_list($1));
} else {
# replace original contacts
$sp->contacts($self->string_to_list($contacts));
}
}
}
1; 1;
...@@ -24,18 +24,7 @@ sub run { ...@@ -24,18 +24,7 @@ sub run {
return if !$sp; return if !$sp;
# override metadata contacts if needed # override metadata contacts if needed
my $contacts = $self->mock_contacts($sp);
$config->{$entityid}->{contacts} ||
$config->{service}->{contacts};
if ($contacts) {
if ($contacts =~ /^\+(.+)/) {
# complement original contacts
$sp->contacts($sp->contacts(), split(/, */, $1));
} else {
# replace original contacts
$sp->contacts(split(/, */, $contacts));
}
}
$self->stash(sp => $sp); $self->stash(sp => $sp);
$self->stash(entityid => $entityid); $self->stash(entityid => $entityid);
......
...@@ -36,18 +36,7 @@ sub run { ...@@ -36,18 +36,7 @@ sub run {
return if !$sp; return if !$sp;
# override metadata contacts if needed # override metadata contacts if needed
my $contacts = $self->mock_contacts($sp);
$config->{$entityid}->{contacts} ||
$config->{service}->{contacts};
if ($contacts) {
if ($contacts =~ /^\+(.+)/) {
# complement original contacts
$sp->contacts($sp->contacts(), split(/, */, $1));
} else {
# replace original contacts
$sp->contacts(split(/, */, $contacts));
}
}
## Check that email is a known contact for this SP ## Check that email is a known contact for this SP
return $self->abort( return $self->abort(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment