[rt-devel] How to get human readable date_due into email templates

Jesse jesse at fsck.com
Sat Nov 18 13:23:31 EST 2000


in lib/rt/database/manipulate.pm, there's a subroutine called parse_req_row.

Replace this code:

if ($req[$in_serial_num]{'date_due'} > 0) {
	    $req[$in_serial_num]{'till_due'}=date_diff(time, $req[$in_serial_num]{'date_due'});
	}
	else {
	    $req[$in_serial_num]{'till_due'}="";
	}

With this code:

	if ($req[$in_serial_num]{'date_due'} > 0) {
	    $req[$in_serial_num]{'till_due'}=date_diff(time, $req[$in_serial_num]{'date_due'});
	    $req[$in_serial_num]{'date_due_readable'} = localtime($req[$in_serial_num]{'date_due'});
	}
	else {
	    $req[$in_serial_num]{'till_due'}="";
            $req[$in_serial_num]{'date_due_readable'} = "No date set";
	}


Jesse

On Sat, Nov 18, 2000 at 10:16:23AM -0800, Randy Shaw wrote:
> I want to show customers the assigned date_due in the autoreply, in human
> readable format. %req:date_due% returns it in Unix format.
> 
> I have read the archives and from the mysql cmd line I can return a date in
> the format needed:
> 
> select FROM_UNIXTIME(date_created) from rt.each_req
> 
> I don't know how to get from that piece of information to being able to put
> an embeddable token in my email templates.
> 
> The general approach required would be appreciated, i.e. am I trying to add
> a valid word to the %req:<word>% token, and if so what file(s) do should I
> be working in?
> 
> Code samples appreciated even more.
> 
> Send me the solution nicely documented and there's a bottle of fine wine in
> it for you.* I'd like to be able to embed %req:date_due_readable% or
> something like that in my email templates.
> 
> Randy
> wine.com
> 
> 
> *Fine print. First person to provide a complete working solution. And you
> have to live in the US in a state that I can legally ship wine to.
> 
> 
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel
> 

-- 
jesse reed vincent -- root at eruditorum.org -- jesse at fsck.com 
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

"If IBM _wanted_ to make clones, we could make them cheaper and faster than
anyone else!"  - An IBM Rep. visiting Vassar College's Comp Sci Department.




More information about the Rt-devel mailing list