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

(-)a/C4/XSLT.pm (-16 / +23 lines)
Lines 41-47 use XML::LibXML; Link Here
41
use Encode;
41
use Encode;
42
use vars qw(@ISA @EXPORT);
42
use vars qw(@ISA @EXPORT);
43
43
44
45
my $engine;    #XSLT Handler object
44
my $engine;    #XSLT Handler object
46
45
47
our ( @ISA, @EXPORT_OK );
46
our ( @ISA, @EXPORT_OK );
Lines 136-142 sub get_xslt_sysprefs { Link Here
136
135
137
=head2 get_xsl_filename
136
=head2 get_xsl_filename
138
137
139
Missing POD for get_xsl_filename.
138
    return xsl filenames in CustomXSLTExportPath or in /koha-tmpl/intranet-tmpl/prog/en/xslt/biblioexport/
140
139
141
=cut
140
=cut
142
141
Lines 145-165 sub get_xsl_filename { Link Here
145
144
146
    my $lang = C4::Languages::getlanguage();
145
    my $lang = C4::Languages::getlanguage();
147
146
148
    my $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
147
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
148
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
149
149
150
    if ($xslsyspref eq "XSLTCustomExport") {
150
    if ($xslsyspref eq "XSLTCustomExport") {
151
        my $dir;
151
        my $dir;
152
        $dir = C4::Context->config('intrahtdocs') .
152
        $dir = $customXSLTExportPath
153
            '/' . C4::Context->preference("template") .
153
            ? $customXSLTExportPath
154
            '/' . $lang .
154
            : C4::Context->config('intrahtdocs') . '/'
155
            '/xslt/biblioexport';
155
            . C4::Context->preference("template") . '/'
156
            . $lang
157
            . '/xslt/biblioexport';
156
        $xslfilename = $dir . "/" . $xslfilename;
158
        $xslfilename = $dir . "/" . $xslfilename;
157
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
159
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
158
        my $dir;
160
        my $dir;
159
        $dir = C4::Context->config('opachtdocs') .
161
        $dir = $customXSLTExportPath
160
            '/' . C4::Context->preference("opacthemes") .
162
            ? $customXSLTExportPath
161
            '/' . $lang .
163
            : C4::Context->config('opachtdocs') . '/'
162
            '/xslt/biblioexport';
164
            . C4::Context->preference("opacthemes") . '/'
165
            . $lang
166
            . '/xslt/biblioexport';
163
        $xslfilename = $dir . "/" . $xslfilename;
167
        $xslfilename = $dir . "/" . $xslfilename;
164
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
168
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
165
169
Lines 220-226 sub XSLTParse4Display { Link Here
220
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
224
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
221
        if not defined $params->{xsl_syspref};
225
        if not defined $params->{xsl_syspref};
222
226
223
    my $xslfilename = get_xsl_filename($xslsyspref, $xslfilename);
227
    $xslfilename = get_xsl_filename($xslsyspref, $xslfilename);
224
228
225
    my $frameworkcode    = GetFrameworkCode($biblionumber) || '';
229
    my $frameworkcode    = GetFrameworkCode($biblionumber) || '';
226
    my $record_processor = Koha::RecordProcessor->new(
230
    my $record_processor = Koha::RecordProcessor->new(
Lines 490-495 sub CustomXSLTExportList { Link Here
490
    my $opac = shift; # opac (1) vs intranet (0)
494
    my $opac = shift; # opac (1) vs intranet (0)
491
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
495
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
492
496
497
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
493
    # Check the cache first
498
    # Check the cache first
494
    my $cache = Koha::Caches->get_instance;
499
    my $cache = Koha::Caches->get_instance;
495
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
500
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
Lines 498-507 sub CustomXSLTExportList { Link Here
498
503
499
    my @tabFiles;
504
    my @tabFiles;
500
505
501
    my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') .
506
    my $dir = $customXSLTExportPath
502
                      '/' . C4::Context->preference( $opac ? "opacthemes" : "template") .
507
        ? $customXSLTExportPath
503
                      '/' . C4::Languages::getlanguage() .
508
        : C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . '/'
504
                      '/xslt/biblioexport';
509
        . C4::Context->preference( $opac ? "opacthemes" : "template") . '/'
510
        . C4::Languages::getlanguage()
511
        . '/xslt/biblioexport';
505
    my @files = glob qq("$dir/*.xsl");
512
    my @files = glob qq("$dir/*.xsl");
506
    foreach my $file (@files) {
513
    foreach my $file (@files) {
507
        if ( -f "$file" ) {
514
        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 191-196 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
191
('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'),
191
('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'),
192
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
192
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
193
('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'),
193
('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'),
194
('CustomXSLTExportPath','','','The path to the folder containing the customized XSL files for export',''),
194
('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'),
195
('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'),
195
('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'),
196
('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'),
196
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
197
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
Lines 503-509 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
503
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
504
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
504
('OPACDisableSendList','0',NULL,'Allow OPAC users to email lists via a "Send list" button','YesNo'),
505
('OPACDisableSendList','0',NULL,'Allow OPAC users to email lists via a "Send list" button','YesNo'),
505
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
506
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
506
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
507
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd,custom','','Define export options available on OPAC detail page.','multiple'),
507
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
508
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
508
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
509
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
509
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
510
('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 190-196 Link Here
190
            <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>
190
            <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=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
191
            <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
            [% FOREACH filesOption IN filesOptions %]
192
            [% FOREACH filesOption IN filesOptions %]
193
                <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>
193
                <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>
194
            [% END %]
194
            [% END %]
195
        </ul>
195
        </ul>
196
    </div>
196
    </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 985-991 Link Here
985
                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
985
                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
986
                            <option value="utf8">MARC (Unicode/UTF-8)</option>
986
                            <option value="utf8">MARC (Unicode/UTF-8)</option>
987
                            [% FOREACH filesOption IN filesOptions %]
987
                            [% FOREACH filesOption IN filesOptions %]
988
                                <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option>
988
                                <option value="[% filesOption.value | html %]">[% filesOption.filename | html %]</option>
989
                            [% END %]
989
                            [% END %]
990
                        </select>
990
                        </select>
991
                        <input type="submit" name="save" class="btn btn-primary" value="Download record" />
991
                        <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 29-35 Link Here
29
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
29
                                <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
30
                            [% END %]
30
                            [% END %]
31
                            [% FOREACH xsl_export IN xsl_exports %]
31
                            [% FOREACH xsl_export IN xsl_exports %]
32
                                <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
32
                                <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
33
                            [% END %]
33
                            [% END %]
34
                        </select>
34
                        </select>
35
                        <fieldset class="action">
35
                        <fieldset class="action">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt (-1 / +1 lines)
Lines 72-78 Link Here
72
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
72
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
73
                                        [% END %]
73
                                        [% END %]
74
                                        [% FOREACH xsl_export IN xsl_exports %]
74
                                        [% FOREACH xsl_export IN xsl_exports %]
75
                                            <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
75
                                            <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
76
                                        [% END %]
76
                                        [% END %]
77
                                    </select>
77
                                    </select>
78
                                    <span class="required">Required</span>
78
                                    <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