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 80-86 if ($bib_list && $format) { Link Here
80
                $output .= marc2bibtex($record, $biblionumber);
80
                $output .= marc2bibtex($record, $biblionumber);
81
            }
81
            }
82
            elsif ($format =~ /^xsl\.(.*)$/) {
82
            elsif ($format =~ /^xsl\.(.*)$/) {
83
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, '');
83
                $output .= XSLTParse4Display(
84
                    {
85
                      biblionumber => $biblio,
86
                      record => $record,
87
                      xsl_syspref => "XSLTCustomExport",
88
                      fix_amps  => 1,
89
                      hidden_items => undef,
90
                    }
91
                );
84
            }
92
            }
85
        }
93
        }
86
    }
94
    }
(-)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( GetMarcControlnumber );
7
use C4::Biblio qw( 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 96-102 if ($op eq "export") { Link Here
96
        my $format=$query->param("format")||'txt';
96
        my $format=$query->param("format")||'txt';
97
        my @hiddenitems;
97
        my @hiddenitems;
98
98
99
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,'');
99
        $marc = XSLTParse4Display(
100
            {
101
              biblionumber   => $biblionumber,
102
              record         => $marc,
103
              xsl_syspref    => "XSLTCustomExport",
104
              fix_amps       => 1,
105
              hidden_items   => \@hiddenitems,
106
              xslfilename    => $xslFile,
107
            }
108
        );
100
        print $query->header(
109
        print $query->header(
101
            -type => 'application/octet-stream',
110
            -type => 'application/octet-stream',
102
            -attachment=>"bib-$biblionumber.$format");
111
            -attachment=>"bib-$biblionumber.$format");
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 60-66 use C4::External::Syndetics qw( Link Here
60
    get_syndetics_toc
60
    get_syndetics_toc
61
);
61
);
62
use C4::Members;
62
use C4::Members;
63
use C4::XSLT qw( XSLTParse4Display );
63
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
64
use C4::ShelfBrowser qw( GetNearbyItems );
64
use C4::ShelfBrowser qw( GetNearbyItems );
65
use C4::Reserves qw( GetReserveStatus );
65
use C4::Reserves qw( GetReserveStatus );
66
use C4::Charset qw( SetUTF8Flag );
66
use C4::Charset qw( SetUTF8Flag );
(-)a/opac/opac-downloadcart.pl (-1 / +9 lines)
Lines 117-123 if ($bib_list && $format) { Link Here
117
                $type      = "text/plain";
117
                $type      = "text/plain";
118
            }
118
            }
119
            elsif ($format =~ /^xsl\.(.*)$/) {
119
            elsif ($format =~ /^xsl\.(.*)$/) {
120
                $output .= XSLTParse4Display($biblio, $record, 'OPACXSLTCustomExport', 1, undef, undef, $1, '');
120
               $output .= XSLTParse4Display(
121
                   {
122
                     biblionumber   => $biblio,
123
                     record         => $record,
124
                     xsl_syspref    => "OPACXSLTCustomExport",
125
                     fix_amps       => 1,
126
                     hidden_items => undef,
127
                   }
128
               );
121
            }
129
            }
122
        }
130
        }
123
    }
131
    }
(-)a/opac/opac-downloadshelf.pl (-2 / +10 lines)
Lines 125-132 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
125
                    $extension = "txt";
125
                    $extension = "txt";
126
                    $type      = "text/plain";
126
                    $type      = "text/plain";
127
                }elsif ($format =~ /^xsl\.(.*)$/){
127
                }elsif ($format =~ /^xsl\.(.*)$/){
128
                         $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
128
                    $output .= XSLTParse4Display(
129
                    }
129
                        {
130
                          biblionumber => $biblionumber,
131
                          record => $record,
132
                          xsl_syspref  => "XSLTCustomExport",
133
                          fix_amps  => 1,
134
                          hidden_items => undef,
135
                        }
136
                    );
137
                }
130
            }
138
            }
131
        }
139
        }
132
140
(-)a/opac/opac-export.pl (-1 / +10 lines)
Lines 145-151 elsif ($format =~ /html/ ) { Link Here
145
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
145
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
146
        my @hiddenitems;
146
        my @hiddenitems;
147
147
148
        $marc = XSLTParse4Display($biblionumber, $marc, 'OPACXSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef);
148
        $marc = XSLTParse4Display(
149
            {
150
              biblionumber => $biblionumber,
151
              record => $marc,
152
              xsl_syspref  => "OPACXSLTCustomExport",
153
              fix_amps  => 1,
154
              hidden_items => \@hiddenitems,
155
              xslfilename    => $xslFile,
156
            }
157
        );
149
    }
158
    }
150
}
159
}
151
else {
160
else {
(-)a/virtualshelves/downloadshelf.pl (-2 / +9 lines)
Lines 82-88 if ($shelfid && $format) { Link Here
82
                        $output .= marc2bibtex($record, $biblionumber);
82
                        $output .= marc2bibtex($record, $biblionumber);
83
                    }
83
                    }
84
                    elsif ($format =~ /^xsl\.(.*)$/){
84
                    elsif ($format =~ /^xsl\.(.*)$/){
85
                        $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,'');
85
                        $output .= XSLTParse4Display(
86
                        {
87
                            biblionumber => $biblionumber,
88
                            record => $record,
89
                            xsl_syspref  => 'XSLTCustomExport',
90
                            fix_amps     => 1,
91
                            hidden_items => undef,
92
                        }
93
                      );
86
                    }
94
                    }
87
                }
95
                }
88
            }
96
            }
89
- 

Return to bug 17385