Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« on: September 24, 2007, 12:05:48 PM » |
|
When a customer clicks on the "Tickets" link in the nav bar (top of ttx.cgi screen) they can enter an access key or an e-mail address if they have forgotten the key. Forgot the key? We will send it to your email address. This mod changes the format of the list of tickets sent to a client when they fill in their e-mail address. All modifications are to the TTXTicket.pm file. (Code quoted below is from v.2.23.400 - the latest version at the time of writing.) Find the section(s) below in blue and add/edit the part(s) in red (you may exclude / change the comments in green): (this section starts at about line 450, but may differ from yours as I have other modifications to this code) my $browser = $tickets->list(0, 999, 'id', 'A', \@filter); my $list = $browser->{list}; if (@{$list} < 1) { $data->{ERROR_MESSAGE} = '[%No tickets found%]'; } else { my $body;
## ********************************* ## Part below inserted by Sam - 28 April 2007 # Section edit sends formatted table of all tickets # relating to requested e-mail address
$body .= "<table width='500' border='0' cellpadding='4' cellspacing='0' bordercolor='#FFFFFF'>". "<tr bgcolor='#4242FF'>". "<td><p class='tblHead'>Ticket</p></td>". "<td><p class='tblHead'>Subject</p></td>". "<td><p class='tblHead'>Status</p></td>". "</tr>";
my $bgcol = ""; my $bgcolI = 0;
## End insterted part ## ********************************
foreach my $id (@{$list}) { my $t = $tickets->ticket($id);
$body .= "#".$id." (".$t->{subject}.") KEY: ".$t->{key}."\n";##---FIND & DELETE THIS LINE---
## ********************************* ## Part below edited by Sam - 28 April 2007 ## Section edit formats table rows with alternating colours ## //$body .= "#".$id." (".$t->{subject}.") KEY: ".$t->{key}."\n"; ## - Original line above
++$bgcolI; if ($bgcolI == 1) {$bgcol = "#A6A2FB";} if ($bgcolI == 2) {$bgcol = "#CCCCCC"; $bgcolI = 0;}
$body .= "<tr bgcolor='$bgcol'><td>".$id."</td>". "<td>".$t->{subject}."<br />KEY: ". "<a href='http://".$cfg->get('httphost').$cfg->get('scriptname')."?cmd=ticket&key=". $t->{key}."'>".$t->{key}."</a>". "</td>". "<td>".TTXDictionary::translate(TTXCommon::status($t->{status}))."</td></tr>";
} $body .= "</table>\n"; ## ********************************* ## End edited part by Sam ## *********************************
$tickets = undef; $body = TTXDictionary::translate('Dear customer,')."\n\n". TTXDictionary::translate('This is a list of all service tickets associated '. 'with your email address')."\n\n$body\n";
## ********************************* ## Part below edited by Sam - 28 April 2007 ## $body .= TTXDictionary::translate('Use the following link to access your tickets')."\n". ## "[url http://$ENV{HTTP_HOST}$ENV{SCRIPT_NAME}?cmd=ticket]Show Ticket[/url]\n\n". ## TTXDictionary::translate('Kind Regards')."\n".$cfg->get('company')."\n"; ## - Original line(s) above
$body .= TTXDictionary::translate('Please click on the required access key to view your ticket').".\n\n". TTXDictionary::translate('Kind Regards')."\n".$cfg->get('company')."\n";
## ********************************* ## End edited part by Sam ## *********************************
That's it, I hope I haven't missed anything. Please test and let me know. Obviously you can change the colours to match your preference, change the following sections (in red) for different colours: $body .= "<table width='500' border='0' cellpadding='4' cellspacing='0' bordercolor='#FFFFFF'>". "<tr bgcolor='#4242FF'>". ++$bgcolI; if ($bgcolI == 1) {$bgcol = "#A6A2FB";} if ($bgcolI == 2) {$bgcol = "#CCCCCC"; $bgcolI = 0;}
|
|
|
|
« Last Edit: January 16, 2008, 05:43:19 PM by sparky672 »
|
Logged
|
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #1 on: September 24, 2007, 12:12:30 PM » |
|
Also remember to add the required responses to the dict.csv file!
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #2 on: September 24, 2007, 12:29:36 PM » |
|
Also remember to add the required responses to the dict.csv file! Or not. If the dictionary reference is missing, you'll just get the text of the macro. (I love TTX) I think that HTML code for the table is exactly the way I would have done it. Can you create a couple test tickets with my email address and send me one of these so I can see how it looks in Entourage? I'll send you my email address in a PM. After I get it, I'll post an Entourage screenshot here.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #3 on: September 24, 2007, 12:53:44 PM » |
|
If the dictionary reference is missing, you'll just get the text of the macro. I did not know that - nice feature. 
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #4 on: September 24, 2007, 12:56:08 PM » |
|
Sam's mod looks like this in MS Entourage for Mac... I like the hot-links and the alternating table colors. My plain list version of this mod is a carryover from TTX v 2.21 (pre-html messaging) so the links are not as pretty as Sam's. My only concern is what happens on the client end if they can't/won't view HTML? When I switch this to edit or text mode, I get the table HTML in between the normal text. Anyone have stats on how many people prefer text only email? I'm thinking it's a very low number.
|
|
|
|
« Last Edit: September 24, 2007, 01:00:19 PM by sparky672 »
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #5 on: September 24, 2007, 01:12:11 PM » |
|
I think most people these days use a mail client that is HTML capable and also prefer HTML mail.
All of my customers use HTML capable mail clients so this is not a problem for me. I don't think it would be too complicated to modify my mod so that it allows for people without HTML mail capabilities (or those that refuse to view messages in HTML).
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #6 on: September 24, 2007, 01:14:37 PM » |
|
I agree.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #7 on: September 24, 2007, 11:41:38 PM » |
|
If the dictionary reference is missing, you'll just get the text of the macro. I did not know that - nice feature.  Also I just pleasantly discovered that the dictionary will accept simple html as part of the tag example: in dict.csv ... Your name,(<b>your</b> name) ... means that ... [%Your name%] ... will display like this ... (your name)
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Amateurfool
Jr. Member

Karma: 3
Posts: 75
|
 |
« Reply #8 on: September 25, 2007, 05:16:51 AM » |
|
You know what, that is a fantastic mod, I'll post my experiences with it shortly.
|
|
|
|
|
Logged
|
"You hit me. Picard never hit me."
If you post here requesting help, please come back and let us know if you solve the problem.
|
|
|
Amateurfool
Jr. Member

Karma: 3
Posts: 75
|
 |
« Reply #9 on: September 25, 2007, 05:45:09 AM » |
|
Erm, either I have missed something, or you have missed something with your extra code.
----------------------------------------------------- Fatal Error: Unable to load module TTXTicket
Global symbol "$body" requires explicit package name at /var/www/cgi-bin/ttx/TTXTicket.pm line 507. Global symbol "$body" requires explicit package name at /var/www/cgi-bin/ttx/TTXTicket.pm line 509. Global symbol "$body" requires explicit package name at /var/www/cgi-bin/ttx/TTXTicket.pm line 518. Global symbol "$body" requires explicit package name at /var/www/cgi-bin/ttx/TTXTicket.pm line 533. Unmatched right curly bracket at /var/www/cgi-bin/ttx/TTXTicket.pm line 538, at end of line syntax error at /var/www/cgi-bin/ttx/TTXTicket.pm line 538, near "}" Compilation failed in require at (eval 12) line 2. BEGIN failed--compilation aborted at (eval 12) line 2.
SD:/var/www/cgi-bin/ttx -----------------------------------------------------
|
|
|
|
|
Logged
|
"You hit me. Picard never hit me."
If you post here requesting help, please come back and let us know if you solve the problem.
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #10 on: September 25, 2007, 06:53:59 AM » |
|
Hmm, that does not look good!
What version are you running?
Would it be possible for me to look at your code, do you have SSH access to your server - post the details to me in a private message.
|
|
|
|
|
Logged
|
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #11 on: September 25, 2007, 06:57:57 AM » |
|
Do you have a part that declares the variable? my $browser = $tickets->list(0, 999, 'id', 'A', \@filter); my $list = $browser->{list}; if (@{$list} < 1) { $data->{ERROR_MESSAGE} = '[%No tickets found%]'; } else { my $body;
## ********************************* ## Part below inserted by Sam - 28 April 2007 # Section edit sends formatted table of all tickets # relating to requested e-mail address
|
|
|
|
|
Logged
|
|
|
|
Sam
Jr. Member

Karma: 4
Posts: 92
|
 |
« Reply #12 on: September 25, 2007, 07:01:37 AM » |
|
Erm, either I have missed something, or you have missed something with your extra code.
 - It is possible that I might have missed something - this mode was done in April, so I could very easily have missed something. If I did, then I apologize and would like to help you resolve it, so that I can update the code I pasted. 
|
|
|
|
|
Logged
|
|
|
|
Amateurfool
Jr. Member

Karma: 3
Posts: 75
|
 |
« Reply #13 on: September 25, 2007, 07:08:12 AM » |
|
Hmm, that does not look good!
What version are you running?
Would it be possible for me to look at your code, do you have SSH access to your server - post the details to me in a private message.
It's version 2.23.400 There is SSH access, but it is locked to specific IP addresses, so cannot give you access, sorry. I can email you the modified TTXTicket.pm, had to revert to the default one, i was getting that error on all parts of the TTX system  Do you have a part that declares the variable? my $browser = $tickets->list(0, 999, 'id', 'A', \@filter); my $list = $browser->{list}; if (@{$list} < 1) { $data->{ERROR_MESSAGE} = '[%No tickets found%]'; } else { my $body;
## ********************************* ## Part below inserted by Sam - 28 April 2007 # Section edit sends formatted table of all tickets # relating to requested e-mail address Yes. Erm, either I have missed something, or you have missed something with your extra code.
 - It is possible that I might have missed something - this mode was done in April, so I could very easily have missed something. If I did, then I apologize and would like to help you resolve it, so that I can update the code I pasted.  I would love to use this mod, so will assist in any way i can.
|
|
|
|
|
Logged
|
"You hit me. Picard never hit me."
If you post here requesting help, please come back and let us know if you solve the problem.
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #14 on: September 25, 2007, 11:06:10 AM » |
|
The code looks good.
Could be a simple line-wrap issue, a colon instead of semi-colon, missing semi-colon, missing period, missing bracket, improper quoting, etc.
Perhaps a long line was broken instead of wrapping?
Perhaps an single quote was paired with a double quote?
Did you cut n paste or re-type?
Maybe some invisible character corrupted the file.
You can use an editor like BBedit to check for invisibles.
The fact that the server error mentions "$body" is not very meaningful. I missed a bracket yesterday and ALL my variables were listed in my error similar like yours.
|
|
|
|
« Last Edit: September 25, 2007, 11:08:26 AM by sparky672 »
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
|