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

(-)a/C4/XSLT.pm (-6 / +7 lines)
Lines 131-154 sub get_xslt_sysprefs { Link Here
131
}
131
}
132
132
133
sub get_xsl_filename {
133
sub get_xsl_filename {
134
    my ( $xslsyspref ) = @_;
134
    my ( $xslsyspref, $xslfilename ) = @_;
135
135
136
    my $lang   = C4::Languages::getlanguage();
136
    my $lang   = C4::Languages::getlanguage();
137
137
138
    my $xslfilename = C4::Context->preference($xslsyspref) || "default";
138
    $xslfilename ||= C4::Context->preference($xslsyspref) || "default";
139
139
140
    if ($xslsyspref eq "XSLTCustomExport") {
140
    if ($xslsyspref eq "XSLTCustomExport") {
141
        my $dir;
141
        my $dir;
142
        $dir = C4::Context->config('intrahtdocs') .
142
        $dir = C4::Context->config('intrahtdocs') .
143
            '/' . C4::Context->preference("template") .
143
            '/' . C4::Context->preference("template") .
144
            '/' . C4::Languages::getlanguage() .
144
            '/' . $lang .
145
            '/xslt/biblioexport';
145
            '/xslt/biblioexport';
146
        $xslfilename = $dir . "/" . $xslfilename;
146
        $xslfilename = $dir . "/" . $xslfilename;
147
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
147
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
148
        my $dir;
148
        my $dir;
149
        $dir = C4::Context->config('opachtdocs') .
149
        $dir = C4::Context->config('opachtdocs') .
150
            '/' . C4::Context->preference("opacthemes") .
150
            '/' . C4::Context->preference("opacthemes") .
151
            '/' . C4::Languages::getlanguage() .
151
            '/' . $lang .
152
            '/xslt/biblioexport';
152
            '/xslt/biblioexport';
153
        $xslfilename = $dir . "/" . $xslfilename;
153
        $xslfilename = $dir . "/" . $xslfilename;
154
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
154
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
Lines 209-219 sub XSLTParse4Display { Link Here
209
    my $hidden_items = $params->{hidden_items} || [];
209
    my $hidden_items = $params->{hidden_items} || [];
210
    my $variables    = $params->{xslt_variables};
210
    my $variables    = $params->{xslt_variables};
211
    my $items_rs     = $params->{items_rs};
211
    my $items_rs     = $params->{items_rs};
212
    my $xslfilename  = $params->{xslfilename};
212
213
213
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
214
    die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}"
214
        if not defined $params->{xsl_syspref};
215
        if not defined $params->{xsl_syspref};
215
216
216
    my $xslfilename = get_xsl_filename( $xslsyspref);
217
    $xslfilename = get_xsl_filename( $xslsyspref, $xslfilename);
217
218
218
    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
219
    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
219
    my $record_processor = Koha::RecordProcessor->new(
220
    my $record_processor = Koha::RecordProcessor->new(
Lines 237-243 sub XSLTParse4Display { Link Here
237
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
238
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
238
239
239
    my $biblio;
240
    my $biblio;
240
    my $variables ||= {};
241
    $variables ||= {};
241
242
242
    if (C4::Context->preference('OPACShowOpenURL')) {
243
    if (C4::Context->preference('OPACShowOpenURL')) {
243
        my @biblio_itemtypes;
244
        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 40-46 use C4::XISBN qw( get_xisbns ); Link Here
40
use C4::External::Amazon qw( get_amazon_tld );
40
use C4::External::Amazon qw( get_amazon_tld );
41
use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra );
41
use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra );
42
use C4::Tags qw( get_tags );
42
use C4::Tags qw( get_tags );
43
use C4::XSLT qw( XSLTParse4Display );
43
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
44
use Koha::DateUtils qw( format_sqldatetime );
44
use Koha::DateUtils qw( format_sqldatetime );
45
use C4::HTML5Media;
45
use C4::HTML5Media;
46
use C4::CourseReserves qw( GetItemCourseReservesInfo );
46
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 58-64 use C4::External::Syndetics qw( Link Here
58
    get_syndetics_toc
58
    get_syndetics_toc
59
);
59
);
60
use C4::Members;
60
use C4::Members;
61
use C4::XSLT qw( XSLTParse4Display );
61
use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList );
62
use C4::ShelfBrowser qw( GetNearbyItems );
62
use C4::ShelfBrowser qw( GetNearbyItems );
63
use C4::Reserves qw( GetReserveStatus );
63
use C4::Reserves qw( GetReserveStatus );
64
use C4::Charset qw( SetUTF8Flag );
64
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