View | Details | Raw Unified | Return to bug 17385
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-1 / +1 lines)
Lines 97-103 CAN_user_serials_create_subscription ) %] Link Here
97
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
97
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
98
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
98
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
99
        [% FOREACH filesOption IN filesOptions %]
99
        [% FOREACH filesOption IN filesOptions %]
100
            <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format | uri %]&amp;op=exportxsl&amp;file=[% filesOption.value | uri %]&amp;bib=[% biblionumber | uri %]">[% filesOption.filename | html %]</a></li>
100
            <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format | uri %]&amp;op=exportxsl&amp;file=[% filesOption.value | uri %]&amp;bib=[% biblionumber | uri %]">XSL - [% filesOption.filename | html %]</a></li>
101
        [% END %]
101
        [% END %]
102
    </ul>
102
    </ul>
103
    </div>
103
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 321-327 OPAC: Link Here
321
                mods: MODS
321
                mods: MODS
322
                ris: RIS
322
                ris: RIS
323
                isbd: ISBD
323
                isbd: ISBD
324
                custom: Custom
324
                custom: XSL - Simple Export 
325
        -
325
        -
326
            - pref: OpacSeparateHoldings
326
            - pref: OpacSeparateHoldings
327
              choices:
327
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +1 lines)
Lines 781-787 Note that permanent location is a code, and location may be an authval. Link Here
781
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
781
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
782
        <option value="utf8">MARC (Unicode/UTF-8)</option>
782
        <option value="utf8">MARC (Unicode/UTF-8)</option>
783
        [% FOREACH filesOption IN filesOptions %]
783
        [% FOREACH filesOption IN filesOptions %]
784
            <option value="[% filesOption.value | html %]">[% filesOption.filename | html %]</option>
784
            <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option>
785
        [% END %]</select>
785
        [% END %]</select>
786
        <input type="submit" name="save" value="Download Record" /></td>
786
        <input type="submit" name="save" value="Download Record" /></td>
787
  </tr>
787
  </tr>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-1 / +1 lines)
Lines 80-86 Link Here
80
                                </li>
80
                                </li>
81
                                [% ELSE %]
81
                                [% ELSE %]
82
                                    [% FOREACH filesOption IN filesOptions %]
82
                                    [% FOREACH filesOption IN filesOptions %]
83
                                        <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | html %]&amp;op=exportxsl&amp;file=[% filesOption.value | html %]&amp;bib=[% biblionumber | html %]">[% filesOption.filename | html %]</a></li>
83
                                        <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | html %]&amp;op=exportxsl&amp;file=[% filesOption.value | html %]&amp;bib=[% biblionumber | html %]">XSL - [% filesOption.filename | html %]</a></li>
84
                                    [% END %]
84
                                    [% END %]
85
                                [% END %]
85
                                [% END %]
86
                            [% END %]
86
                            [% END %]
(-)a/opac/opac-downloadshelf.pl (-2 / +6 lines)
Lines 28-33 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
use C4::XSLT;
31
use Koha::CsvProfiles;
32
use Koha::CsvProfiles;
32
use Koha::RecordProcessor;
33
use Koha::RecordProcessor;
33
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
Lines 118-130 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
118
                    });
119
                    });
119
                    $extension = "txt";
120
                    $extension = "txt";
120
                    $type      = "text/plain";
121
                    $type      = "text/plain";
121
                }
122
                }elsif ($format =~ /^xsl\.(.*)$/){
123
                         $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
124
                    }
122
            }
125
            }
123
        }
126
        }
124
127
125
        # If it was a CSV export we change the format after the export so the file extension is fine
128
        # If it was a CSV export we change the format after the export so the file extension is fine
126
        $format = "csv" if ($format =~ m/^\d+$/);
129
        $format = "csv" if ($format =~ m/^\d+$/);
127
130
        $format = "html" if ($format =~ /^xsl\./);
128
        print $query->header(
131
        print $query->header(
129
                                   -type => ($type) ? $type : 'application/octet-stream',
132
                                   -type => ($type) ? $type : 'application/octet-stream',
130
            -'Content-Transfer-Encoding' => 'binary',
133
            -'Content-Transfer-Encoding' => 'binary',
Lines 140-145 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
140
        } else {
143
        } else {
141
            $template->param(fullpage => 1);
144
            $template->param(fullpage => 1);
142
        }
145
        }
