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

(-)a/C4/XSLT.pm (-13 / +29 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 129-154 sub get_xslt_sysprefs { Link Here
129
    return $sysxml;
128
    return $sysxml;
130
}
129
}
131
130
131
=head2 get_xsl_filename
132
133
    return xsl filenames in CustomXSLTExportPath or in /koha-tmpl/intranet-tmpl/prog/en/xslt/biblioexport/
134
135
=cut
136
132
sub get_xsl_filename {
137
sub get_xsl_filename {
133
    my ( $xslsyspref, $xslfilename ) = @_;
138
    my ( $xslsyspref, $xslfilename ) = @_;
134
139
135
    my $lang   = C4::Languages::getlanguage();
140
    my $lang   = C4::Languages::getlanguage();
136
141
137
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
142
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
143
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
138
144
139
    if ($xslsyspref eq "XSLTCustomExport") {
145
    if ($xslsyspref eq "XSLTCustomExport") {
140
        my $dir;
146
        my $dir;
141
        $dir = C4::Context->config('intrahtdocs') .
147
        $dir =
142
            '/' . C4::Context->preference("template") .
148
              $customXSLTExportPath
143
            '/' . $lang .
149
            ? $customXSLTExportPath
144
            '/xslt/biblioexport';
150
            : C4::Context->config('intrahtdocs') . '/'
151
            . C4::Context->preference("template") . '/'
152
            . $lang
153
            . '/xslt/biblioexport';
145
        $xslfilename = $dir . "/" . $xslfilename;
154
        $xslfilename = $dir . "/" . $xslfilename;
146
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
155
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
147
        my $dir;
156
        my $dir;
148
        $dir = C4::Context->config('opachtdocs') .
157
        $dir =
149
            '/' . C4::Context->preference("opacthemes") .
158
              $customXSLTExportPath
150
            '/' . $lang .
159
            ? $customXSLTExportPath
151
            '/xslt/biblioexport';
160
            : C4::Context->config('opachtdocs') . '/'
161
            . C4::Context->preference("opacthemes") . '/'
162
            . $lang
163
            . '/xslt/biblioexport';
152
        $xslfilename = $dir . "/" . $xslfilename;
164
        $xslfilename = $dir . "/" . $xslfilename;
153
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
165
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
154
166
Lines 425-430 sub CustomXSLTExportList { Link Here
425
    my $opac = shift; # opac (1) vs intranet (0)
437
    my $opac = shift; # opac (1) vs intranet (0)
426
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
438
    return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/;
427
439
440
    my $customXSLTExportPath = C4::Context->preference('CustomXSLTExportPath');
428
    # Check the cache first
441
    # Check the cache first
429
    my $cache = Koha::Caches->get_instance;
442
    my $cache = Koha::Caches->get_instance;
430
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
443
    my $key = $opac ? 'CustomXSLTExportListOPAC' : 'CustomXSLTExportListIntra';
Lines 433-442 sub CustomXSLTExportList { Link Here
433
446
434
    my @tabFiles;
447
    my @tabFiles;
435
448
436
    my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') .
449
    my $dir =
437
                      '/' . C4::Context->preference( $opac ? "opacthemes" : "template") .
450
          $customXSLTExportPath
438
                      '/' . C4::Languages::getlanguage() .
451
        ? $customXSLTExportPath
439
                      '/xslt/biblioexport';
452
        : C4::Context->config( $opac     ? 'opachtdocs' : 'intrahtdocs' ) . '/'
453
        . C4::Context->preference( $opac ? "opacthemes" : "template" ) . '/'
454
        . C4::Languages::getlanguage()
455
        . '/xslt/biblioexport';
440
    my @files = glob qq("$dir/*.xsl");
456
    my @files = glob qq("$dir/*.xsl");
441
    foreach my $file (@files) {
457
    foreach my $file (@files) {
442
        if ( -f "$file" ) {
458
        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 183-188 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
183
('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'),
183
('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'),
184
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
184
('CustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed in the staff interface. CustomCoverImagesURL must be defined.','YesNo'),
185
('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'),
185
('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'),
186
('CustomXSLTExportPath','','','The path to the folder containing the customized XSL files for export',''),
186
('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'),
187
('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'),
187
('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'),
188
('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'),
188
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
189
('decreaseLoanHighHolds','0','','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
Lines 479-485 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
479
('OPACDetailQRCode','0','','Enable the display of a QR Code on the OPAC detail page','YesNo'),
480
('OPACDetailQRCode','0','','Enable the display of a QR Code on the OPAC detail page','YesNo'),
480
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
481
('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
481
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
482
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
482
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
483
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd,custom','','Define export options available on OPAC detail page.','multiple'),
483
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
484
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
484
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
485
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
485
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
486
('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 156-162 Link Here
156
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
156
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
157
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
157
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
158
        [% FOREACH filesOption IN filesOptions %]
158
        [% FOREACH filesOption IN filesOptions %]
159
            <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>
159
            <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>
160
        [% END %]
160
        [% END %]
161
    </ul>
161
    </ul>
162
    </div>
162
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (-1 / +1 lines)
Lines 37-43 Link Here
37
                        <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>
37
                        <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>
38
                    [% END %]
38
                    [% END %]
39
                    [% FOREACH xsl_export IN xsl_exports %]
39
                    [% FOREACH xsl_export IN xsl_exports %]
40
                        <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>
40
                        <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>
41
                    [% END %]
41
                    [% END %]
42
                </ul>
42
                </ul>
43
        </div>
43
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+5 lines)
Lines 384-389 Cataloging: Link Here
384
            - "All values of repeating tags and subfields will be printed with the given BibTeX tag."
384
            - "All values of repeating tags and subfields will be printed with the given BibTeX tag."
385
            - "<br/>"
385
            - "<br/>"
386
            - "Use '@' ( with quotes ) as the BT_TAG to replace the bibtex record type with a field value of your choosing."
386
            - "Use '@' ( with quotes ) as the BT_TAG to replace the bibtex record type with a field value of your choosing."
387
        -
388
            - "Use this"
389
            - pref: CustomXSLTExportPath
390
              class: long
391
            - "as the path containing the customized XSL files for export (write the complete path)."
387
        -
392
        -
388
            - "Include the following fields when exporting RIS:"
393
            - "Include the following fields when exporting RIS:"
389
            - pref: RisExportAdditionalFields
394
            - pref: RisExportAdditionalFields
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 296-302 OPAC: Link Here
296
                mods: MODS
296
                mods: MODS
297
                ris: RIS
297
                ris: RIS
298
                isbd: ISBD
298
                isbd: ISBD
299
                custom: XSL - Simple Export
299
                custom: Simple HTML formats
300
        -
300
        -
301
            - pref: OpacSeparateHoldings
301
            - pref: OpacSeparateHoldings
302
              choices:
302
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (-1 / +1 lines)
Lines 65-71 Link Here
65
                                <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>
65
                                <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>
66
                            [% END %]
66
                            [% END %]
67
                            [% FOREACH xsl_export IN xsl_exports %]
67
                            [% FOREACH xsl_export IN xsl_exports %]
68
                                <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>
68
                                <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>
69
                            [% END %]
69
                            [% END %]
70
                            </ul>
70
                            </ul>
71
                        </div>
71
                        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +1 lines)
Lines 870-876 Link Here
870
                                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
870
                                            <option value="marc8">MARC (non-Unicode/MARC-8)</option>
871
                                            <option value="utf8">MARC (Unicode/UTF-8)</option>
871
                                            <option value="utf8">MARC (Unicode/UTF-8)</option>
872
                                            [% FOREACH filesOption IN filesOptions %]
872
                                            [% FOREACH filesOption IN filesOptions %]
873
                                                <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option>
873
                                                <option value="[% filesOption.value | html %]">[% filesOption.filename | html %]</option>
874
                                            [% END %]
874
                                            [% END %]
875
                                        </select>
875
                                        </select>
876
                                        <input type="submit" name="save" class="btn btn-primary" value="Download record" />
876
                                        <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 (-50 / +69 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
11
        method="html"
12
        indent="yes"
13
        encoding="UTF-8"/>
7
14
8
    <xsl:template match="/">
15
    <xsl:template match="/">
9
      <xsl:apply-templates/>
16
        <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
17
        <html lang="en">
18
            <head>
19
                <meta http-equiv="Content-Type" content="text/html"/>
20
                <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
21
                <title>Simple Export</title>
22
            </head>
23
            <body>
24
                <xsl:apply-templates/>
25
            </body>
26
        </html>
10
    </xsl:template>
27
    </xsl:template>
11
28
12
    <xsl:template match="marc:record">
29
    <xsl:template match="marc:record">
13
      <p>
30
        <p>
14
        <xsl:if test="marc:datafield[@tag=245]">
31
            <xsl:if test="marc:datafield[@tag=245]">
15
        <xsl:for-each select="marc:datafield[@tag=245]">
32
                <xsl:for-each select="marc:datafield[@tag=245]">
16
            <xsl:value-of select="marc:subfield[@code='a']"/>
33
                    <xsl:value-of select="marc:subfield[@code='a']"/>
17
            <xsl:if test="marc:subfield[@code='b']">
34
                    <xsl:if test="marc:subfield[@code='b']">
18
                 <xsl:text> </xsl:text>
35
                        <xsl:text> </xsl:text>
19
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
36
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
20
            </xsl:if>
37
                    </xsl:if>
21
            <xsl:if test="marc:subfield[@code='c']">
38
                    <xsl:if test="marc:subfield[@code='c']">
22
                  <xsl:text> </xsl:text>
39
                        <xsl:text> </xsl:text>
23
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
40
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
24
            </xsl:if>
41
                    </xsl:if>
25
        </xsl:for-each>
42
                </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>
33
            <xsl:if test="marc:subfield[@code='b']">
34
                 <xsl:text> </xsl:text>
35
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
36
            </xsl:if>
43
            </xsl:if>
37
            <xsl:if test="marc:subfield[@code='c']">
44
            <xsl:if test="marc:datafield[@tag=260]">
38
                  <xsl:text> </xsl:text>
45
                <br/>
39
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
46
                <xsl:for-each select="marc:datafield[@tag=260]">
47
                    <xsl:if test="marc:subfield[@code='a']">
48
                        <xsl:value-of select="marc:subfield[@code='a']"/>
49
                    </xsl:if>
50
                    <xsl:if test="marc:subfield[@code='b']">
51
                        <xsl:text> </xsl:text>
52
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
53
                    </xsl:if>
54
                    <xsl:if test="marc:subfield[@code='c']">
55
                        <xsl:text> </xsl:text>
56
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
57
                    </xsl:if>
58
                </xsl:for-each>
40
            </xsl:if>
59
            </xsl:if>
41
        </xsl:for-each>
60
            <xsl:if test="marc:datafield[@tag=264]">
42
        </xsl:if>
61
                <br/>
43
        <xsl:if test="marc:datafield[@tag=264]">
62
                <xsl:for-each select="marc:datafield[@tag=264]">
44
        <br/>
63
                    <xsl:if test="marc:subfield[@code='a']">
45
        <xsl:for-each select="marc:datafield[@tag=264]">
64
                        <xsl:value-of select="marc:subfield[@code='a']"/>
46
            <xsl:if test="marc:subfield[@code='a']">
65
                    </xsl:if>
47
                 <xsl:value-of select="marc:subfield[@code='a']"/>
66
48
            </xsl:if>
67
                    <xsl:if test="marc:subfield[@code='b']">
49
            <xsl:if test="marc:subfield[@code='b']">
68
                        <xsl:text> </xsl:text>
50
                 <xsl:text> </xsl:text>
69
                        <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
51
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
70
                    </xsl:if>
52
            </xsl:if>
71
53
            <xsl:if test="marc:subfield[@code='c']">
72
                    <xsl:if test="marc:subfield[@code='c']">
54
                  <xsl:text> </xsl:text>
73
                        <xsl:text> </xsl:text>
55
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
74
                        <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
75
                    </xsl:if>
76
                </xsl:for-each>
56
            </xsl:if>
77
            </xsl:if>
57
        </xsl:for-each>
78
        </p>
58
        </xsl:if>
59
      </p>
60
    </xsl:template>
79
    </xsl:template>
61
80
62
</xsl:stylesheet>
81
</xsl:stylesheet>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-1 / +1 lines)
Lines 85-91 Link Here
85
                                </a>
85
                                </a>
86
                            [% ELSE %]
86
                            [% ELSE %]
87
                                [% FOREACH filesOption IN filesOptions %]
87
                                [% FOREACH filesOption IN filesOptions %]
88
                                    <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>
88
                                    <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>
89
                                [% END %]
89
                                [% END %]
90
                            [% END %]
90
                            [% END %]
91
                        [% END %]
91
                        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt (-1 / +1 lines)
Lines 44-50 Link Here
44
                                        [% FOREACH option IN export_options %]
44
                                        [% FOREACH option IN export_options %]
45
                                            [% IF option == 'custom' %]
45
                                            [% IF option == 'custom' %]
46
                                                [% FOREACH xsl_export IN xsl_exports %]
46
                                                [% FOREACH xsl_export IN xsl_exports %]
47
                                                    <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>
47
                                                    <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></li>
48
                                                [% END %]
48
                                                [% END %]
49
                                            [% END %]
49
                                            [% END %]
50
                                        [% END %]
50
                                        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt (-1 / +1 lines)
Lines 21-27 Link Here
21
                                    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
21
                                    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
22
                                [% END %]
22
                                [% END %]
23
                                [% FOREACH xsl_export IN xsl_exports %]
23
                                [% FOREACH xsl_export IN xsl_exports %]
24
                                    <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
24
                                    <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
25
                                [% END %]
25
                                [% END %]
26
                            </select>
26
                            </select>
27
                            <fieldset class="action">
27
                            <fieldset class="action">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt (-1 / +1 lines)
Lines 69-75 Link Here
69
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
69
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
70
                                            [% END %]
70
                                            [% END %]
71
                                            [% FOREACH xsl_export IN xsl_exports %]
71
                                            [% FOREACH xsl_export IN xsl_exports %]
72
                                                <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
72
                                                <option value="xsl.[% xsl_export.value | html %]">[% xsl_export.filename | html %]</option>
73
                                            [% END %]
73
                                            [% END %]
74
                                        </select>
74
                                        </select>
75
                                        <span class="required">Required</span>
75
                                        <span class="required">Required</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-1 / +1 lines)
Lines 247-253 Link Here
247
                                                [% FOREACH option IN export_options %]
247
                                                [% FOREACH option IN export_options %]
248
                                                    [% IF option == 'custom' %]
248
                                                    [% IF option == 'custom' %]
249
                                                        [% FOREACH xsl_export IN xsl_exports %]
249
                                                        [% FOREACH xsl_export IN xsl_exports %]
250
                                                            <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>
250
                                                            <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></li>
251
                                                        [% END %]
251
                                                        [% END %]
252
                                                    [% END %]
252
                                                    [% END %]
253
                                                [% END %]
253
                                                [% END %]
(-)a/t/db_dependent/XSLT.t (-36 / +52 lines)
Lines 38-44 my $builder = t::lib::TestBuilder->new; Link Here
38
our $cache = Koha::Caches->get_instance;
38
our $cache = Koha::Caches->get_instance;
39
39
40
subtest 'Tests moved from t' => sub {
40
subtest 'Tests moved from t' => sub {
41
    plan tests => 11;
41
    plan tests => 14;
42
    $schema->storage->txn_begin;
42
    $schema->storage->txn_begin;
43
43
44
    my $dir = File::Temp->newdir();
44
    my $dir = File::Temp->newdir();
Lines 76-115 subtest 'Tests moved from t' => sub { Link Here
76
    is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en',    'Fell back to prog/en for nope/fr-FR');
76
    is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en',    'Fell back to prog/en for nope/fr-FR');
77
77
78
    my $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>};
78
    my $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>};
79
    my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs();
79
    my $sysprefs_xml    = C4::XSLT::get_xslt_sysprefs();
80
    ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value');
80
    ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value' );
81
81
82
    t::lib::Mocks::mock_config('opachtdocs', "$dir");
82
    sub createXSLTFiles {
83
    make_path("$dir/bootstrap/en/xslt/biblioexport");
83
        my ( $path ) = @_;
84
84
85
    # Make XSL with title
85
        open my $fh, '>', "$path/export_01.xsl";
86
    open my $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_01.xsl";
86
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
87
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
87
        <xsl:stylesheet version="1.0"
88
    <xsl:stylesheet version="1.0"
88
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
89
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
89
        xmlns:marc="http://www.loc.gov/MARC21/slim"
90
       xmlns:marc="http://www.loc.gov/MARC21/slim"
90
        title="Export 01">
91
       title="Export 01">
91
        </xsl:stylesheet>|;
92
    </xsl:stylesheet>|;
92
        close $fh;
93
    close $fh;
93
94
94
        # Make XSL without title
95
    # Make XSL without title
95
        open $fh, '>', "$path/export_02.xsl";
96
    open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_02.xsl";
96
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
97
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>
97
        <xsl:stylesheet version="1.0"
98
    <xsl:stylesheet version="1.0"
98
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
99
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
99
        xmlns:marc="http://www.loc.gov/MARC21/slim">
100
       xmlns:marc="http://www.loc.gov/MARC21/slim">
100
        </xsl:stylesheet>|;
101
    </xsl:stylesheet>|;
101
        close $fh;
102
    close $fh;
102
103
103
        open $fh, '>', "$path/export_03.xsl";
104
    open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_03.xsl";
104
        print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|;
105
    print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|;
105
        close $fh;
106
    close $fh;
106
    }
107
107
108
    t::lib::Mocks::mock_preference( 'OpacExportOptions', 'custom');
108
    t::lib::Mocks::mock_preference( 'CustomXSLTExportPath', '' );
109
    my @custom_xslts = @{C4::XSLT::CustomXSLTExportList(1)};
109
    t::lib::Mocks::mock_config( 'opachtdocs', "$dir" );
110
    ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs");
110
111
    ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node");
111
    make_path( "$dir/bootstrap/" . C4::Languages::getlanguage() . "/xslt/biblioexport" );
112
    ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified");
112
    createXSLTFiles( "$dir/bootstrap/" . C4::Languages::getlanguage() . "/xslt/biblioexport" );
113
114
    t::lib::Mocks::mock_preference( 'OpacExportOptions', 'custom' );
115
    my @custom_xslts = @{ C4::XSLT::CustomXSLTExportList(1) };
116
117
    ok( ( scalar @custom_xslts ) == 2,               "CustomXSLTExportList finds custom XSLTs" );
118
    ok( $custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node" );
119
    ok( $custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified" );
120
121
    # CustomXSLTExportPath
122
    t::lib::Mocks::mock_preference( 'CustomXSLTExportPath', "/$dir/XSLTExportFiles" );
123
    make_path("$dir/XSLTExportFiles");
124
    createXSLTFiles("$dir/XSLTExportFiles");
125
    @custom_xslts = @{ C4::XSLT::CustomXSLTExportList(1) };
126
127
    ok( ( scalar @custom_xslts ) == 2,               "CustomXSLTExportList finds custom XSLTs with CustomXSLTExportPath" );
128
    ok( $custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node with CustomXSLTExportPath" );
129
    ok( $custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified with CustomXSLTExportPath" );
113
130
114
    $schema->storage->txn_rollback;
131
    $schema->storage->txn_rollback;
115
};
132
};
116
- 

Return to bug 17385