Help Desk Software & Beyond
May 22, 2012, 01:15:20 AM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [FIX] When using TTX styles, email templates are ignored.  (Read 4234 times)
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« on: June 02, 2008, 10:14:05 AM »

I am working on following case. I want Troubletickets to work in 2 languages. Dutch and English.
I have added a template directory nl and translated the newticket.txt.
If I ad a new ticket with ttx.cgi?style=nl everything works OK, the ticket window is in the right language and the confirmation is also. Only the confirmation email that is send to the mailbox of the client is in default english. The helpdesk is not using newticket.txt that is uploaded to the nl directory.
How do I get this right?



edit by sparky:  more descriptive topic subject line
« Last Edit: June 03, 2008, 02:48:37 PM by sparky672 » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #1 on: June 02, 2008, 10:31:32 AM »

From this posting by Alex...

Quote
You may consider using styles. Style is a set of templates.

1) Create a directory under templates directory. Name it site1 (just an example, you may use any name).

2) Copy all files under templates directory to the site1

3) Execute Trouble Ticket Express via the following URL

ttx.cgi?style=site1

it will use templates form site1 subdirectory.

If a template does not exist in the specified style folder, the script will use default template.

The feature is not documented yet, but it is stable and will be preserved in the future versions.


Yes, you are requesting this in the correct forum, however for now you'll have to try to fix this yourself, wait for a solution to be posted here, or wait for Alex to fully implement the feature in a future release.

Email templates are called up in the TTXTicket.pm module in the usernotify and opernotify subroutines.
« Last Edit: June 02, 2008, 10:36:25 AM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #2 on: June 02, 2008, 10:53:11 AM »

You can try this...  I just whipped it out so it's not tested yet...

Find this piece in both the usernotify and opernotify subroutines of TTXTicket.pm...

Quote
if (open(TMPL, $cfg->get('basedir')."/templates/$tmpl.txt")) {
    my @buff = <TMPL>;
    close TMPL;
    $tmpl = join('', @buff);
  }

replace it all with this...

Quote
my $query;
my $style;
my $fn = $cfg->get('basedir')."/templates";
  if ($query->param('style') ne undef) {
    my @parts = split(/\/|\\/, $query->param('style'));
    $style = pop @parts;
  }
if (($style ne undef && open(TMPL, "$fn/$style/$tmpl.txt")) || open(TMPL, "$fn/$tmpl.txt")) {
    my @buff = <TMPL>;
    close TMPL;
    $tmpl = join('', @buff);
  }


Edit:  Jump down to the modifications...

http://forum.unitedwebcoders.com/index.php/topic,719.msg4072.html#msg4072
« Last Edit: June 03, 2008, 01:56:20 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« Reply #3 on: June 02, 2008, 11:51:37 AM »

This error happens after changing:
Fatal Error: Unable to load module TTXTicket

syntax error at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 89, near "$style my " Global symbol "$fn" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 89. Global symbol "$query" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 90. Global symbol "$query" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 91. Global symbol "$fn" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 94. Global symbol "$fn" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 94. Compilation failed in require at (eval 11) line 2. BEGIN failed--compilation aborted at (eval 11) line 2.

SD:C:/Inetpub/helpdesk/helpdesk
You can try this...  I just whipped it out so it's not tested yet...

Find this piece in both the usernotify and opernotify subroutines of TTXTicket.pm...

Quote
if (open(TMPL, $cfg->get('basedir')."/templates/$tmpl.txt")) {
    my @buff = <TMPL>;
    close TMPL;
    $tmpl = join('', @buff);
  }

replace it all with this...

Quote
my $style
my $fn = $cfg->get('basedir')."/templates";
  if ($query->param('style') ne undef) {
    my @parts = split(/\/|\\/, $query->param('style'));
    $style = pop @parts;
  }
if (($style ne undef && open(TMPL, "$fn/$style/$tmpl.txt")) || open(TMPL, "$fn/$tmpl.txt")) {
    my @buff = <TMPL>;
    close TMPL;
    $tmpl = join('', @buff);
  }
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #4 on: June 02, 2008, 01:11:20 PM »

Two dumb mistakes on my part.   Undecided

Forgot to mention a variable and forgot a semi-colon.

See corrections in red above.

No more compilation errors but still not tested for functionality.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« Reply #5 on: June 02, 2008, 02:11:55 PM »

The correct code was not included.
Two dumb mistakes on my part.   Undecided

Forgot to mention a variable and forgot a semi-colon.

See corrections in red above.

No more compilation errors but still not tested for functionality.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #6 on: June 02, 2008, 02:19:37 PM »

The correct code was not included.
Two dumb mistakes on my part.   Undecided

Forgot to mention a variable and forgot a semi-colon.

See corrections in red above.

No more compilation errors but still not tested for functionality.

Yes it was.  Here....

http://forum.unitedwebcoders.com/index.php/topic,719.msg4048.html#msg4048
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« Reply #7 on: June 02, 2008, 02:30:11 PM »

This is the error I get after submitting a ticket:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
« Last Edit: June 02, 2008, 02:41:17 PM by sparky672 » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #8 on: June 02, 2008, 02:40:59 PM »

This is the error I get after submitting a ticket:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Yes, I just got that error too.  Ticket was created and confirmation email was sent but something went very wrong when re-directing to the confirmation page.

We gave it a shot but I don't have any more time to troubleshoot this today.

Since tickets are still created and confirmation emails sent, I'm sure this is something simple.

