[rt-users] Email on ticket creation

John Case jcase at tenzing.com
Tue Oct 24 14:54:25 EDT 2000


On Tue, Oct 24, 2000 at 06:11:37PM +0100, Ben Carter wrote:
> Ah !!
> 
> Hmm, this does exactly what it says. (I did try that honest!!)
> 
> Is there anyway to make it email out to queue-members when a new call is
> created (and allocated to nobody) and then stop emailing ALL queue members
> when it has been assigned to someone.
> 
> Ben.
> 

Sure. In the rt source tree, edit lib/rt/database/manipulate.pm
In the function add_new_request(), change
...
if( $in_owner )
{
	&rt::template_mail('give',$in_queue_id,$rt::users{$in_owner}{email},"","", "$serial_num" ,
			   "$transaction_num","$in_subject","$in_current_user",'');

}
...
to
...
if( $in_owner )
{
	&rt::template_mail('give',$in_queue_id,$rt::users{$in_owner}{email},"","", "$serial_num" ,
		   "$transaction_num","$in_subject","$in_current_user",'');

} else {
      &rt::template_mail ('create_noowner',$in_queue_id,"$queues{$in_queue_id}{'dist_list'}","","", 
			  "$serial_num" ,"$transaction_num","$in_subject", "$in_current_user",'');
}
...
This will also require adding a new template.(In the source snip above,
I assume it's called "create_noowner")
Here's one:
--snip--
%trans:text_time%: Request %serial_num% was created.

 Transaction: %trans:text%
 
       Queue: %req:queue_id%
        Area: %req:area%               
     Subject: %req:subject%
       Owner: %req:owner%
  Requestors: %req:requestors%    
      Status: %req:status%

   This ticket was created with no owner; this email is to let you 
know in case you happen to want to take it or assign it.
-------------------------------------------------------------------------
%trans:content%
--snip--
In your source tree, this would go under lib/generic_templates

After these changes,
#make upgrade-noclobber
and this template will be available for all new queues you create.

However, you will have to manually copy it for queues that already exist.
To do this, you'll have to copy from your rt-install-dir/rt/lib/generic_templates 
to rt-install-dir/rt/etc/templates/queues/queuename

Ferexample, I've got rt installed under /usr/local/rt, and I already had two queues
named 'testq1' and 'testq2' before I made those code changes and created the template.
After I have done a "make upgrade-noclobber", I need to:
cp /usr/local/rt/lib/generic_templates/create_noowner /usr/local/rt/etc/templates/queues/testq1
cp /usr/local/rt/lib/generic_templates/create_noowner /usr/local/rt/etc/templates/queues/testq2

Later, I make a queue testq3. On creation, the create_noowner is automagically copied to that
qeueu's template directory, so I will not need to copy it manually.

Note that this only will mail on creation when there is no owner assigned, and there is no way to change that behavior unless you change the code again. I am too lazy to add a easy, pretty way to configure it. :)

Please forgive crappy formatting. Sometimes I forget I'm using vi.
-- 
john.case at tenzing.com





More information about the rt-users mailing list