[SOLVED]: Print Result of Ticket Command
Moderator: crythias
[SOLVED]: Print Result of Ticket Command
Hello.
It's me again.
I have a process which is closed at create. Just to feed database with some dynamic field I've set up.
So, I modified the /bin/GetThreadTicket.pl to suit my needs and named it PrintAccess.pl
If in the command prompt I launch the command ./PrintAccess.pl -t 1620 it displays the outpout to STDOUT --> that's fine.
If in the command prompt I launch the command ./PrintAccess.pl -t 1620 | lp it prints the output to the printer --> that's fine.
What I want to do is, set a generic agent with a Trigger Event on Ticketcreate --> ./PrintAccess.pl | lp (Assuming that the ticket command module will pass the ticketID argument) but I can't get it working.
Do you have any ideas on how to have the pipe working in the ticket command module or (but I'm not in the right forum if I'll have to use second solution) how to tell the perl script to send the output directly to the default printer of the linux system instead of STDOUT ?
Many thanks.
It's me again.
I have a process which is closed at create. Just to feed database with some dynamic field I've set up.
So, I modified the /bin/GetThreadTicket.pl to suit my needs and named it PrintAccess.pl
If in the command prompt I launch the command ./PrintAccess.pl -t 1620 it displays the outpout to STDOUT --> that's fine.
If in the command prompt I launch the command ./PrintAccess.pl -t 1620 | lp it prints the output to the printer --> that's fine.
What I want to do is, set a generic agent with a Trigger Event on Ticketcreate --> ./PrintAccess.pl | lp (Assuming that the ticket command module will pass the ticketID argument) but I can't get it working.
Do you have any ideas on how to have the pipe working in the ticket command module or (but I'm not in the right forum if I'll have to use second solution) how to tell the perl script to send the output directly to the default printer of the linux system instead of STDOUT ?
Many thanks.
Last edited by othoma on 10 Jul 2015, 16:12, edited 1 time in total.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Print Result of Ticket Command
Another way you can do this is to use a script/batch file that handles the piping as a wrapper and pass the Ticket ID as an argument.
viewtopic.php?t=23081
viewtopic.php?t=23081
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Print Result of Ticket Command
Man, you're sooooooooooooooooo fast !!!
I saw that topic but I don't understand how top pass that argument.
I suppose my batch should be something like
and put in the ticket command /opt/otrs/bin/batchfile (after making my batch executable I guess)
But how will otrs replace the XXXX with the TicketID in the right place of the command ?
Thanks
I saw that topic but I don't understand how top pass that argument.
I suppose my batch should be something like
Code: Select all
#!/bin/bash
/opt/otrs/bin/otrs.PrintAccess.pl -t XXXXX| lp
But how will otrs replace the XXXX with the TicketID in the right place of the command ?
Thanks
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Print Result of Ticket Command
You didn't look at the other link.
CMD: /path/to/batch
Edit: removed improper entry.
Code: Select all
#!/bin/bash
/opt/otrs/bin/otrs.PrintAccess.pl -t $1 | lp
Edit: removed improper entry.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Print Result of Ticket Command
Thanks
I didn't see the first link in your answer... sorry
With that
I didn't see the first link in your answer... sorry
With that
I receive the error:You didn't look at the other link.
and that as a commandCode: Select all
#!/bin/bash /opt/otrs/bin/otrs.PrintAccess.pl -t $1 | lp
CMD: /path/to/batch
Do I miss something ?Fri Jul 10 14:23:43 2015 notice OTRS-CGI-00 Command returned a nonzero return code: rc=256, err=
Fri Jul 10 14:23:43 2015 error OTRS-otrs.GetTicketThread.pl-00 No such TicketID (ARG[1])!
Fri Jul 10 14:23:42 2015 notice OTRS-CGI-00 Execute '/opt/otrs/bin/printlogbook ARG[1]' for Ticket (0001752/1731).
Fri Jul 10 14:23:42 2015 notice OTRS-CGI-00 Run GenericAgent Job 'Print' from db.
Fri Jul 10 14:23:42 2015 info OTRS-CGI-00 New Ticket [0001752/Accès OBH - 201] created (TicketID=1731,Queue=Back Office::Accès OBH,Priority=Normal,State=closed successful)
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Print Result of Ticket Command
oops.
I"m sorry. I made a mistake.
viewtopic.php?t=24670
It appears that the cmd is passed as
/path/to/batch ticketnumber ticketid
so $2 should work for the batch script.
For clarification: if CMD is
/path/to/batch
Generic agent runs:
/path/to/batch 20150701000022 1234
I"m sorry. I made a mistake.
viewtopic.php?t=24670
It appears that the cmd is passed as
/path/to/batch ticketnumber ticketid
so $2 should work for the batch script.
For clarification: if CMD is
/path/to/batch
Generic agent runs:
/path/to/batch 20150701000022 1234
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: Print Result of Ticket Command
Now I have this error:
Fri Jul 10 15:20:03 2015 notice OTRS-CGI-00 Command returned a nonzero return code: rc=256, err=
Fri Jul 10 15:20:03 2015 error OTRS-otrs.GetTicketThread.pl-00 No such TicketID (0001758)!
Fri Jul 10 15:20:01 2015 notice OTRS-CGI-00 Execute '/opt/otrs/bin/printlogbook ARG[2]' for Ticket (0001758/1737).
Fri Jul 10 15:20:01 2015 notice OTRS-CGI-00 Run GenericAgent Job 'Print' from db.
Fri Jul 10 15:20:00 2015 info OTRS-CGI-00 New Ticket [0001758/Accès OBH - 201] created (TicketID=1737,Queue=Back Office::Accès OBH,Priority=Normal,State=closed successful)
Re: Print Result of Ticket Command
Solved...
It was:
and
THANK YOU!!!
It was:
Code: Select all
#!/bin/bash
/opt/otrs/bin/PrintAccess.pl -t $3 | lp
CMD: /opt/otrs/bin/printlogbook ARG[1]
THANK YOU!!!
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: [SOLVED]: Print Result of Ticket Command
Are you sure? Because I'm pretty sure ARG[1] is cruft. It's literally passing the string ARG[1].
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: [SOLVED]: Print Result of Ticket Command
Yes I'm sure. The printer is in another room. I think I made hundreds trips to the printer...
So when the page looked like I expected, I checked twice...
Maybe it's due to my altered configuration of otrs, but the last error I had was complaining about no such TIcketID and was trying to launch the command with the TicketNumber so I did
Note that my modified .pl file is coming from GetThreadTicket.pl but I removed all the part concerning Article ID and I enabled DynamicField ... So maybe it changed the order of the arguments.
In the end, that's ok now.
Thank you again crythias
So when the page looked like I expected, I checked twice...
Maybe it's due to my altered configuration of otrs, but the last error I had was complaining about no such TIcketID and was trying to launch the command with the TicketNumber so I did
Code: Select all
$n+1
In the end, that's ok now.
Thank you again crythias