LimeSurveys (Not OTRS)

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Post Reply
User avatar
crythias
Moderator
Posts: 9980
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

LimeSurveys (Not OTRS)

Post by crythias » 12 Sep 2012, 04:39

UPDATE: you don't have to do all this. You may want to just create a specific url specifying the field ID:
https://yourdomain/survey/index.php/SurveyIdNumber/lang-en?SurveyIdNumberXxXx=<OTRS_TICKET_TicketNumber>
https://manual.limesurvey.org/SGQA_identifier


Disclaimer: this is not related to OTRS. It's an idea. ignore it.

"I really would like to have different surveys for each queue ..."
Take a look at LimeSurvey as an option and create a Response for the Queue with a link to the survey you want.

"But how do I link the survey to my ticket/user?"
one way to do this is by back-door using the ticket number as a token in limesurvey.

"Huh?"
A given survey has a survey id (sid=68292, for instance)
if you make the survey a closed survey, there will be a token table created, for example:
lime_tokens_68292
there are several fields here: firstname,lastname,email,sent,usesleft,validfrom, validuntil
all of which may be of importance (you may, for instance, want to expire a survey a few days out)
The most important thing you'll need to insert is "token". That should be the value = the ticket id.

The survey link would then be, for examplehttp://serverHostingLimeSurvey/limesurv ... 1110000012
That link should be pretty easy to generate in a Response

"OK, so ... how do I get a ticketnumber into the table?"

one way is to create an event:
You need an XML file in Kernel/Config/Files:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Application">
    <ConfigItem Name="Ticket::EventModulePost###LimeSurvey" Required="0" Valid="1">
        <Description Lang="en">Enable for token generation for LimeSurvey</Description>
        <Description Lang="de"></Description>
        <Group>Ticket</Group>
        <SubGroup>Core::Ticket</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::System::Ticket::Event::LimeToken</Item>
                <Item Key="Event">(TicketCreate|TicketQueueUpdate)</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>
And you need the LimeToken.pm module
maybe something like this to drop in Kernel/System/Ticket/Event/LimeToken.pm

Code: Select all

package Kernel::System::Ticket::Event::LimeToken;

use strict;
use warnings;

use vars qw($VERSION);
$VERSION = qw($Revision: 1.12 $) [1];

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # get needed objects
    for (qw(ConfigObject TicketObject LogObject UserObject CustomerUserObject
 SendmailObject EncodeObject MainObject)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }

         # create Lime DB Object
         $Self->{LimeObject} = Kernel::System::DB->new(
                ConfigObject => $Self->{ConfigObject},
                EncodeObject => $Self->{EncodeObject},
                LogObject => $Self->{LogObject},
                MainObject => $Self->{MainObject},
                DatabaseDSN => 'DBI:mysql:database=limesurvey;host=localhost;',
                DatabaseUser => 'limesurvey',
                DatabasePw => 'limedbpassword',
                Type => 'mysql',
        );


    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for (qw(Data Event Config)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_
!" );
            return;
        }
    }
    for (qw(TicketID)) {
        if ( !$Param{Data}->{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_ in Data!" );
            return;
        }
    }

    if ( $Param{Event} eq 'TicketCreate' ) {
        my %Ticket = $Self->{TicketObject}->TicketGet(
            TicketID      => $Param{Data}->{TicketID},
            DynamicFields => 0,
        );
        if ( $Ticket{Queue} eq 'Main' ) {
                          $Self->{LimeObject}->Do(
                                  SQL => "INSERT INTO lime_tokens_68292 (token) VALUES (?)",
                                  Bind => [ \$Ticket{TicketNumber} ],
                                );

            # do some stuff
            $Self->{TicketObject}->HistoryAdd(
                TicketID     => $Param{Data}->{TicketID},
                CreateUserID => $Param{UserID},
                HistoryType  => 'Misc',
                Name         => 'Updated Token!',
            );
        }
    }
    elsif ( $Param{Event} eq 'TicketQueueUpdate' ) {
        my %Ticket = $Self->{TicketObject}->TicketGet(
            TicketID      => $Param{Data}->{TicketID},
            DynamicFields => 0,
        );
        if ( $Ticket{Queue} eq 'Junk' ) {

            # do some stuff
                          $Self->{LimeObject}->Do(
                                  SQL => 'INSERT INTO lime_tokens_68292 (token) VALUES (?)',
                                  Bind => [ \$Ticket{TicketNumber} ],
                                );


            $Self->{TicketObject}->HistoryAdd(
                TicketID     => $Param{Data}->{TicketID},
                CreateUserID => $Param{UserID},
                HistoryType  => 'Misc',
                Name         => 'Added a token for the survey'
            );
        }
    }
    return 1;
}

1;
Now, this will make multiple of the same token if you're not careful, but limesurvey doesn't seem to care.

In summary, this makes a one-shot survey available.