Just go back to your original files for now.


Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #9 on: June 03, 2008, 01:52:37 PM »

SOLVED -> The following was fully tested in TTX version 2.24 with a duplicate template set.   Grin

All the modifications below are performed on the TTXTicket.pm module



1.  In the usernotify subroutine

a.  find this line and ADD the parts in blue...

Quote
my $name = $ticket->{'name'};
my $style = $_[0]->{style};
my $fn = $cfg->get('basedir')."/templates";

b.  find the line in red and REPLACE with the blue.  (NOTE:  In TWO places within this subroutine.)

Quote
if (open(TMPL, $cfg->get('basedir')."/templates/$tmpl.txt")) {
if (($style ne undef && open(TMPL, "$fn/$style/$tmpl.txt")) || open(TMPL, "$fn/$tmpl.txt")) {
   my @buff = <TMPL>;
   close TMPL;
   $tmpl = join('', @buff);
  }



2.  In the opernotify subroutine

a.  find this line and ADD the parts in blue...

Quote
my $ticket = $_[0]->{ticket};
my $style = $_[0]->{style};
my $fn = $cfg->get('basedir')."/templates";

b.  find the line in red and REPLACE with the blue.  (In ONE place within this subroutine.)

Quote
if (open(TMPL, $cfg->get('basedir')."/templates/$tmpl.txt")) {
if (($style ne undef && open(TMPL, "$fn/$style/$tmpl.txt")) || open(TMPL, "$fn/$tmpl.txt")) {
   my @buff = <TMPL>;
   close TMPL;
   $tmpl = join('', @buff);
  }



3.  In the newticket subroutine

a.  find this line and ADD the parts in blue...

Quote
my ($cfg, $query, $data) = @_;
my $style = $query->param('style');

b.  find each line and ADD the parts in blue....

Quote
usernotify({cfg => $cfg, ticket => $ticket, style => $style, validationcode => $data->{VALIDATIONCODE}})

Quote
my $opernotifydata = {cfg => $cfg, ticket => $ticket, style => $style};



4.  In the ticket subroutine

a.  find this line and ADD the parts in blue...

Quote
TTXCommon::tickedvars($cfg, $data);
my $style = $query->param('style');

b.  find each line and ADD the parts in blue....

Quote
usernotify({cfg => $cfg, ticket => $t, style => $style,

Quote
my $opernotifydata = {cfg => $cfg, ticket => $t, style => $style};

Quote
opernotify({cfg => $cfg, ticket => $t, style => $style});

Quote
my $opernotifydata = {cfg => $cfg, ticket => $t, style => $style};

Quote
my $opernotifydata = {cfg => $cfg, ticket => $t, style => $style};

Quote
opernotify({cfg => $cfg, ticket => $t, style => $style});
« Last Edit: June 20, 2008, 02:00:13 AM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« Reply #10 on: June 04, 2008, 03:36:31 PM »

A lot of changing in the code. It was easier just to drop the file.  Wink Anyway this error appears
Fatal Error: Unable to load module TTXTicket

Global symbol "$style" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 302. Global symbol "$fn" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 302. Global symbol "$style" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 302. Global symbol "$fn" requires explicit package name at C:/Inetpub/helpdesk/helpdesk/TTXTicket.pm line 302. Compilation failed in require at (eval 23) line 2. BEGIN failed--compilation aborted at (eval 23) line 2.

In line 302 is clearly something wrong. I double checked it and its exact like above stated:
if (($style ne undef && open(TMPL, "$fn/$style/$tmpl.txt")) || open(TMPL, "$fn/$tmpl.txt")) {
« Last Edit: June 04, 2008, 03:43:22 PM by enturion » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #11 on: June 04, 2008, 04:18:47 PM »

Quote
A lot of changing in the code. It was easier just to drop the file.

 Roll Eyes

And it would be easier for me to just tell you to wait for Alex to fix the feature in a future release.  So I hope you're not complaining to me, a volunteer, about having to contribute just a little bit of effort yourself.   Huh

Besides, most importantly, I won't drop files since many people already have other modifications applied and would have to manually re-apply those anyway.  I'm only here to point you in the right direction, make suggestions, and help out where-ever I can... I'm not here to simply write & upload modifications on demand.  In the process of manually editing, a user might actually learn something about how these modifications work.    Wink


Line 302 is in the opernotify subroutine so carefully double-check the edit that comes before line 302...  step 2a...

That error means that the following is either missing, incorrect, or corrupted...

Quote
my $style = $_[0]->{style};
my $fn = $cfg->get('basedir')."/templates";
« Last Edit: June 07, 2008, 01:07:06 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
enturion
Newbie
*

Karma: -2
Posts: 16


View Profile
« Reply #12 on: June 04, 2008, 04:26:04 PM »

I understand. We are all slaves of our interest to make it work. Cheesy
Tomorrow I will give it a try again and put the file, if working, for download. If Alex agrees of course.
THX any way for your help.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #13 on: June 04, 2008, 04:43:52 PM »

Quote
Tomorrow I will give it a try again and put the file, if working, for download.

Please do not post download links to any modified TTX files as there is no way to verify the integrity of such files.  We also don't need a bunch of variations of something with the same file name posted all over the place.   Shocked

The modification is already posted here for everyone to see and apply as they see fit.

This forum is about users learning to apply their own modifications to TTX.  These modifications are not supported by Alex.

Edit:  Solution verified.  Thread locked.
« Last Edit: June 07, 2008, 01:10:12 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.044 seconds with 19 queries.