Bug 10085: unapi does not function under Plack
The following errors appear when trying to use unapi under Plack (among others): Variable "$cgi" is not available at /home/jcamins/kohaclone/opac/unapi line 160. Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 173. Variable "$format_info" is not available at /home/jcamins/kohaclone/opac/unapi line 174. Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 185. To test: 1) Try to view /cgi-bin/koha/unapi under Plack 2) There is no step 2. Plack crashes. 3) Apply patch. 4) Try to view /cgi-bin/koha/unapi again, and note that it doesn't crash Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> I'm puzzled how this ever worked anyway, accidentally i'm guessing, this tidies up some lazy coding Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
parent
9e2b58b582
commit
61d82360be
|
|
@ -120,7 +120,7 @@ my $id = $cgi->param('id');
|
|||
my $format = $cgi->param('format');
|
||||
|
||||
if (not defined $format) {
|
||||
emit_formats($id);
|
||||
emit_formats($id, $format_to_stylesheet_map, $format_info, $cgi);
|
||||
} elsif ($id) {
|
||||
|
||||
# koha:biblionumber:0152018484
|
||||
|
|
@ -136,7 +136,7 @@ if (not defined $format) {
|
|||
exit 0;
|
||||
}
|
||||
|
||||
my $transformer = get_transformer($format);
|
||||
my $transformer = get_transformer($format, $format_to_stylesheet_map, $format_info);
|
||||
unless (defined $transformer) {
|
||||
print $cgi->header( -status => '406 invalid format requested' );
|
||||
exit 0;
|
||||
|
|
@ -167,7 +167,7 @@ if (not defined $format) {
|
|||
exit 0;
|
||||
|
||||
sub emit_formats {
|
||||
my $id = shift;
|
||||
my ($id, $format_to_stylesheet_map, $format_info, $cgi) = @_;
|
||||
|
||||
if (defined $id) {
|
||||
print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' );
|
||||
|
|
@ -192,7 +192,8 @@ sub emit_formats {
|
|||
|
||||
|
||||
sub get_transformer {
|
||||
my $format = lc shift;
|
||||
my ($format, $format_to_stylesheet_map, $format_info) = @_;
|
||||
$format = lc $format;
|
||||
|
||||
my $marcflavour = uc(C4::Context->preference('marcflavour'));
|
||||
return unless $format_to_stylesheet_map->{$marcflavour}->{$format};
|
||||
|
|
|
|||
Loading…
Reference in New Issue