Skip to content
Browse files

Send an email to the admin on session creation

  • Loading branch information...
1 parent 0d397d7 commit c07cdb63db872d29f17ab18899ac369fbe0e066c @kimrutherford kimrutherford committed Apr 5, 2013
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/PomCur/Controller/Tools.pm
View
15 lib/PomCur/Controller/Tools.pm
@@ -9,6 +9,8 @@ use Package::Alias PubmedUtil => 'PomCur::Track::PubmedUtil',
use Clone qw(clone);
use Try::Tiny;
+use PomCur::MailSender;
+
sub _get_status_cv
{
my $schema = shift;
@@ -385,7 +387,18 @@ sub start : Local Args(1) {
my $curs_schema = PomCur::Track::create_curs_db($config, $curs);
- $c->res->redirect($c->uri_for("/curs/$curs_key"));
+ my $mail_sender = PomCur::MailSender->new(config => $config);
+
+ my $subject = "Created new session $curs_key from $pub_uniquename";
+ my $session_uri = $c->uri_for("/curs/$curs_key");
+ my $body = "Publication: pub_uniquename\n\n" .
+ $pub->title() . "\n\n" .
+ "Session: " . $session_uri . "\n";
+
+ $mail_sender->send_to_admin(subject => $subject,
+ body => $body);
+
+ $c->res->redirect($session_uri);
}
=head2 pub_session

0 comments on commit c07cdb6

Please sign in to comment.
Something went wrong with that request. Please try again.