"But you promised multiple surveys!!!"
Well, yeah, if you pay attention, you can add a bunch of "ifs" in this event and update the appropriate "tokens" table for that Queue.

Then, if you create a Response associated with that queue, you'll have a link that connects to the appropriate survey id for the queue, which you'd additionally hard code in your event.

This example has a LOT of importance to programming against OTRS.
You have:
  • Connection to an external database
  • A real example of an event
  • An example of passing a ticket number as a key value to another database
If I missed something, or there's a bug, let me know. If you understand what's going on, even in the slightest, I think you'll get that 'A-HA!' moment ... let me know what you think.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
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

User avatar
crythias
Moderator
Posts: 9980
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LimeSurveys (Not OTRS)

Post by crythias » 12 Sep 2012, 05:06

Sample Response:

Code: Select all

Thank you for the opportunity to assist you. Please take a short moment to answer a few questions ....
Survey link: http://limesurveyhost/limesurvey/index.php?sid=xxxxx&lang=en&token=<OTRS_TICKET_TicketNumber>
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
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

User avatar
crythias
Moderator
Posts: 9980
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LimeSurveys (Not OTRS)

Post by crythias » 12 Sep 2012, 05:16

"Can this be truly anonymous?"
There are two parts to answer that question. The FAQ has a good answer.

There are a couple of other things to think about.
Someone on the LimeSurvey side would have to know that the only identifying value is a token value with a large date timestamp or other ticket number that comes explicitly from OTRS, and someone would have to be able to look up that ticket number in OTRS to cross-reference.

Could it be possible? yes, but that's also based upon several layers of access on both LimeSurvey and OTRS. Internally, if LimeSurvey doesn't link the token to the result, there's no practical way to discern who submitted what result, and the tokens disappear when used.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
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

Alexander Halle
OTRS superhero
Posts: 296
Joined: 04 Jul 2010, 17:49
OTRS Version?: 3.1.x
Real Name: Alexander Halle
Company: radprax MVZ GmbH
Location: Wuppertal
Contact:

Re: LimeSurveys (Not OTRS)

Post by Alexander Halle » 12 Sep 2012, 09:32

Thanks a lot!

Great idea to use LimeSurvey (IMHO the standard open source survey application) instead of the OTRS survey addon. LimeSurvey has more features and is developed actively in contrast to the OTRS addon.

You made me think if the survey feature has to be part of the ticket system itself. The only drawback is the different GUI, but AFAIR LimeSurvey supports skins.

P.S.
Why not posted in the HowTo forum?
Alexander Halle System: OTRS 3.1.x, Ubuntu 10.04.x LTS, MySQL 5.1.x, Apache 2.2.x
OTRS Community Links: User Meetings, Projects

jojo
Moderator
Posts: 14212
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: LimeSurveys (Not OTRS)

Post by jojo » 31 Jan 2013, 00:24

Lime Survey has now an API via Rest

http://docs.limesurvey.org/RemoteContro ... rticipants

Looks also as a good starting point
"Production": OTRS Business Solution™ 6, STORM powered by OTRS
"Testing": OTRS git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

foshito
OTRS newbie
Posts: 7
Joined: 18 Jan 2014, 16:20
OTRS Version?: 3.3.3
Real Name: Marco
Company: Gallo

Re: LimeSurveys (Not OTRS)

Post by foshito » 19 Apr 2016, 20:51

Hello Friend
This mail is for assistance on implementing limesurvey with OTRS, please
could help me with the configuration I need to make extremely urgent.
I do not really understand the settings found in the forum
Thanks for your help.

jojo
Moderator
Posts: 14212
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: LimeSurveys (Not OTRS)

Post by jojo » 19 Apr 2016, 22:49

This is a quite old "hack" for an old OTRS version. If you can not understand the changes you are doing on your OTRS installation you should stick to the OTRS survey module
"Production": OTRS Business Solution™ 6, STORM powered by OTRS
"Testing": OTRS git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

foshito
OTRS newbie
Posts: 7
Joined: 18 Jan 2014, 16:20
OTRS Version?: 3.3.3
Real Name: Marco
Company: Gallo

Re: LimeSurveys (Not OTRS)

Post by foshito » 19 Apr 2016, 22:55

Friend,

I understand very clearly, the version of OTRS I use is 3.3.6. I do not understand that name should I put the .xml file ... Please help me ask. Not like putting the token in LimeSurvey OTRS.

I appreciate the attention to this requirement.

foshito
OTRS newbie
Posts: 7
Joined: 18 Jan 2014, 16:20
OTRS Version?: 3.3.3
Real Name: Marco
Company: Gallo

Re: LimeSurveys (Not OTRS)

Post by foshito » 20 Apr 2016, 19:29

Friends,

I'm from Ecuador, please your help with some pointers on configuring OTRS - limesurvey.

I have done the following:

