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 181-195 my $marcissns = GetMarcISSN ( $record, $marcflavour ); Link Here
181
my $issn = $marcissns->[0] || '';
181
my $issn = $marcissns->[0] || '';
182
182
183
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
183
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
184
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
185
    $dat->{title} =~ s/\/+$//; # remove trailing slash
184
    $dat->{title} =~ s/\/+$//; # remove trailing slash
186
    $dat->{title} =~ s/\s+$//; # remove trailing space
185
    $dat->{title} =~ s/\s+$//; # remove trailing space
187
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
186
    $search_for_title = parametrized_url(
188
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
187
        $search_for_title,
189
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
188
        {
190
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
189
            TITLE         => $dat->{title},
191
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
190
            AUTHOR        => $dat->{author},
192
 $template->param('OPACSearchForTitleIn' => $search_for_title);
191
            ISBN          => $isbn,
192
            ISSN          => $issn,
193
            CONTROLNUMBER => $marccontrolnumber,
194
            BIBLIONUMBER  => $biblionumber,
195
        }
196
    );
197
    $template->param('OPACSearchForTitleIn' => $search_for_title);
193
}
198
}
194
199
195
output_html_with_http_headers $query, $cookie, $template->output;
200
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-MARCdetail.pl (-7 / +12 lines)
Lines 296-310 my $marcissns = GetMarcISSN( $record, $marcflavour ); Link Here
296
my $issn = $marcissns->[0] || '';
296
my $issn = $marcissns->[0] || '';
297
297
298
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
298
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
299
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
300
    $dat->{title} =~ s/\/+$//; # remove trailing slash
299
    $dat->{title} =~ s/\/+$//; # remove trailing slash
301
    $dat->{title} =~ s/\s+$//; # remove trailing space
300
    $dat->{title} =~ s/\s+$//; # remove trailing space
302
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
301
    $search_for_title = parametrized_url(
303
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
302
        $search_for_title,
304
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
303
        {
305
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
304
            TITLE         => $dat->{title},
306
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
305
            AUTHOR        => $dat->{author},
307
 $template->param('OPACSearchForTitleIn' => $search_for_title);
306
            ISBN          => $isbn,
307
            ISSN          => $issn,
308
            CONTROLNUMBER => $marccontrolnumber,
309
            BIBLIONUMBER  => $biblionumber,
310
        }
311
    );
312
    $template->param('OPACSearchForTitleIn' => $search_for_title);
308
}
313
}
309
314
310
$template->param(
315
$template->param(
(-)a/opac/opac-detail.pl (-7 / +11 lines)
Lines 966-979 my $marcissns = GetMarcISSN ( $record, $marcflavour ); Link Here
966
my $issn = $marcissns->[0] || '';
966
my $issn = $marcissns->[0] || '';
967
967
968
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
968
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
969
    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
970
    $dat->{title} =~ s/\/+$//; # remove trailing slash
969
    $dat->{title} =~ s/\/+$//; # remove trailing slash
971
    $dat->{title} =~ s/\s+$//; # remove trailing space
970
    $dat->{title} =~ s/\s+$//; # remove trailing space
972
    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
971
    $search_for_title = parametrized_url(
973
    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
972
        $search_for_title,
974
    $issn ? $search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
973
        {
975
    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
974
            TITLE         => $dat->{title},
976
    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
975
            AUTHOR        => $dat->{author},
976
            ISBN          => $isbn,
977
            ISSN          => $issn,
978
            CONTROLNUMBER => $marccontrolnumber,
979
            BIBLIONUMBER  => $biblionumber,
980
        }
981
    );
977
    $template->param('OPACSearchForTitleIn' => $search_for_title);
982
    $template->param('OPACSearchForTitleIn' => $search_for_title);
978
}
983
}
979
984
980
- 

Return to bug 9504