146
        $template->param(xsl_exports => CustomXSLTExportList());
143
        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
147
        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
144
        $template->param( shelf => $shelf );
148
        $template->param( shelf => $shelf );
145
        output_html_with_http_headers $query, $cookie, $template->output;
149
        output_html_with_http_headers $query, $cookie, $template->output;
(-)a/t/db_dependent/XSLT.t (-15 / +31 lines)
Lines 1-28 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
use Test::More tests => 2;
2
use Test::More tests => 4;
3
3
4
use t::lib::Mocks;
4
use t::lib::Mocks;
5
use C4::XSLT;
5
use C4::XSLT;
6
use Koha::Caches;
7
use Koha::Database;
6
use Koha::Database;
7
use Test::Warn;
8
use t::lib::TestBuilder;
9
use Koha::ItemTypes;
10
use Koha::Caches;
8
11
9
our $schema = Koha::Database->new->schema;
12
our $schema = Koha::Database->new->schema;
10
our $cache = Koha::Caches->get_instance;
13
our $cache = Koha::Caches->get_instance;
11
14
15
BEGIN {
16
    use_ok('C4::XSLT');
17
}
18
my $builder = t::lib::TestBuilder->new;
12
# Here we go
19
# Here we go
13
$schema->storage->txn_begin;
20
$schema->storage->txn_begin;
14
subtest  'CustomXSLTExportList: Caching' => sub {
15
    plan tests => 1;
16
    t::lib::Mocks::mock_preference('OpacExportOptions', 'custom');
17
    $cache->clear_from_cache('CustomXSLTExportListOPAC');
18
    my $list = C4::XSLT::CustomXSLTExportList(1);
19
    push @$list, { nonsense => 1 };
20
    $cache->set_in_cache( 'CustomXSLTExportListOPAC', $list );
21
    my $n = @$list;
22
    $list = C4::XSLT::CustomXSLTExportList(1);
23
    is( @$list, $n, 'This list comes from the cache and that is fine' );
24
    $cache->clear_from_cache('CustomXSLTExportListOPAC');
25
};
26
subtest 'buildKohaItemsNamespace status tests' => sub {
21
subtest 'buildKohaItemsNamespace status tests' => sub {
27
    plan tests => 13;
22
    plan tests => 13;
28
    my $item  = $builder->build_sample_item({});
23
    my $item  = $builder->build_sample_item({});
Lines 99-102 subtest 'buildKohaItemsNamespace status tests' => sub { Link Here
99
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
94
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
100
    like($xml,qr{<status>Pending hold</status>},"Pending status takes precedence over all");
95
    like($xml,qr{<status>Pending hold</status>},"Pending status takes precedence over all");
101
};
96
};
97
subtest  'CustomXSLTExportList: Caching' => sub {
98
    plan tests => 1;
99
    t::lib::Mocks::mock_preference('OpacExportOptions', 'custom');
100
    $cache->clear_from_cache('CustomXSLTExportListOPAC');
101
    my $list = C4::XSLT::CustomXSLTExportList(1);
102
    push @$list, { nonsense => 1 };
103
    $cache->set_in_cache('CustomXSLTExportListOPAC', $list );
104
    my $n = @$list;
105
    $list = C4::XSLT::CustomXSLTExportList(1);
106
    is( @$list, $n, 'This list comes from the cache and that is fine' );
107
    $cache->clear_from_cache('CustomXSLTExportListOPAC');
108
};
109
subtest 'CustomXSLTExportList: Check export options' => sub {
110
    plan tests => 2;
111
    t::lib::Mocks::mock_preference('OpacExportOptions', 'custom');
112
    my $list = C4::XSLT::CustomXSLTExportList(1);
113
    is( $list>0, 1, 'We expect at least one result: simple export' );
114
    $cache->clear_from_cache('CustomXSLTExportListOPAC');
115
    t::lib::Mocks::mock_preference('OpacExportOptions', 'dc');
116
    $list = C4::XSLT::CustomXSLTExportList(1);
117
    is( @$list, 0, 'We expect an empty list now' );
118
};
102
$schema->storage->txn_rollback;
119
$schema->storage->txn_rollback;
103
- 

Return to bug 17385