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

(-)a/C4/XSLT.pm (-6 / +7 lines)
Lines 204-227 sub get_xslt_sysprefs { Link Here
204
}
204
}
205
205
206
sub get_xsl_filename {
206
sub get_xsl_filename {
207
    my ( $xslsyspref ) = @_;
207
    my ( $xslsyspref, $xslfilename ) = @_;
208
208
209
    my $lang   = C4::Languages::getlanguage();
209
    my $lang   = C4::Languages::getlanguage();
210
210
211
    my $xslfilename = C4::Context->preference($xslsyspref) || "default";
211
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
212
212
213
    if ($xslsyspref eq "XSLTCustomExport") {
213
    if ($xslsyspref eq "XSLTCustomExport") {
214
        my $dir;
214
        my $dir;
215
        $dir = C4::Context->config('intrahtdocs') .
215
        $dir = C4::Context->config('intrahtdocs') .
216
            '/' . C4::Context->preference("template") .
216
            '/' . C4::Context->preference("template") .
217
            '/' . C4::Languages::getlanguage() .
217
            '/' . $lang .
218
            '/xslt/biblioexport';
218
            '/xslt/biblioexport';
219
        $xslfilename = $dir . "/" . $xslfilename;
219
        $xslfilename = $dir . "/" . $xslfilename;
220
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
220
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
221
        my $dir;
221
        my $dir;
222
        $dir = C4::Context->config('opachtdocs') .
222
        $dir = C4::Context->config('opachtdocs') .
223
            '/' . C4::Context->preference("opacthemes") .
223
            '/' . C4::Context->preference("opacthemes") .
224
            '/' . C4::Languages::getlanguage() .
224
            '/' . $lang .
225
            '/xslt/biblioexport';
225
            '/xslt/biblioexport';
226
        $xslfilename = $dir . "/" . $xslfilename;
226
        $xslfilename = $dir . "/" . $xslfilename;
227
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
227
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
Lines 281-291 sub XSLTParse4Display { Link Here
281
    my $hidden_items = $params->{hidden_items} || [];
281
    my $hidden_items = $params->{hidden_items} || [];
282
    my $variables    = $params->{xslt_variables};
282
    my $variables    = $params->{xslt_variables};
283
    my $items_rs     = $params->{items_rs};
283
    my $items_rs     = $params->{items_rs};
284
    my $xslfilename  = $params->{xslfilename};
284
285
285
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
286
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
286
        if not defined $params->{xsl_syspref};
287
        if not defined $params->{xsl_syspref};
287
288
288
    my $xslfilename = get_xsl_filename( $xslsyspref);
289
    $xslfilename = get_xsl_filename( $xslsyspref, $xslfilename);
289
290
290
    # grab the XML, run it through our stylesheet, push it out to the browser
291
    # grab the XML, run it through our stylesheet, push it out to the browser
291
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
292
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
Lines 298-304 sub XSLTParse4Display { Link Here
298
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
299
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
299
300
300
    my $biblio;
301
    my $biblio;
301
    my $variables ||= {};
302
    $variables ||= {};
302
303
303
    if (C4::Context->preference('OPACShowOpenURL')) {
304
    if (C4::Context->preference('OPACShowOpenURL')) {
304
        my @biblio_itemtypes;
305
        my @biblio_itemtypes;
(-)a/basket/downloadcart.pl (-1 / +9 lines)
Lines 81-87 if ($bib_list && $format) { Link Here
81
                $output .= marc2bibtex($record, $biblio);
81
                $output .= marc2bibtex($record, $biblio);
82
            }
82
            }
83
            elsif ($format =~ /^xsl\.(.*)$/) {
83
            elsif ($format =~ /^xsl\.(.*)$/) {
84
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, '');
84
                $output .= XSLTParse4Display(
85
                    {
86
                      biblionumber => $biblio,
87
                      record => $record,
88
                      xsl_syspref => "XSLTCustomExport",
89
                      fix_amps  => 1,
90
                      hidden_items => undef,
91
                    }
92
                );
85
            }
93
            }
86
        }
94
        }
87
    }
95
    }
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 41-47 use C4::XISBN qw( get_xisbns ); Link Here
41
use C4::External::Amazon qw( get_amazon_tld );
41
use C4::External::Amazon qw( get_amazon_tld );
42
use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra );
42
use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra );
43
use C4::Tags qw( get_tags );
43
use C4::Tags qw( get_tags );
44
use C4::XSLT qw( XSLTParse4Display );
44
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
45
use Koha::DateUtils qw( format_sqldatetime );
45
use Koha::DateUtils qw( format_sqldatetime );
46
use C4::HTML5Media;
46
use C4::HTML5Media;
47
use C4::CourseReserves qw( GetItemCourseReservesInfo );
47
use C4::CourseReserves qw( GetItemCourseReservesInfo );
(-)a/catalogue/export.pl (-2 / +11 lines)
Lines 7-13 use C4::Output; Link Here
7
use C4::Biblio qw( GetMarcBiblio GetMarcControlnumber );
7
use C4::Biblio qw( GetMarcBiblio GetMarcControlnumber );
8
use CGI qw ( -utf8 );
8
use CGI qw ( -utf8 );
9
use C4::Ris qw( marc2ris );
9
use C4::Ris qw( marc2ris );
10
use C4::XSLT;
10
use C4::XSLT qw( XSLTParse4Display );
11
11
12
12
13
13
Lines 97-103 if ($op eq "export") { Link Here
97
        my $format=$query->param("format")||'txt';
97
        my $format=$query->param("format")||'txt';
98
        my @hiddenitems;
98
        my @hiddenitems;
99
99
100
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,'');
100
        $marc = XSLTParse4Display(
101
            {
102
              biblionumber   => $biblionumber,
103
              record         => $marc,
104
              xsl_syspref    => "XSLTCustomExport",
105
              fix_amps       => 1,
106
              hidden_items   => \@hiddenitems,
107
              xslfilename    => $xslFile,
108
            }
109
        );
