Hello all,

i'd like to add a couple of columns to the ticket overview table in otrs 3.1.3 and I think I am halfway done. Two problems are left, though, and I would gladly accept any help with these.

What I've done so far: I edited the CustomerTicketOverview.tdl template and added three fields ("Priority, "Reporter" and "Created") to the html table as follows:

Header rows:

<th class="Priority $LQData{"PrioritySort"}">
    <a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=$Env{"Subaction"};SortBy=Priority;OrderBy=$LQData{"OrderBy"} Filter=$LQData{"Filter"}">
      $Text{"Priority"}
    </a>
</th>

<th class="Reporter $LQData{"ReporterSort"}">
     <a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=$Env{"Subaction"};SortBy=Reporter;OrderBy=$LQData{"OrderBy"};Filter=$LQData{"Filter"}">
      $Text{"Reporter"}
     </a>
</th>

<th class="Created $LQData{"CreatedSort"}">
     <a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=$Env{"Subaction"};SortBy=Created;OrderBy=$LQData{"OrderBy"};Filter=$LQData{"Filter"}">
     $Text{"Created"}
     </a>
</th>



and data rows:

<td class="Priority" title="$QData{"Priority"}"}">$QData{"Priority"}</td>
<td class="CustomerUserID" title="$QData{"CustomerUserID"}">$QData{"CustomerUserID"}</td>
<td class="Created" title="$QData{"Created"}">$QData{"Created"}</td>

Bingo! These changes make the needed columns appear like expected and they contain valid data. Two problems remain:

1) I can sort the CustomerTicketOverview table by "priority" but not by "reporter" or "created". If I click on the column header of the latter two - to trigger the sorting event - the customer welcome page is being displayed instead of the ticket overview table.

The error logs seem to indicate that "sortBy=Reporter" is invalid:

[Thu Aug 16 22:12:18 2012] -e: Use of uninitialized value in concatenation (.) or string at /opt/otrs//Kernel/System/Log.pm line 161.
ERROR: OTRS-CGI-10 Perl: 5.10.0 OS: linux Time: Thu Aug 16 22:12:18 2012

 Message: Need valid SortBy (Reporter)!

 Traceback (21908):
   Module: Kernel::System::TicketSearch::TicketSearch (v1.12) Line: 411
   Module: Kernel::Modules::CustomerTicketOverview::Run (v1.4) Line: 193
   Module: Kernel::System::Web::InterfaceCustomer::Run (v1.63) Line: 998
   Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_customer_2epl::handler (unknown version) Line: 46
   Module: (eval) (v1.44) Line: 204
   Module: ModPerl::RegistryCooker::run (v1.44) Line: 204
   Module: ModPerl::RegistryCooker::default_handler (v1.44) Line: 170
   Module: ModPerl::Registry::handler (v1.99) Line: 31

Where are those declared?

2) The headers of the new columns lack the sortOrder image that identifies the sorting column by a highlighted background and the sorting order by an arrow. From wild grepping of the code (i am not a perl hacker), i concluded that the necessary CSS classes for setting the background image for the column header are being generated on the fly by CustomerTicketOverview.pm. Looking at that code, i tried to add the seemingly necessary variables by following the examples of the preexisting ones. In this case, i added "ownerSort":

[...]
    my $OrderBy = 'Down';
        if ( $Self->{OrderBy} eq 'Down' ) {
            $OrderBy = 'Up';
        }
        my $Sort       = '';
        my $StateSort  = '';
        my $TicketSort = '';
        my $TitleSort  = '';
        my $AgeSort    = '';
        my $OwnerSort  = '';

        # this sets the opposit to the $OrderBy
        if ( $OrderBy eq 'Down' ) {
            $Sort = 'SortAscending';
        }
        if ( $OrderBy eq 'Up' ) {
            $Sort = 'SortDescending';
        }

        # perl is missing 'switch' :-| have to learn to work effectivly without it
        if ( $Self->{SortBy} eq 'State' ) {
            $StateSort = $Sort;
        }
        if ( $Self->{SortBy} eq 'Ticket' ) {
            $TicketSort = $Sort;
        }
        if ( $Self->{SortBy} eq 'Title' ) {
            $TitleSort = $Sort;
        }
        if ( $Self->{SortBy} eq 'Age' ) {
            $AgeSort = $Sort;
        }
        if ( $Self->{SortBy} eq 'Owner' ) {
            $OwnerSort = $Sort;
        }
        $Self->{LayoutObject}->Block(
            Name => 'Filled',
            Data => {
                %Param,
                %PNav,
                OrderBy    => $OrderBy,
                StateSort  => $StateSort,
                TicketSort => $TicketSort,
                TitleSort  => $TitleSort,
                AgeSort    => $AgeSort,
                OwnerSort  => $OwnerSort,
                Filter     => $Self->{Filter},
            },
        );

[...]


However, this change makes loading the CustomerTicketOverview.pm module fail with:

"Global symbol "%PNav" requires explicit package name at /opt/otrs//Kernel/Modules/CustomerTicketOverview.pm line 297. Compilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 181."

Questions are: 

1. What is wrong with the links in the "reporter" and "created" columns header  that they display the welcome page instead of the table and is there a way to fix that?
2. How can i make the correct icons appear in the new columns header fields so that the user has an indication of what es being sorted and how?

Any help is being greatly appreciated!

Cheers,

Rouven

    
    
-- 
Blinkenlichten Open Source Solutions
Maass  Sacha GbR | Weigandufer 45 | 12059 Berlin
tel: +493013896247 | fax: +493013896249 | mob: +491744220127
Web: http://www.blinkenlichten.de/ G+: http://gplus.to/blinkenlichten
Blinkenlichten Zarafa Hosted Tweets: http://twitter.com/zarafamail/