[rt-users] Using SQL Statements in Approval Templates

Oluwatomisin Ilori tomisilori at yahoo.co.uk
Thu Mar 3 11:23:33 EST 2005


Hi everyone,
I'm running RT 3.4.0 on debian linux 3.4 with perl 5.8.4, mysql 4.1.9, mod_perl 1 with apache 1.3 and i'm trying to find a way of retrieving a requestors name from the RT database. pls, is it possible to use sql statements in templates and if it is, can anyone be kind enough to help me with the code snippet. thanks in anticipation of your help. The template i'm given is shown below but the code isn't working.
 

===Create-Ticket: Need Approval
{
my $RequestorEmail = $Ticket->RequestorAddresses;
SELECT DISTINCT 
Users.Name AS rName FROM USERS 
WHERE
Users.EmailAddress=$RequestorEmail;
my $RequestorName =$record->rName
}
Subject: Approval for {$Tickets{'TOP'}->Subject}
Depended-On-By: {$Tickets{'TOP'}->Id}
Type: approval
Queue: Approvals
Owner: {$RequestorName}
Status: Open
Content-Type: text/html
Content: Your approval is requested for the ticket 
{$Tickets{"TOP"}->Id}: {$Tickets{"TOP"}->Subject}.
<br>
<br>
Please visit <a 
href="{$RT::WebURL}Approvals/Display.html?id={$Ticket->id+1}">{$RT::WebURL}Approvals/Display.html?id={$Ticket->id+1}</a> 
to approve or reject this ticket, or <a 
href="{$RT::WebURL}Approvals/">{$RT::WebURL}Approvals/</a> to 
batch-process all your pending approvals.
<br>
<br>
-------------------------------------------------------------------------
<br>
<br>
{$Transaction->Content()}
 
ENDOFCONTENT
 
part of the error code i got is given below:
 
ENDOFCONTENT
 (/opt/rt3/lib/RT/Action/CreateTickets.pm:952)
[Thu Mar  3 22:07:56 2005] [debug]: Workflow: yielding
Can't modify concatenation (.) or string in scalar assignment at template line 6, at EOF

Subject: Approval for test
Depended-On-By: 259
Type: approval
Queue: Approvals
Owner:
Status: Open
Content-Type: text/html
Content: Your approval is requested for the ticket
259: test.
<br>
<br>
Please visit <a
href="http://rt2.ipnxtelecoms.com:80/Approvals/Display.html?id=251">http://rt2.ipnxtelecoms.com:80/Approvals/Display.html?id=251</a>
to approve or reject this ticket, or <a
href="http://rt2.ipnxtelecoms.com:80/Approvals/">http://rt2.ipnxtelecoms.com:80/Approvals/</a> to
batch-process all your pending approvals.
<br>
<br>
-------------------------------------------------------------------------
<br>
<br>
This transaction appears to have no content
 
ENDOFCONTENT
 (/opt/rt3/lib/RT/Action/CreateTickets.pm:968)
[Thu Mar  3 22:07:56 2005] [error]: Ticket creation failed: Can't modify concatenation (.) or string in scalar assignment at template line 6, at EOF
 (/opt/rt3/lib/RT/Action/CreateTickets.pm:971)
[Thu Mar  3 22:07:56 2005] [warning]: Exiting subroutine via next at /opt/rt3/lib/RT/Action/CreateTickets.pm line 977.
 (/opt/rt3/lib/RT.pm:277)
[Thu Mar  3 22:19:54 2005] [info]: Successful login for root from 10.50.1.107 (/opt/rt3/share/html/autohandler:197)


Send instant messages to your online friends http://uk.messenger.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20050303/9f87d285/attachment.htm>


More information about the rt-users mailing list