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

(-)a/C4/XSLT.pm (-16 / +23 lines)
Lines 37-43 use XML::LibXML; Link Here
37
use Encode;
37
use Encode;
38
use vars qw(@ISA @EXPORT);
38
use vars qw(@ISA @EXPORT);
39
39
40
41
my $engine;    #XSLT Handler object
40
my $engine;    #XSLT Handler object
42
41
43
our ( @ISA, @EXPORT_OK );
42
our ( @ISA, @EXPORT_OK );
Lines 132-138 sub get_xslt_sysprefs { Link Here
132
131
133
=head2 get_xsl_filename
132
=head2 get_xsl_filename
134
133
135
Missing POD for get_xsl_filename.
134
    return xsl filenames in CustomXSLTExportPath or in /koha-tmpl/intranet-tmpl/prog/en/xslt/biblioexport/
136
135
137
=cut
136
=cut
138
137
Lines 141-161 sub get_xsl_filename { Link Here
141
140
142
    my $lang = C4::Languages::getlanguage();
141
    my $lang = C4::Languages::getlanguage();
143
142
144
    my $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
143
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
144
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
145
145
146
    if ($xslsyspref eq "XSLTCustomExport") {
146
    if ($xslsyspref eq "XSLTCustomExport") {
147
        my $dir;
147
        my $dir;
148
        $dir = C4::Context->config('intrahtdocs') .
148
        $dir = $customXSLTExportPath
149
            '/' . C4::Context->preference("template") .
149
            ? $customXSLTExportPath
150
            '/' . $lang .
150
            : C4::Context->config('intrahtdocs') . '/'
151
            '/xslt/biblioexport';
151
            . C4::Context->preference("template") . '/'
152
            . $lang
153
            . '/xslt/biblioexport';
152
        $xslfilename = $dir . "/" . $xslfilename;
154
        $xslfilename = $dir . "/" . $xslfilename;
153
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
155
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
154
        my $dir;
156
        my $dir;
155
        $dir = C4::Context->config('opachtdocs') .
157
        $dir = $customXSLTExportPath
156
            '/' . C4::Context->preference("opacthemes") .
158
            ? $customXSLTExportPath
157
            '/' . $lang .
159
            : C4::Context->config('opachtdocs') . '/'
158
            '/xslt/biblioexport';
160
            . C4::Context->preference("opacthemes") . '/'
161
            . $lang
162
            . '/xslt/biblioexport';
159
        $xslfilename = $dir . "/" . $xslfilename;
163
        $xslfilename = $dir . "/" . $xslfilename;
160
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
164
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
161
165
Lines 216-222 sub XSLTParse4Display { Link Here
216
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
220
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
217
        if not defined $params->{xsl_syspref};
221
        if not defined $params->{xsl_syspref};
218
222
219
    my $xslfilename = get_xsl_filename($xslsyspref, $xslfilename);
223
    $xslfilename = get_xsl_filename($xslsyspref, $xslfilename);
220
224
221
    my $frameworkcode    = GetFrameworkCode($biblionumber) || '';
225
    my $frameworkcode    = GetFrameworkCode($biblionumber) || '';
222
    my $record_processor = Koha::RecordProcessor->new(
226
    my $record_processor = Koha::RecordProcessor->new(
Lines 442-447 sub CustomXSLTExportList { Link Here
442
    my $opac = shift; # opac (1) vs intranet (0)
446
    my $opac = shift; # opac (1) vs intranet (0)
443
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
447
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
444
448
449
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
445
    # Check the cache first
450
    # Check the cache first
446
    my $cache = Koha::Caches->get_instance;
451
    my $cache = Koha::Caches->get_instance;
447
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
452
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
Lines 450-459 sub CustomXSLTExportList { Link Here
450
455
451
    my @tabFiles;
456
    my @tabFiles;
452
457
453
    my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') .
458
    my $dir = $customXSLTExportPath
454
                      '/' . C4::Context->preference( $opac ? "opacthemes" : "template") .
459
        ? $customXSLTExportPath
455
                      '/' . C4::Languages::getlanguage() .
460
        : C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . '/'
456
                      '/xslt/biblioexport';
461
        . C4::Context->preference( $opac ? "opacthemes" : "template") . '/'
462
        . C4::Languages::getlanguage()
463
        . '/xslt/biblioexport';
457
    my @files = glob qq("$dir/*.xsl");
464
    my @files = glob qq("$dir/*.xsl");
458
    foreach my $file (@files) {
465
    foreach my $file (@files) {
459
        if ( -f "$file" ) {
466
        if ( -f "$file" ) {
(-)a/installer/data/mysql/atomicupdate/bug_17385-CustomOptionForOpacExportOptions_syspref.pl (+29 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "17385",
5
    description => "Add a custom option for OpacExportOptions system preference",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{
12
                UPDATE systempreferences
13
                SET value = 'bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd,custom'
14
                WHERE variable = 'OpacExportOptions';
15
            }
16
        );
17
18
        $dbh->do(
19
            q{
20
                INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
21
                VALUES ('CustomXSLTExportPath','','','The path to the folder containing the customized XSL files for export','');
22
            }
23
        );
24
25
        # sysprefs
26
        say $out "Updated system preference 'OpacExportOptions'";
27
        say $out "Added new system preference 'OpacCustomExportFilePath'";
28
    },
29
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +2 lines)
Lines 188-193 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
188
('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
188
('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
189
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
189
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
190
('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: %issn%, %isbn%, FIXME ADD MORE (use it with CustomCoverImages and/or OPACCustomCoverImages)','free'),
190
('CustomCoverImagesURL','',NULL,'Define an URL serving book cover images, using the following patterns: %issn%, %isbn%, FIXME ADD MORE (use it with CustomCoverImages and/or OPACCustomCoverImages)','free'),
191
('CustomXSLTExportPath','','','The path to the folder containing the customized XSL files for export',''),
191
('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'),
192
('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'),
192
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
193
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
193
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
194
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
Lines 492-498 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
492
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
493
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
493
('OPACDisableSendList','0',NULL,'Allow OPAC users to email lists via a "Send list" button','YesNo'),
494
('OPACDisableSendList','0',NULL,'Allow OPAC users to email lists via a "Send list" button','YesNo'),
494
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
495
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
495
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
496
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd,custom','','Define export options available on OPAC detail page.','multiple'),
496
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
497
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
497
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
498
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
498
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
499
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-1 / +1 lines)
Lines 191-197 Link Here
191
            <li><a class="dropdown-item" href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
191
            <li><a class="dropdown-item" href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
192
            <li><a class="dropdown-item" href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
192
            <li><a class="dropdown-item" href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
193
            [% FOREACH filesOption IN filesOptions %]
193
            [% FOREACH filesOption IN filesOptions %]
194
                <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>
194
                <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>
195
            [% END %]
195
            [% END %]
196
        </ul>
196
        </ul>
197
    </div>
197
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (-1 / +1 lines)
Lines 42-48 Link Here
42
                    <li><a class="dropdown-item" 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>
42
                    <li><a class="dropdown-item" 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>
43
                [% END %]
43
                [% END %]
44
                [% FOREACH xsl_export IN xsl_exports %]
44
                [% FOREACH xsl_export IN xsl_exports %]
45
                    <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>
45
                    <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_export.filename | html %]</a></li>
46
                [% END %]
46
                [% END %]
47
            </ul>
47
            </ul>
48
        </div>
48
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+5 lines)
Lines 397-402 Cataloging: Link Here
397
            - "All values of repeating tags and subfields will be printed with the given BibTeX tag."
397
            - "All values of repeating tags and subfields will be printed with the given BibTeX tag."
398
            - "<br/>"
398
            - "<br/>"
399
            - "Use '@' ( with quotes ) as the BT_TAG to replace the bibtex record type with a field value of your choosing."
399
            - "Use '@' ( with quotes ) as the BT_TAG to replace the bibtex record type with a field value of your choosing."
400
        -
401
            - "Use this"
402
            - pref: CustomXSLTExportPath
403
              class: long
404
            - "as the path containing the customized XSL files for export (write the complete path)."
400
        -
405
        -
401
            - "Include the following fields when exporting RIS:"
406
            - "Include the following fields when exporting RIS:"
402
            - pref: RisExportAdditionalFields
407
            - pref: RisExportAdditionalFields
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 306-312 OPAC: Link Here
306
                mods: MODS
306
                mods: MODS
307
                ris: RIS
307
                ris: RIS
308
                isbd: ISBD
308
                isbd: ISBD
309
                custom: XSL - Simple Export
309
                custom: Simple HTML formats
310
        -
310
        -
311
            - pref: OpacSeparateHoldings
311
            - pref: OpacSeparateHoldings
312
              choices:
312
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (-1 / +1 lines)
Lines 60-66 Link Here
60
                        <li><a class="dropdown-item" 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
                        <li><a class="dropdown-item" 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>
61
                    [% END %]
61
                    [% END %]
62
                    [% FOREACH xsl_export IN xsl_exports %]
62
                    [% FOREACH xsl_export IN xsl_exports %]
63
                        <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
                        <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_export.filename | html %]</a></li>
64
                    [% END %]
64
                    [% END %]
65
                </ul>
65
                </ul>
66
            </div>
66
            </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +1 lines)
Lines 983-989 Link Here
983
                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
983
                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
984
                            <option value="utf8">MARC (Unicode/UTF-8)</option>
984
                            <option value="utf8">MARC (Unicode/UTF-8)</option>
985
                            [% FOREACH filesOption IN filesOptions %]
985
                            [% FOREACH filesOption IN filesOptions %]
986
                                <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option>
986
                                <option value="[% filesOption.value | html %]">[% filesOption.filename | html %]</option>
987
                            [% END %]
987
                            [% END %]
988
                        </select>
988
                        </select>
989
                        <input type="submit" name="save" class="btn btn-primary" value="Download record" />
989
                        <input type="submit" name="save" class="btn btn-primary" value="Download record" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/downloadshelf.tt (-1 / +1 lines)
Lines 43-49 Link Here
43
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
43
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
44
                            [% END %]
44
                            [% END %]
45
                            [% FOREACH xsl_export IN xsl_exports %]
45
                            [% FOREACH xsl_export IN xsl_exports %]
46
                                <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
46
                                <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
47
                            [% END %]
47
                            [% END %]
48
                        </select>
48
                        </select>
49
                    </li></ol
49
                    </li></ol
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/biblioexport/MARC21_simple_export.xsl (-51 / +64 lines)
Lines 1-62 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
3
<!DOCTYPE stylesheet>
4
2
<xsl:stylesheet version="1.0"
5
<xsl:stylesheet version="1.0"
3
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
   xmlns:marc="http://www.loc.gov/MARC21/slim"
7
    xmlns:marc="http://www.loc.gov/MARC21/slim"
5
   title="Simple Export">
8
    exclude-result-prefixes="marc"
6
<xsl:output method="html" encoding="UTF-8"/>
9
    title="Simple Export">
10
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
7
11
8
    <xsl:template match="/">
12
    <xsl:template match="/">
9
      <xsl:apply-templates/>
13
        <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
14
        <html lang="en">
15
            <head>
16
                <meta http-equiv="Content-Type" content="text/html"/>
17
                <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
18
                <title>Simple Export</title>
19
            </head>
20
            <body>
21
                <xsl:apply-templates/>
22
            </body>
23
        </html>
10
    </xsl:template>
24
    </xsl:template>
11
25
12
    <xsl:template match="marc:record">
26
    <xsl:template match="marc:record">
13
      <p>
27
        <p>
14
        <xsl:if test="marc:datafield[@tag=245]">
28
            <xsl:if test="marc:datafield[@tag=245]">
15
        <xsl:for-each select="marc:datafield[@tag=245]">
29
                <xsl:for-each select="marc:datafield[@tag=245]">
16
            <xsl:value-of select="marc:subfield[@code='a']"/>
30
                    <xsl:value-of select="marc:subfield[@code='a']"/>
17
            <xsl:if test="marc:subfield[@code='b']">
31
                    <xsl:if test="marc:subfield[@code='b']">
18
                 <xsl:text> </xsl:text>
32
                        <xsl:text> </xsl:text>
19
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
33
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
20
            </xsl:if>
34
                    </xsl:if>
21
            <xsl:if test="marc:subfield[@code='c']">
35
                    <xsl:if test="marc:subfield[@code='c']">
22
                  <xsl:text> </xsl:text>
36
                        <xsl:text> </xsl:text>
23
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
37
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
24
            </xsl:if>
38
                    </xsl:if>
25
        </xsl:for-each>
39
                </xsl:for-each>
26
        </xsl:if>
27
        <xsl:if test="marc:datafield[@tag=260]">
28
        <br/>
29
        <xsl:for-each select="marc:datafield[@tag=260]">
30
            <xsl:if test="marc:subfield[@code='a']">
31
                 <xsl:value-of select="marc:subfield[@code='a']"/>
32
            </xsl:if>
40
            </xsl:if>
33
            <xsl:if test="marc:subfield[@code='b']">
41
            <xsl:if test="marc:datafield[@tag=260]">
34
                 <xsl:text> </xsl:text>
42
                <br/>
35
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
43
                <xsl:for-each select="marc:datafield[@tag=260]">
44
                    <xsl:if test="marc:subfield[@code='a']">
45
                        <xsl:value-of select="marc:subfield[@code='a']"/>
46
                    </xsl:if>
47
                    <xsl:if test="marc:subfield[@code='b']">
48
                        <xsl:text> </xsl:text>
49
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
50
                    </xsl:if>
51
                    <xsl:if test="marc:subfield[@code='c']">
52
                        <xsl:text> </xsl:text>
53
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
54
                    </xsl:if>
55
                </xsl:for-each>
36
            </xsl:if>
56
            </xsl:if>
37
            <xsl:if test="marc:subfield[@code='c']">
57
            <xsl:if test="marc:datafield[@tag=264]">
38
                  <xsl:text> </xsl:text>
58
                <br/>
39
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
59
                <xsl:for-each select="marc:datafield[@tag=264]">
60
                    <xsl:if test="marc:subfield[@code='a']">
61
                        <xsl:value-of select="marc:subfield[@code='a']"/>
62
                    </xsl:if>
63
                    <xsl:if test="marc:subfield[@code='b']">
64
                        <xsl:text> </xsl:text>
65
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
66
                    </xsl:if>
67
                    <xsl:if test="marc:subfield[@code='c']">
68
                        <xsl:text> </xsl:text>
69
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
70
                    </xsl:if>
71
                </xsl:for-each>
40
            </xsl:if>
72
            </xsl:if>
41
        </xsl:for-each>
73
        </p>
42
        </xsl:if>
43
        <xsl:if test="marc:datafield[@tag=264]">
44
        <br/>
45
        <xsl:for-each select="marc:datafield[@tag=264]">
46
            <xsl:if test="marc:subfield[@code='a']">
47
                 <xsl:value-of select="marc:subfield[@code='a']"/>
48
            </xsl:if>
49
            <xsl:if test="marc:subfield[@code='b']">
50
                 <xsl:text> </xsl:text>
51
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
52
            </xsl:if>
53
            <xsl:if test="marc:subfield[@code='c']">
54
                  <xsl:text> </xsl:text>
55
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
56
            </xsl:if>
57
        </xsl:for-each>
58
        </xsl:if>
59
      </p>
60
    </xsl:template>
74
    </xsl:template>
61
62
</xsl:stylesheet>
75
</xsl:stylesheet>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-1 / +1 lines)
Lines 123-129 Link Here
123
                                </a>
123
                                </a>
124
                            [% ELSE %]
124
                            [% ELSE %]
125
                                [% FOREACH filesOption IN filesOptions %]
125
                                [% FOREACH filesOption IN filesOptions %]
126
                                    <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>
126
                                    <a href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | url %]&amp;op=exportxsl&amp;file=[% filesOption.value | url %]&amp;bib=[% biblionumber | url %]" >[% filesOption.filename | html %]</a>
127
                                [% END %]
127
                                [% END %]
128
                            [% END %]
128
                            [% END %]
129
                        [% END %]
129
                        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt (-1 / +1 lines)
Lines 65-71 Link Here
65
                                    [% FOREACH option IN export_options %]
65
                                    [% FOREACH option IN export_options %]
66
                                        [% IF option == 'custom' %]
66
                                        [% IF option == 'custom' %]
67
                                            [% FOREACH xsl_export IN xsl_exports %]
67
                                            [% FOREACH xsl_export IN xsl_exports %]
68
                                                <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>
68
                                                <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_export.filename | html %]</a>
69
                                            [% END %]
69
                                            [% END %]
70
                                        [% END %]
70
                                        [% END %]
71
                                    [% END %]
71
                                    [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt (-1 / +1 lines)
Lines 22-28 Link Here
22
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
22
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
23
                            [% END %]
23
                            [% END %]
24
                            [% FOREACH xsl_export IN xsl_exports %]
24
                            [% FOREACH xsl_export IN xsl_exports %]
25
                                <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
25
                                <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
26
                            [% END %]
26
                            [% END %]
27
                        </select>
27
                        </select>
28
                        <fieldset class="action">
28
                        <fieldset class="action">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt (-1 / +1 lines)
Lines 62-68 Link Here
62
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
62
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
63
                                        [% END %]
63
                                        [% END %]
64
                                        [% FOREACH xsl_export IN xsl_exports %]
64
                                        [% FOREACH xsl_export IN xsl_exports %]
65
                                            <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
65
                                            <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
66
                                        [% END %]
66
                                        [% END %]
67
                                    </select>
67
                                    </select>
68
                                    <span class="required">Required</span>
68
                                    <span class="required">Required</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-1 / +1 lines)
Lines 259-265 Link Here
259
                                                [% FOREACH option IN export_options %]
259
                                                [% FOREACH option IN export_options %]
260
                                                    [% IF option == 'custom' %]
260
                                                    [% IF option == 'custom' %]
261
                                                        [% FOREACH xsl_export IN xsl_exports %]
261
                                                        [% FOREACH xsl_export IN xsl_exports %]
262
                                                            <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>
262
                                                            <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_export.filename | html %]</a>
263
                                                        [% END %]
263
                                                        [% END %]
264
                                                    [% END %]
264
                                                    [% END %]
265
                                                [% END %]
265
                                                [% END %]
(-)a/t/db_dependent/XSLT.t (-30 / +49 lines)
Lines 39-45 my $builder = t::lib::TestBuilder->new; Link Here
39
our $cache = Koha::Caches->get_instance;
39
our $cache = Koha::Caches->get_instance;
40
40
41
subtest 'Tests moved from t' => sub {
41
subtest 'Tests moved from t' => sub {
42
    plan tests => 11;
42
    plan tests => 14;
43
    $schema->storage->txn_begin;
43
    $schema->storage->txn_begin;
44
44
45
    my $dir    = File::Temp->newdir();
45
    my $dir    = File::Temp->newdir();
Lines 86-119 subtest 'Tests moved from t' => sub { Link Here
86
    t::lib::Mocks::mock_config('opachtdocs', "$dir");
86
    t::lib::Mocks::mock_config('opachtdocs', "$dir");
87
    make_path("$dir/bootstrap/en/xslt/biblioexport");
87
    make_path("$dir/bootstrap/en/xslt/biblioexport");
88
88
89
    # Make XSL with title
89
    sub createXSLTFiles {
90
    open my $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_01.xsl";
90
        my ( $path ) = @_;
91
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
91
92
    <xsl:stylesheet version="1.0"
92
        open my $fh, '>', "$path/export_01.xsl";
93
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
93
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
94
       xmlns:marc="http://www.loc.gov/MARC21/slim"
94
        <xsl:stylesheet version="1.0"
95
       title="Export 01">
95
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
96
    </xsl:stylesheet>|;
96
        xmlns:marc="http://www.loc.gov/MARC21/slim"
97
    close $fh;
97
        title="Export 01">
98
98
        </xsl:stylesheet>|;
99
    # Make XSL without title
99
        close $fh;
100
    open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_02.xsl";
100
101
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
101
        # Make XSL without title
102
    <xsl:stylesheet version="1.0"
102
        open $fh, '>', "$path/export_02.xsl";
103
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
103
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
104
       xmlns:marc="http://www.loc.gov/MARC21/slim">
104
        <xsl:stylesheet version="1.0"
105
    </xsl:stylesheet>|;
105
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
106
    close $fh;
106
        xmlns:marc="http://www.loc.gov/MARC21/slim">
107
107
        </xsl:stylesheet>|;
108
    open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_03.xsl";
108
        close $fh;
109
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|;
109
110
    close $fh;
110
        open $fh, '>', "$path/export_03.xsl";
111
111
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|;
112
    t::lib::Mocks::mock_preference( 'OpacExportOptions', 'custom');
112
        close $fh;
113
    my @custom_xslts = @{C4::XSLT::CustomXSLTExportList(1)};
113
    }
114
    ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs");
114
115
    ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node");
115
    t::lib::Mocks::mock_preference( 'CustomXSLTExportPath', '' );
116
    ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified");
116
    t::lib::Mocks::mock_config( 'opachtdocs', "$dir" );
117
118
    make_path( "$dir/bootstrap/" . C4::Languages::getlanguage() . "/xslt/biblioexport" );
119
    createXSLTFiles( "$dir/bootstrap/" . C4::Languages::getlanguage() . "/xslt/biblioexport" );
120
121
    t::lib::Mocks::mock_preference( 'OpacExportOptions', 'custom' );
122
    my @custom_xslts = @{ C4::XSLT::CustomXSLTExportList(1) };
123
124
    ok( ( scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs" );
125
    ok( $custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node" );
126
    ok( $custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified" );
127
128
    # CustomXSLTExportPath
129
    t::lib::Mocks::mock_preference( 'CustomXSLTExportPath', "/$dir/XSLTExportFiles" );
130
    make_path("$dir/XSLTExportFiles");
131
    createXSLTFiles("$dir/XSLTExportFiles");
132
    @custom_xslts = @{ C4::XSLT::CustomXSLTExportList(1) };
133
134
    ok( ( scalar @custom_xslts ) == 2,               "CustomXSLTExportList finds custom XSLTs with CustomXSLTExportPath" );
135
    ok( $custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node with CustomXSLTExportPath" );
136
    ok( $custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified with CustomXSLTExportPath" );
117
137
118
    $schema->storage->txn_rollback;
138
    $schema->storage->txn_rollback;
119
};
139
};
120
- 

Return to bug 17385