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

(-)a/C4/XSLT.pm (-1 lines)
Lines 238-244 sub XSLTParse4Display { Link Here
238
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
238
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
239
239
240
    my $biblio;
240
    my $biblio;
241
    my $variables ||= {};
242
241
243
    if (C4::Context->preference('OPACShowOpenURL')) {
242
    if (C4::Context->preference('OPACShowOpenURL')) {
244
        my @biblio_itemtypes;
243
        my @biblio_itemtypes;
(-)a/basket/downloadcart.pl (-3 / +5 lines)
Lines 66-71 if ($bib_list && $format) { Link Here
66
66
67
            my $biblio = Koha::Biblios->find($biblionumber);
67
            my $biblio = Koha::Biblios->find($biblionumber);
68
            my $record = $biblio->metadata->record({ embed_items => 1 });
68
            my $record = $biblio->metadata->record({ embed_items => 1 });
69
            my $xslFile = $query->param("file");
69
            next unless $record;
70
            next unless $record;
70
71
71
            if ($format eq 'iso2709') {
72
            if ($format eq 'iso2709') {
Lines 83-92 if ($bib_list && $format) { Link Here
83
                $output .= XSLTParse4Display(
84
                $output .= XSLTParse4Display(
84
                    {
85
                    {
85
                      biblionumber => $biblio,
86
                      biblionumber => $biblio,
86
                      record => $record,
87
                      record       => $record,
87
                      xsl_syspref => "XSLTCustomExport",
88
                      xsl_syspref  => "XSLTCustomExport",
88
                      fix_amps  => 1,
89
                      fix_amps     => 1,
89
                      hidden_items => undef,
90
                      hidden_items => undef,
91
                      xslfilename  => $xslFile,
90
                    }
92
                    }
91
                );
93
                );
92
            }
94
            }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (-1 / +1 lines)
Lines 32-38 Link Here
32
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=[% csv_profile.export_format_id | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
32
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=[% csv_profile.export_format_id | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
33
                    [% END %]
33
                    [% END %]
34
                    [% FOREACH xsl_export IN xsl_exports %]
34
                    [% FOREACH xsl_export IN xsl_exports %]
35
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=xsl.[% xsl_export.value | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
35
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=xsl.[% xsl_export.value | uri %]&amp;file=[% xsl_export.value | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
36
                    [% END %]
36
                    [% END %]
37
                </ul>
37
                </ul>
38
        </div>
38
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (-1 / +1 lines)
Lines 59-65 Link Here
59
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=[% csv_profile.export_format_id | uri %]&amp;bib_list=[% bib_list | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
59
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=[% csv_profile.export_format_id | uri %]&amp;bib_list=[% bib_list | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
60
                            [% END %]
60
                            [% END %]
61
                            [% FOREACH xsl_export IN xsl_exports %]
61
                            [% FOREACH xsl_export IN xsl_exports %]
62
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=xsl.[% xsl_export.value | uri %]&amp;bib_list=[% bib_list | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
62
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=xsl.[% xsl_export.value | uri %]&amp;file=[% xsl_export.value | uri %]&amp;bib_list=[% bib_list | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
63
                            [% END %]
63
                            [% END %]
64
                            </ul>
64
                            </ul>
65
                        </div>
65
                        </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-4 / +5 lines)
Lines 83-94 Link Here
83
                                </a>
83
                                </a>
84
                            [% ELSE %]
84
                            [% ELSE %]
85
                                [% FOREACH filesOption IN filesOptions %]
85
                                [% FOREACH filesOption IN filesOptions %]
86
                                    <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>
86
                                    <a 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>
87
                                [% END %]
87
                                [% END %]
88
                            [% END %]
88
                            [% END %]
89
                        </ul>
89
                        [% END %]
90
                </div>
90
                    </div> <!-- /.dropdown-menu -->
91
            </div>
91
                </div> <!-- /.dropdown -->
92
            </div> <!-- /#export -->
92
        </li>
93
        </li>
93
    [% END %]
94
    [% END %]
94
95
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt (+8 lines)
Lines 28-33 Link Here
28
                                    <a class="btn btn-link btn-sm send" href="opac-basket.pl"><i class="fa fa-fw fa-envelope" aria-hidden="true"></i> Send</a>
28
                                    <a class="btn btn-link btn-sm send" href="opac-basket.pl"><i class="fa fa-fw fa-envelope" aria-hidden="true"></i> Send</a>
29
                                [% END %]
29
                                [% END %]
30
30
31
                                [% SET export_options = Koha.Preference('OpacExportOptions').split(',') %]
31
                                <div id="download-cart" class="btn-group dropdown">
32
                                <div id="download-cart" class="btn-group dropdown">
32
                                    <a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" role="button" href="#"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
33
                                    <a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" role="button" href="#"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
33
                                    <div class="dropdown-menu" role="menu" aria-labelledby="format">
34
                                    <div class="dropdown-menu" role="menu" aria-labelledby="format">
Lines 38-43 Link Here
38
                                        [% FOREACH csv_profile IN csv_profiles %]
39
                                        [% FOREACH csv_profile IN csv_profiles %]
39
                                            <a role="menuitem" class="dropdown-item download-cart" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
40
                                            <a role="menuitem" class="dropdown-item download-cart" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
40
                                        [% END %]
41
                                        [% END %]
42
                                        [% FOREACH option IN export_options %]
43
                                            [% IF option == 'custom' %]
44
                                                [% FOREACH xsl_export IN xsl_exports %]
45
                                                    <a role="menuitem" class="dropdown-item" href="/cgi-bin/koha/opac-downloadcart.pl?format=xsl.[% xsl_export.value | uri %]&amp;file=[% xsl_export.value | uri %]&amp;bib_list=[% bib_list | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
46
                                                [% END %]
47
                                            [% END %]
48
                                        [% END %]
41
                                    </div>
49
                                    </div>
42
                                </div>
50
                                </div>
43
51
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (+8 lines)
Lines 222-227 Link Here
222
                                    <div class="list-actions">
222
                                    <div class="list-actions">
223
                                        <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> <span class="sep">|</span>
223
                                        <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> <span class="sep">|</span>
224
224
225
                                        [% SET export_options = Koha.Preference('OpacExportOptions').split(',') %]
225
                                        <div id="download-list" class="btn-group dropdown">
226
                                        <div id="download-list" class="btn-group dropdown">
226
                                            <a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
227
                                            <a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
227
                                            <div class="dropdown-menu pull-left" role="menu" aria-labelledby="format">
228
                                            <div class="dropdown-menu pull-left" role="menu" aria-labelledby="format">
Lines 232-237 Link Here
232
                                                [% FOREACH csv_profile IN csv_profiles %]
233
                                                [% FOREACH csv_profile IN csv_profiles %]
233
                                                    <a role="menuitem" class="dropdown-item download-list" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
234
                                                    <a role="menuitem" class="dropdown-item download-list" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
234
                                                [% END %]
235
                                                [% END %]
236
                                                [% FOREACH option IN export_options %]
237
                                                    [% IF option == 'custom' %]
238
                                                        [% FOREACH xsl_export IN xsl_exports %]
239
                                                            <a role="menuitem" class="dropdown-item" href="/cgi-bin/koha/opac-downloadshelf.pl?format=xsl.[% xsl_export.value | uri %]&amp;file=[% xsl_export.value | uri %]&amp;shelfnumber=[% shelf.shelfnumber | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
240
                                                        [% END %]
241
                                                    [% END %]
242
                                                [% END %]
235
                                            </div>
243
                                            </div>
236
                                        </div>
244
                                        </div>
237
245
(-)a/opac/opac-basket.pl (+2 lines)
Lines 28-33 use C4::Biblio qw( Link Here
28
);
28
);
29
use C4::Auth qw( get_template_and_user );
29
use C4::Auth qw( get_template_and_user );
30
use C4::Output qw( output_html_with_http_headers );
30
use C4::Output qw( output_html_with_http_headers );
31
use C4::XSLT qw( CustomXSLTExportList );
31
use Koha::RecordProcessor;
32
use Koha::RecordProcessor;
32
use Koha::CsvProfiles;
33
use Koha::CsvProfiles;
33
use Koha::AuthorisedValues;
34
use Koha::AuthorisedValues;
Lines 154-159 $template->param( Link Here
154
        { type => 'marc', used_for => 'export_records', staff_only => 0 } ),
155
        { type => 'marc', used_for => 'export_records', staff_only => 0 } ),
155
    bib_list => $bib_list,
156
    bib_list => $bib_list,
156
    BIBLIO_RESULTS => $resultsarray,
157
    BIBLIO_RESULTS => $resultsarray,
158
    xsl_exports => CustomXSLTExportList(),
157
);
159
);
158
160
159
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
161
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
(-)a/opac/opac-downloadcart.pl (-2 / +5 lines)
Lines 28-34 use C4::Output qw( output_html_with_http_headers ); Link Here
28
use C4::Record;
28
use C4::Record;
29
use C4::Ris qw( marc2ris );
29
use C4::Ris qw( marc2ris );
30
use Koha::Biblios;
30
use Koha::Biblios;
31
use C4::XSLT;
31
use C4::XSLT qw( XSLTParse4Display );
32
32
use Koha::CsvProfiles;
33
use Koha::CsvProfiles;
33
use Koha::RecordProcessor;
34
use Koha::RecordProcessor;
34
35
Lines 85-90 if ($bib_list && $format) { Link Here
85
                    patron      => $patron,
86
                    patron      => $patron,
86
                }
87
                }
87
            );
88
            );
89
            my $xslFile = $query->param("file");
88
            my $framework = &GetFrameworkCode( $biblio );
90
            my $framework = &GetFrameworkCode( $biblio );
89
            $record_processor->options({
91
            $record_processor->options({
90
                interface => 'opac',
92
                interface => 'opac',
Lines 116-128 if ($bib_list && $format) { Link Here
116
                $type      = "text/plain";
118
                $type      = "text/plain";
117
            }
119
            }
118
            elsif ($format =~ /^xsl\.(.*)$/) {
120
            elsif ($format =~ /^xsl\.(.*)$/) {
119
               $output .= XSLTParse4Display(
121
                $output .= XSLTParse4Display(
120
                   {
122
                   {
121
                     biblionumber   => $biblio,
123
                     biblionumber   => $biblio,
122
                     record         => $record,
124
                     record         => $record,
123
                     xsl_syspref    => "OPACXSLTCustomExport",
125
                     xsl_syspref    => "OPACXSLTCustomExport",
124
                     fix_amps       => 1,
126
                     fix_amps       => 1,
125
                     hidden_items => undef,
127
                     hidden_items => undef,
128
                     xslfilename  => $xslFile,
126
                   }
129
                   }
127
               );
130
               );
128
            }
131
            }
(-)a/opac/opac-downloadshelf.pl (-2 / +5 lines)
Lines 27-33 use C4::Output qw( output_html_with_http_headers ); Link Here
27
use C4::Record;
27
use C4::Record;
28
use C4::Ris qw( marc2ris );
28
use C4::Ris qw( marc2ris );
29
use Koha::Biblios;
29
use Koha::Biblios;
30
use C4::XSLT;
30
use C4::XSLT qw( XSLTParse4Display );
31
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 91-103 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
91
                my $biblionumber = $content->biblionumber;
92
                my $biblionumber = $content->biblionumber;
92
93
93
                my $biblio = Koha::Biblios->find($biblionumber);
94
                my $biblio = Koha::Biblios->find($biblionumber);
94
                my $record = $biblio->metadata->record->(
95
                my $record = $biblio->metadata->record(
95
                    {
96
                    {
96
                        embed_items => 1,
97
                        embed_items => 1,
97
                        opac        => 1,
98
                        opac        => 1,
98
                        patron      => $patron,
99
                        patron      => $patron,
99
                    }
100
                    }
100
                );
101
                );
102
                my $xslFile = $query->param("file");
101
                my $framework = $biblio->frameworkcode;
103
                my $framework = $biblio->frameworkcode;
102
                $record_processor->options({
104
                $record_processor->options({
103
                    interface => 'opac',
105
                    interface => 'opac',
Lines 131-136 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
131
                          xsl_syspref  => "XSLTCustomExport",
133
                          xsl_syspref  => "XSLTCustomExport",
132
                          fix_amps  => 1,
134
                          fix_amps  => 1,
133
                          hidden_items => undef,
135
                          hidden_items => undef,
136
                          xslfilename  => $xslFile,
134
                        }
137
                        }
135
                    );
138
                    );
136
                }
139
                }
(-)a/opac/opac-shelves.pl (-1 / +2 lines)
Lines 32-38 use C4::Koha qw( Link Here
32
use C4::Members;
32
use C4::Members;
33
use C4::Output qw( pagination_bar output_with_http_headers );
33
use C4::Output qw( pagination_bar output_with_http_headers );
34
use C4::Tags qw( get_tags );
34
use C4::Tags qw( get_tags );
35
use C4::XSLT qw( XSLTParse4Display );
35
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
36
36
37
use Koha::Biblios;
37
use Koha::Biblios;
38
use Koha::Biblioitems;
38
use Koha::Biblioitems;
Lines 491-496 $template->param( Link Here
491
    print    => scalar $query->param('print') || 0,
491
    print    => scalar $query->param('print') || 0,
492
    listsview => 1,
492
    listsview => 1,
493
    staffuser => $staffuser,
493
    staffuser => $staffuser,
494
    xsl_exports => CustomXSLTExportList()
494
);
495
);
495
496
496
my $content_type = $query->param('rss')? 'rss' : 'html';
497
my $content_type = $query->param('rss')? 'rss' : 'html';
(-)a/t/XSLT.t (-4 lines)
Lines 75-81 is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell ba Link Here
75
75
76
my $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>};
76
my $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>};
77
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs();
77
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs();
78
<<<<<<< HEAD
79
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value');
78
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value');
80
79
81
t::lib::Mocks::mock_config('opachtdocs', "$dir");
80
t::lib::Mocks::mock_config('opachtdocs', "$dir");
Lines 109-114 ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs"); Link Here
109
ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node");
108
ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node");
110
ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified");
109
ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified");
111
110
112
=======
113
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0');
114
>>>>>>> Bug 17385: Add custom export XSLT
(-)a/virtualshelves/downloadshelf.pl (-1 / +2 lines)
Lines 71-76 if ($shelfid && $format) { Link Here
71
                    my $biblionumber = $content->biblionumber;
71
                    my $biblionumber = $content->biblionumber;
72
                    my $biblio = Koha::Biblios->find($biblionumber);
72
                    my $biblio = Koha::Biblios->find($biblionumber);
73
                    my $record = $biblio->metadata->record({ embed_items => 1 });
73
                    my $record = $biblio->metadata->record({ embed_items => 1 });
74
                    my $xslFile = $query->param("file");
74
                    if ($format eq 'iso2709') {
75
                    if ($format eq 'iso2709') {
75
                        $output .= $record->as_usmarc();
76
                        $output .= $record->as_usmarc();
76
                    }
77
                    }
Lines 88-93 if ($shelfid && $format) { Link Here
88
                            xsl_syspref  => 'XSLTCustomExport',
89
                            xsl_syspref  => 'XSLTCustomExport',
89
                            fix_amps     => 1,
90
                            fix_amps     => 1,
90
                            hidden_items => undef,
91
                            hidden_items => undef,
92
                            xslfilename  => $xslFile,
91
                        }
93
                        }
92
                      );
94
                      );
93
                    }
95
                    }
94
- 

Return to bug 17385