X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FCollectionList;h=cd86235ff6ba18e5a75860a34042c82064be70b4;hp=522db581150e9a7d99548ea451cf16982bfb24a6;hb=01721976fa3324f41a3093cda68bc38a7eec5ff5;hpb=01352af8e44b7eb70b2b587ca43ab7ca946f038d diff --git a/rt/share/html/Elements/CollectionList b/rt/share/html/Elements/CollectionList index 522db5811..cd86235ff 100644 --- a/rt/share/html/Elements/CollectionList +++ b/rt/share/html/Elements/CollectionList @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -51,7 +51,7 @@ if (!$Collection && $Class eq 'RT::Tickets') { $Collection->FromSQL($Query); } -my $TotalFound = $Collection->CountAll(); +$TotalFound = $Collection->CountAll() unless defined $TotalFound; return '' if !$TotalFound && !$ShowEmpty; if ( $Rows ) { @@ -71,6 +71,7 @@ if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) { @OrderBy = split /\|/, $OrderBy[0]; @Order = split /\|/,$Order[0]; } + @OrderBy = grep length, @OrderBy; $Collection->OrderByCols( map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } ( 0 .. $#OrderBy ) @@ -105,29 +106,31 @@ foreach my $col (@Format) { } } -$Class ||= ref $Collection; -$Class =~ s/s$//; -$Class =~ s/:/_/g; +$Class ||= $Collection->ColumnMapClassName; +if ($Class =~ /::/) { # older passed in value + $Class =~ s/s$//; + $Class =~ s/:/_/g; +} -$m->out(''); +$m->out('
'); if ( $ShowHeader ) { - $m->comp('/Elements/CollectionAsTable/Header', - %ARGS, - Class => $Class, - Format => \@Format, - FormatString => $Format, - Order => \@Order, - OrderBy => \@OrderBy, - Rows => $Rows, - Page => $Page, - AllowSorting => $AllowSorting, - BaseURL => $BaseURL, - GenericQueryArgs => $GenericQueryArgs, - maxitems => $maxitems, - ); + $m->comp('/Elements/CollectionAsTable/Header', + %ARGS, + Class => $Class, + Format => \@Format, + FormatString => $Format, + Order => \@Order, + OrderBy => \@OrderBy, + Rows => $Rows, + Page => $Page, + AllowSorting => $AllowSorting, + BaseURL => $BaseURL, + GenericQueryArgs => $GenericQueryArgs, + maxitems => $maxitems, + PassArguments => \@PassArguments, + ); } my ($i, $column_map) = (0, {}); @@ -184,6 +187,7 @@ if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) { <%ARGS> $Class => '' $Collection => undef +$TotalFound => undef $Format => undef $DisplayFormat => undef @Order => ()