diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2014-07-11 13:57:02 +0000 |
---|---|---|
committer | Hakim Cassimally <hakim@mysociety.org> | 2014-08-14 09:44:36 +0000 |
commit | f16060fa322a4230a5b16a1e8c5b122307f29bee (patch) | |
tree | fb20f19916dd741cbc484528c9ecc619034cef6f /perllib/FixMyStreet.pm | |
parent | 8d97bff0663729b2abea6f7a38a547515cb23f9a (diff) |
refactor repeat code into get_email_template
Diffstat (limited to 'perllib/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm index 34c7bfe21..f3b72c4d0 100644 --- a/perllib/FixMyStreet.pm +++ b/perllib/FixMyStreet.pm @@ -200,4 +200,21 @@ sub configure_mysociety_dbhandle { } +=head2 get_email_template + +=cut + +sub get_email_template { + # TODO further refactor this by just using Template path + my ($class, $cobrand, $lang, $template) = @_; + + my $template_path = FixMyStreet->path_to( "templates", "email", $cobrand, $lang, $template )->stringify; + $template_path = FixMyStreet->path_to( "templates", "email", $cobrand, $template )->stringify + unless -e $template_path; + $template_path = FixMyStreet->path_to( "templates", "email", "default", $template )->stringify + unless -e $template_path; + $template = Utils::read_file( $template_path ); + return $template; +} + 1; |