Added the notification for the tickets.

dev
Loic d'Anterroches 2009-01-25 10:58:24 +01:00
parent ec2565e244
commit e513d95dbe
3 changed files with 23 additions and 8 deletions

View File

@ -153,7 +153,14 @@ class IDF_Views_Issue
$urlissue = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been created.'), $urlissue, $issue->id));
$to_emails = array();
if (null != $issue->get_owner() and $issue->owner != $issue->submitter) {
$to_emails[] = $issue->get_owner()->email;
}
if ('' != $request->conf->getVal('issues_notification_email', '')) {
$to_emails[] = $request->conf->getVal('issues_notification_email', '');
}
foreach ($to_emails as $oemail) {
$comments = $issue->get_comments_list(array('order' => 'id ASC'));
$context = new Pluf_Template_Context(
array(
@ -163,7 +170,6 @@ class IDF_Views_Issue
'url_base' => Pluf::f('url_base'),
)
);
$oemail = $issue->get_owner()->email;
$email = new Pluf_Mail(Pluf::f('from_email'), $oemail,
sprintf(__('Issue %s - %s (%s)'),
$issue->id, $issue->summary, $prj->shortname));
@ -284,16 +290,23 @@ class IDF_Views_Issue
$tmpl = new Pluf_Template('idf/issues/issue-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail_Batch(Pluf::f('from_email'));
$to_emails = array();
foreach ($interested as $user) {
if ($user->id != $request->user->id) {
$email->setSubject(sprintf(__('Updated Issue %s - %s (%s)'),
$issue->id, $issue->summary, $prj->shortname));
$email->setTo($user->email);
$email->setReturnPath(Pluf::f('from_email'));
$email->addTextMessage($text_email);
$email->sendMail();
$to_emails[] = $user->email;
}
}
if ('' != $request->conf->getVal('issues_notification_email', '')) {
$to_emails[] = $request->conf->getVal('issues_notification_email');
}
foreach ($to_emails as $oemail) {
$email->setSubject(sprintf(__('Updated Issue %s - %s (%s)'),
$issue->id, $issue->summary, $prj->shortname));
$email->setTo($oemail);
$email->setReturnPath(Pluf::f('from_email'));
$email->addTextMessage($text_email);
$email->sendMail();
}
$email->close();
return new Pluf_HTTP_Response_Redirect($url);
}

View File

@ -452,6 +452,7 @@ class IDF_Views_Project
array(
'page_title' => $title,
'form' => $form,
'from_email' => Pluf::f('from_email'),
),
$request);
}

View File

@ -86,7 +86,8 @@
{block context}
<div class="issue-submit-info">
<p><strong>{trans 'Instructions:'}</strong></p>
<p>{blocktrans}You can configure here the project tabs access rights.{/blocktrans}</p>
<p>{blocktrans}You can configure here the project tabs access rights and notification emails.{/blocktrans}</p>
<p>{blocktrans}Notification emails will be sent by the <strong>{$from_email}</strong> address, if you send the email to a mailing list, you may need to register this email address. If you do not want to send emails for a given type of changes, simply leave the corresponding field empty.{/blocktrans}</p>
<p>{blocktrans}If you mark a project as private, only the project members and administrators, together with the extra authorized users you provide will have access to the project. You will still be able to define further access rights for the different tabs but the "Open to all" and "Signed in users" will default to authorized users only.{/blocktrans}</p>
<p>{blocktrans}Specify each person by its login. Each person must have already registered with the given login. Separate the logins with commas and/or new lines.{/blocktrans}</p>
</div>