output filters

Moderator: crythias

Locked
allo9615
Znuny newbie
Posts: 14
Joined: 13 Mar 2015, 13:59
Znuny Version: 3.2.9
Real Name: Alejandra Lopez
Company: TU Ilmenau

output filters

Post by allo9615 »

Hi,
in older OTRS Version (up to Version 4) i used many output filter to change the output of some .dtl without changing the .dtl.
Couls somebody tell me how I have to do to make my outputfilters work in Version 4?
This doesn't work in Version 4 the same way. Hier ist an exaple:

Code: Select all

package Kernel::Output::HTML::OutputFilterAgentTicketZoom;
use strict;
use warnings;
sub new {
    my ( $Type, %Param ) = @_;
    # allocate new hash for object
    my $Self = \%Param;
    bless( $Self, $Type );
    return $Self;
}
sub Run {
    my ( $Self, %Param ) = @_;
    # check needed objects (needed to be done here because of OTRS 3.0 + Survey package ->
    # public.pl?Action=PublicSurvey -> Got no DBObject! at)
    for (qw(DBObject EncodeObject TimeObject ConfigObject LogObject MainObject LayoutObject)) {
        return if !$Self->{$_};
    }
    # check needed stuff
    if ( !defined $Param{Data} ) {
        $Self->{LogObject}->Log( Priority => 'error', Message => 'Need Data!' );
        $Self->{LayoutObject}->FatalDie();
    }
    # return if it's not ticket zoom
    return if $Param{TemplateFile} !~ /^(AgentTicketZoom)$/;
    # remove not needed fields selection
    ${ $Param{Data} } =~ s{
        (<label>\$Text\{"CustomerID.+?<div\sclass="Clear"></div>)
    }
    {}sxm;
    return $Param{Data};
}
1;
Thank you
Alejandra Lopez
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: output filters

Post by reneeb »

Instead of

Code: Select all

<label>\$Text\{"CustomerID.+?<div\sclass="Clear"></div>
you should try

Code: Select all

<label>[\%\s+Translate("CustomerID.+?<div\sclass="Clear"></div>
(untested)
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
allo9615
Znuny newbie
Posts: 14
Joined: 13 Mar 2015, 13:59
Znuny Version: 3.2.9
Real Name: Alejandra Lopez
Company: TU Ilmenau

Re: output filters

Post by allo9615 »

Thank you for the answer, i tried it before but it doesn't work that way and that is my problem. Do you have another idea? Have you the opportunity to try this output filter?
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: output filters

Post by reneeb »

Sorry, "[" and "(" should be escaped as well...
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
allo9615
Znuny newbie
Posts: 14
Joined: 13 Mar 2015, 13:59
Znuny Version: 3.2.9
Real Name: Alejandra Lopez
Company: TU Ilmenau

Re: output filters

Post by allo9615 »

Hi,
i tried to hide many other elements and it worked. As long as you worke with [% Translate(

Code: Select all

(<label>\[\% \s Translate\("CustomerID" .+? <div \s class="Clear"></div>)
it ignores it and doesn't happend anny thing.
do you have any other ideas?
Locked