Change customer preferences depending of url get vars

English! place to talk about development, programming and coding
Post Reply
daniela1611
Znuny newbie
Posts: 4
Joined: 10 May 2012, 03:26
Znuny Version: 3.2.6
Real Name: Daniela Gutierrez

Change customer preferences depending of url get vars

Post by daniela1611 »

Hello everyone!

I need to change some customer preferences (language, theme...) depending on variables that comes in the url (customer.pl?lan=en...) one of the problems that I have its that I'm using shibboleth authentication so in my Config.pm I have something like this:

Self->{'CustomerPanelLoginURL'} = 'https://my.domain/Shibboleth.sso/Login? ... omer.pl%3F';

so in my browser whenever I go to: "http://my.domain/otrs/customer.pl?lan=en" after the authentication and the redirection to the customer interface it just loose the lan=en variable. I have this code on my authentication module

Code: Select all

    my $QueryStringLang = $ENV{QUERY_STRING} || '';
    my @values = split(/;/,$QueryStringLang);
    my $lan;
    foreach my $i (@values) {
        my($fieldname, $data) = split(/=/, $i);
        $fieldname = $data;
        }
where could I get the variable and maybe save it into cookie var o how could I just read that variable ?

I'm lost in this

Thanks in advance for your help
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Change customer preferences depending of url get vars

Post by reneeb »

To get a parameter, you should use the "ParamObject". For methods see Kernel::System::Web::Request (you can use online API documentation at dev.otrs.org).

You should save the preferences the same way the settings are saved in Standard OTRS. Please see https://github.com/OTRS/otrs/blob/rel-3 ... erences.pm
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
daniela1611
Znuny newbie
Posts: 4
Joined: 10 May 2012, 03:26
Znuny Version: 3.2.6
Real Name: Daniela Gutierrez

Re: Change customer preferences depending of url get vars

Post by daniela1611 »

Thanks for your reply, yes I read the doc and now I'm trying to access the variable like this :

$lan= $Self->{ParamObject}->GetParam( Param => 'lan' )'';
it doesn't work still

I'm doing this on my auth module because there I can update the customer preferences etc (I know it's not supposed to be done like this but its a requirement that I have to met)

Thanks again
Post Reply