Then add the following code /opt/otrs/Kernel/Config/Files/Ticket.XML

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="Ticket::EventModulePost###LimeSurvey" Required="0" Valid="1">
<Description Lang="en">Enable for token generation for LimeSurvey</Description>
<Description Lang="de"></Description>
<Group>Ticket</Group>
<SubGroup>Core::Ticket</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::Ticket::Event::LimeToken</Item>
<Item Key="Event">(TicketCreate|TicketQueueUpdate)</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>



Then add the following code /opt/otrs/Kernel/System/Ticket/Event/LimeToken.pm

package Kernel::System::Ticket::Event::LimeToken;

use strict;
use warnings;

use vars qw($VERSION);
$VERSION = qw($Revision: 1.12 $) [1];

sub new {
my ( $Type, %Param ) = @_;

# allocate new hash for object
my $Self = {};
bless( $Self, $Type );

# get needed objects
for (qw(ConfigObject TicketObject LogObject UserObject CustomerUserObject
SendmailObject EncodeObject MainObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}

# create Lime DB Object
$Self->{LimeObject} = Kernel::System::DB->new(
ConfigObject => $Self->{ConfigObject},
EncodeObject => $Self->{EncodeObject},
LogObject => $Self->{LogObject},
MainObject => $Self->{MainObject},
DatabaseDSN => 'DBI:Pg:database=limesurvey;host=localhost;',
DatabaseUser => 'xxxxx',
DatabasePw => 'xxxxx',
Type => 'postgresql',
);


return $Self;
}

sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(Data Event Config)) {
if ( !$Param{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_
!" );
return;
}
}
for (qw(TicketID)) {
if ( !$Param{Data}->{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_ in Data!" );
return;
}
}

if ( $Param{Event} eq 'TicketCreate' ) {
my %Ticket = $Self->{TicketObject}->TicketGet(
TicketID => $Param{Data}->{TicketID},
DynamicFields => 0,
);
if ( $Ticket{Queue} eq 'Main' ) {
$Self->{LimeObject}->Do(
SQL => "INSERT INTO lime_tokens_288673 (token) VALUES (?)",
Bind => [ \$Ticket{TicketNumber} ],
);

# do some stuff
$Self->{TicketObject}->HistoryAdd(
TicketID => $Param{Data}->{TicketID},
CreateUserID => $Param{UserID},
HistoryType => 'Misc',
Name => 'Updated Token!',
);
}
}
elsif ( $Param{Event} eq 'TicketQueueUpdate' ) {
my %Ticket = $Self->{TicketObject}->TicketGet(
TicketID => $Param{Data}->{TicketID},
DynamicFields => 0,
);
);
if ( $Ticket{Queue} eq 'Junk' ) {

# do some stuff
$Self->{LimeObject}->Do(
SQL => 'INSERT INTO lime_tokens_288673 (token) VALUES (?)',
Bind => [ \$Ticket{TicketNumber} ],
);


$Self->{TicketObject}->HistoryAdd(
TicketID => $Param{Data}->{TicketID},
CreateUserID => $Param{UserID},
HistoryType => 'Misc',
Name => 'Added a token for the survey'
);
}
}
return 1;
}

1;



Then enter the URL in OTRS

http://XXXXXXXX/limesurvey/index.php/su ... 77/lang/es

When you run the URL displays the following error:

We are sorry but you are not allowed to enter this survey.

This is a controlled survey. You need a valid token to participate.

For further information please contact Administrator (xxxxxxxxxxxxxx)

User avatar
crythias
Moderator
Posts: 9980
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LimeSurveys (Not OTRS)

Post by crythias » 19 May 2016, 16:26

You turned on tokens ... You don't (really) need to turn on tokens unless you think your end users are going to submit multiple survey responses because they like surveys.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
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

abderrahim
OTRS newbie
Posts: 1
Joined: 12 Mar 2018, 11:20
OTRS Version?: 5.0.26
Real Name: MEHDAOUI
Company: KLEE

Re: LimeSurveys (Not OTRS)

Post by abderrahim » 16 Mar 2018, 12:32

Hi,

I want to connect LimeSurvey to OTRS ticket.
So when I close a ticket, OTRS send an automatic mail to customer with URL of survey.
And I want that survey contain information about ticket (number of ticket, subject).

How I can use "RemoteControl 2 API" to connect my ticket OTRS with the survey?
(http://api.limesurvey.org/classes/remot ... andle.html)

If it's not possible, the method Cited above by crythias worck with the latest vesion of LimeSurvey and OTRS 5.0.26?

Thank you for your help,

jojo
Moderator
Posts: 14212
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: LimeSurveys (Not OTRS)

Post by jojo » 16 Mar 2018, 21:41

Connection via API should be possible with outgoing Webservices available in the OTRS Business Solution
"Production": OTRS Business Solution™ 6, STORM powered by OTRS
"Testing": OTRS git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

Post Reply