[Rt-commit] rt branch, 4.2/tsv-export-class, created. rt-4.2.6-38-g390b71b

Alex Vandiver alexmv at bestpractical.com
Fri Aug 15 14:01:07 EDT 2014


The branch, 4.2/tsv-export-class has been created
        at  390b71bec3430efc3cbe6c938d0b508c58544431 (commit)

- Log -----------------------------------------------------------------
commit 390b71bec3430efc3cbe6c938d0b508c58544431
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Aug 15 13:56:20 2014 -0400

    Make TSVExport work on non-Tickets collections
    
    a8232c75 attempted to refactor the existing /Search/Results.tsv into a
    generic /Elements/TSVExport which took arbitrary collection objects.
    However, it neglected to pass the class of the collection down through
    to the ColumnMap code, causing it to only work on Tickets, or things
    like CustomFields which are generally applicable across object classes.
    
    Intuit the class as necessary, and pass it down through to the ColumnMap
    code.

diff --git a/share/html/Elements/TSVExport b/share/html/Elements/TSVExport
index 2c6fa11..848bf5c 100644
--- a/share/html/Elements/TSVExport
+++ b/share/html/Elements/TSVExport
@@ -46,6 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%ARGS>
+$Class => undef
 $Collection
 $Format
 $PreserveNewLines => 0
@@ -55,6 +56,7 @@ my $no_html = HTML::Scrubber->new( deny => '*' );
 </%ONCE>
 <%INIT>
 require HTML::Entities;
+$Class ||= $Collection->ColumnMapClassName;
 
 $r->content_type('application/vnd.ms-excel');
 
@@ -76,7 +78,8 @@ my $col_entry = sub {
         map    => $m->comp(
             "/Elements/ColumnMap",
             Name  => $col->{attribute},
-            Attr  => 'value'
+            Attr  => 'value',
+            Class => $Class,
         ),
         should_loc => $should_loc->{$col->{attribute}},
     }

-----------------------------------------------------------------------


More information about the rt-commit mailing list