@@ -1014,6 +1014,24 @@ sub permissions
1014
1014
}
1015
1015
}
1016
1016
1017
+ sub _map_fields
1018
+ { my ($self , $text ) = @_ ;
1019
+ my @fields = (' firstname' , ' surname' , ' email' , ' title' , ' organisation' , ' department' , ' team' );
1020
+
1021
+ if ($text )
1022
+ {
1023
+ foreach my $field (@fields )
1024
+ {
1025
+ my $value = $self -> $field || ' ' ;
1026
+ $text =~ s /\{ $field\} / $value / g ;
1027
+ }
1028
+ my $notes = $self -> account_request_notes || ' ' ;
1029
+ $text =~ s /\{ notes\} / $notes / g ;
1030
+ }
1031
+
1032
+ return $text ;
1033
+ }
1034
+
1017
1035
sub retire
1018
1036
{ my ($self , %options ) = @_ ;
1019
1037
@@ -1023,14 +1041,19 @@ sub retire
1023
1041
# Properly delete if account request - no record needed
1024
1042
if ($self -> account_request)
1025
1043
{
1044
+ if ($options {send_reject_email })
1045
+ {
1046
+ my $email_body = $options {email_reject_text } || $site -> email_reject_text || " Your account request has been rejected" ;
1047
+ $email_body = $self -> _map_fields($email_body );
1048
+
1049
+ my $email = GADS::Email-> instance;
1050
+ $email -> send ({
1051
+ subject => $site -> email_reject_subject || " Account request rejected" ,
1052
+ emails => [$self -> email],
1053
+ text => $email_body ,
1054
+ });
1055
+ }
1026
1056
$self -> delete ;
1027
- return unless $options {send_reject_email };
1028
- my $email = GADS::Email-> instance;
1029
- $email -> send ({
1030
- subject => $site -> email_reject_subject || " Account request rejected" ,
1031
- emails => [$self -> email],
1032
- text => $site -> email_reject_text || " Your account request has been rejected" ,
1033
- });
1034
1057
1035
1058
return ;
1036
1059
}
0 commit comments