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

(-)a/C4/Output.pm (-2 / +16 lines)
Lines 28-33 package C4::Output; Link Here
28
use strict;
28
use strict;
29
#use warnings; FIXME - Bug 2505
29
#use warnings; FIXME - Bug 2505
30
30
31
use URI::Escape;
32
31
use C4::Context;
33
use C4::Context;
32
use C4::Dates qw(format_date);
34
use C4::Dates qw(format_date);
33
use C4::Budgets qw(GetCurrency);
35
use C4::Budgets qw(GetCurrency);
Lines 42-54 BEGIN { Link Here
42
44
43
 @ISA    = qw(Exporter);
45
 @ISA    = qw(Exporter);
44
    @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
46
    @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead
45
    %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar
47
    %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar parametrized_url
46
                                &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)],
48
                                &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)],
47
                    ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)],
49
                    ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)],
48
                    html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
50
                    html =>[qw(&output_with_http_headers &output_html_with_http_headers)]
49
                );
51
                );
50
    push @EXPORT, qw(
52
    push @EXPORT, qw(
51
        setlanguagecookie getlanguagecookie pagination_bar
53
        setlanguagecookie getlanguagecookie pagination_bar parametrized_url
52
    );
54
    );
53
    push @EXPORT, qw(
55
    push @EXPORT, qw(
54
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber
56
        &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber
Lines 327-332 sub is_ajax { Link Here
327
    return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0;
329
    return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0;
328
}
330
}
329
331
332
sub parametrized_url {
333
    my $url = shift || ''; # ie page.pl?ln={LANG}
334
    my $vars = shift || {}; # ie { LANG => en }
335
    my $ret = $url;
336
    while ( my ($key,$val) = each %$vars) {
337
        my $val_url = URI::Escape::uri_escape_utf8($val);
338
        $ret =~ s/\{$key\}/$val_url/g;
339
    }
340
    $ret =~ s/\{[^\{]*\}//g; # remove not defined vars
341
    return $ret;
342
}
343
330
END { }    # module clean-up code here (global destructor)
344
END { }    # module clean-up code here (global destructor)
331
345
332
1;
346
1;
(-)a/opac/opac-ISBDdetail.pl (-7 / +12 lines)
Lines 180-194 my $marcissns = GetMarcISSN ( $record, $marcflavour ); Link Here
180
my $issn = $marcissns->[0] || '';
180
my $issn = $marcissns->[0] || '';
181
181
182
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
182
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
183
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
184
    $dat->{title} =~ s/\/+$//; # remove trailing slash
183
    $dat->{title} =~ s/\/+$//; # remove trailing slash
185
    $dat->{title} =~ s/\s+$//; # remove trailing space
184
    $dat->{title} =~ s/\s+$//; # remove trailing space
186
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
185
    $search_for_title = parametrized_url(
187
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
186
        $search_for_title,
188
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
187
        {
189
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
188
            TITLE         => $dat->{title},
190
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
189
            AUTHOR        => $dat->{author},
191
 $template->param('OPACSearchForTitleIn' => $search_for_title);
190
            ISBN          => $isbn,
191
            ISSN          => $issn,
192
            CONTROLNUMBER => $marccontrolnumber,
193
            BIBLIONUMBER  => $biblionumber,
194
        }
195
    );
196
    $template->param('OPACSearchForTitleIn' => $search_for_title);
192
}
197
}
193
198
194
output_html_with_http_headers $query, $cookie, $template->output;
199
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-MARCdetail.pl (-7 / +12 lines)
Lines 295-309 my $marcissns = GetMarcISSN( $record, $marcflavour ); Link Here
295
my $issn = $marcissns->[0] || '';
295
my $issn = $marcissns->[0] || '';
296
296
297
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
297
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
298
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
299
    $dat->{title} =~ s/\/+$//; # remove trailing slash
298
    $dat->{title} =~ s/\/+$//; # remove trailing slash
300
    $dat->{title} =~ s/\s+$//; # remove trailing space
299
    $dat->{title} =~ s/\s+$//; # remove trailing space
301
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
300
    $search_for_title = parametrized_url(
302
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
301
        $search_for_title,
303
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
302
        {
304
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
303
            TITLE         => $dat->{title},
305
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
304
            AUTHOR        => $dat->{author},
306
 $template->param('OPACSearchForTitleIn' => $search_for_title);
305
            ISBN          => $isbn,
306
            ISSN          => $issn,
307
            CONTROLNUMBER => $marccontrolnumber,
308
            BIBLIONUMBER  => $biblionumber,
309
        }
310
    );
311
    $template->param('OPACSearchForTitleIn' => $search_for_title);
307
}
312
}
308
313
309
$template->param(
314
$template->param(
(-)a/opac/opac-detail.pl (-7 / +11 lines)
Lines 938-951 my $marcissns = GetMarcISSN ( $record, $marcflavour ); Link Here
938
my $issn = $marcissns->[0] || '';
938
my $issn = $marcissns->[0] || '';
939
939
940
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
940
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
941
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
942
    $dat->{title} =~ s/\/+$//; # remove trailing slash
941
    $dat->{title} =~ s/\/+$//; # remove trailing slash
943
    $dat->{title} =~ s/\s+$//; # remove trailing space
942
    $dat->{title} =~ s/\s+$//; # remove trailing space
944
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
943
    $search_for_title = parametrized_url(
945
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
944
        $search_for_title,
946
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
945
        {
947
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
946
            TITLE         => $dat->{title},
948
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
947
            AUTHOR        => $dat->{author},
948
            ISBN          => $isbn,
949
            ISSN          => $issn,
950
            CONTROLNUMBER => $marccontrolnumber,
951
            BIBLIONUMBER  => $biblionumber,
952
        }
953
    );
949
    $template->param('OPACSearchForTitleIn' => $search_for_title);
954
    $template->param('OPACSearchForTitleIn' => $search_for_title);
950
}
955
}
951
956
952
- 

Return to bug 9504