Template confirm mutation screen.

This commit is contained in:
Martin Kamerbeek 2010-11-18 15:21:44 +01:00
parent b9aaf63ec2
commit 745addd5d1
5 changed files with 66 additions and 15 deletions

View file

@ -87,6 +87,13 @@ sub definition {
namespace => 'Subscriber/NoMutationEmail',
tab => 'subscription',
},
confirmMutationTemplateId => {
fieldType => 'template',
defaultValue => 'WUk-wEhGiF8dcEogrJfrfg',
label => $i18n->get( 'confirm mutation template' ),
namespace => 'Subscriber/MutationConfirmation',
tab => 'subscription',
}
);
push( @{ $definition }, {
@ -527,21 +534,30 @@ sub www_confirmMutation {
]
);
my $var = {
message => $i18n->get( 'wrong code' ),
returnUrl => $self->getUrl,
isSuccess => 0,
"is$type" => 1,
};
if ( $userId ) {
$self->logConfirmation( $code );
if ( $type eq 'subscribe' ) {
$self->getSubscriptionGroup->addUsers( [ $userId ] );
return $self->processStyle( sprintf $i18n->get( 'subscription successful'), $self->getUrl );
$var->{ message } = sprintf $i18n->get( 'subscription successful'), $self->getUrl;
$var->{ isSuccess } = 1;
}
elsif ( $type eq 'unsubscribe' ) {
$self->getSubscriptionGroup->deleteUsers( [ $userId ] );
return $self->processStyle( sprintf $i18n->get( 'unsubscription successful' ), $self->getUrl );
$var->{ message } = sprintf $i18n->get( 'unsubscription successful' ), $self->getUrl;
$var->{ isSuccess } = 1;
}
}
return $self->processStyle( $i18n->get( 'wrong code' ) );
return $self->processTemplate( $var, $self->get('confirmMutationTemplateId') );
}
#----------------------------------------------------------------------------