101
        print $query->header(
110
        print $query->header(
102
            -type => 'application/octet-stream',
111
            -type => 'application/octet-stream',
103
            -attachment=>"bib-$biblionumber.$format");
112
            -attachment=>"bib-$biblionumber.$format");
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 61-67 use C4::External::Syndetics qw( Link Here
61
    get_syndetics_toc
61
    get_syndetics_toc
62
);
62
);
63
use C4::Members;
63
use C4::Members;
64
use C4::XSLT qw( XSLTParse4Display );
64
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
65
use C4::ShelfBrowser qw( GetNearbyItems );
65
use C4::ShelfBrowser qw( GetNearbyItems );
66
use C4::Reserves qw( GetReserveStatus );
66
use C4::Reserves qw( GetReserveStatus );
67
use C4::Charset qw( SetUTF8Flag );
67
use C4::Charset qw( SetUTF8Flag );
(-)a/opac/opac-downloadcart.pl (-1 / +9 lines)
Lines 118-124 if ($bib_list && $format) { Link Here
118
                $type      = "text/plain";
118
                $type      = "text/plain";
119
            }
119
            }
120
            elsif ($format =~ /^xsl\.(.*)$/) {
120
            elsif ($format =~ /^xsl\.(.*)$/) {
121
                $output .= XSLTParse4Display($biblio, $record, 'OPACXSLTCustomExport', 1, undef, undef, $1, '');
121
               $output .= XSLTParse4Display(
122
                   {
123
                     biblionumber   => $biblio,
124
                     record         => $record,
125
                     xsl_syspref    => "OPACXSLTCustomExport",
126
                     fix_amps       => 1,
127
                     hidden_items => undef,
128
                   }
129
               );
122
            }
130
            }
123
        }
131
        }
124
    }
132
    }
(-)a/opac/opac-downloadshelf.pl (-2 / +10 lines)
Lines 126-133 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
126
                    $extension = "txt";
126
                    $extension = "txt";
127
                    $type      = "text/plain";
127
                    $type      = "text/plain";
128
                }elsif ($format =~ /^xsl\.(.*)$/){
128
                }elsif ($format =~ /^xsl\.(.*)$/){
129
                         $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
129
                    $output .= XSLTParse4Display(
130
                    }
130
                        {
131
                          biblionumber => $biblionumber,
132
                          record => $record,
133
                          xsl_syspref  => "XSLTCustomExport",
134
                          fix_amps  => 1,
135
                          hidden_items => undef,
136
                        }
137
                    );
138
                }
131
            }
139
            }
132
        }
140
        }
133
141
(-)a/opac/opac-export.pl (-1 / +10 lines)
Lines 144-150 elsif ($format =~ /html/ ) { Link Here
144
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
144
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
145
        my @hiddenitems;
145
        my @hiddenitems;
146
146
147
        $marc = XSLTParse4Display($biblionumber, $marc, 'OPACXSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef);
147
        $marc = XSLTParse4Display(
148
            {
149
              biblionumber => $biblionumber,
150
              record => $marc,
151
              xsl_syspref  => "OPACXSLTCustomExport",
152
              fix_amps  => 1,
153
              hidden_items => \@hiddenitems,
154
              xslfilename    => $xslFile,
155
            }
156
        );
148
    }
157
    }
149
}
158
}
150
else {
159
else {
(-)a/virtualshelves/downloadshelf.pl (-2 / +9 lines)
Lines 83-89 if ($shelfid && $format) { Link Here
83
                        $output .= marc2bibtex($record, $biblionumber);
83
                        $output .= marc2bibtex($record, $biblionumber);
84
                    }
84
                    }
85
                    elsif ($format =~ /^xsl\.(.*)$/){
85
                    elsif ($format =~ /^xsl\.(.*)$/){
86
                        $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,'');
86
                        $output .= XSLTParse4Display(
87
                        {
88
                            biblionumber => $biblionumber,
89
                            record => $record,
90
                            xsl_syspref  => 'XSLTCustomExport',
91
                            fix_amps     => 1,
92
                            hidden_items => undef,
93
                        }
94
                      );
87
                    }
95
                    }
88
                }
96
                }
89
            }
97
            }
90
- 

Return to bug 17385