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

(-)a/installer/data/mysql/atomicupdate/bug_37118.pl (-2 / +4 lines)
Lines 9-18 return { Link Here
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        # Do you stuffs here
11
        # Do you stuffs here
12
        $dbh->do(q{
12
        $dbh->do(
13
            q{
13
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14
            ('OPACVirtualCard', '0', NULL,'Enable virtual library cards for patrons on the OPAC.', 'YesNo')
15
            ('OPACVirtualCard', '0', NULL,'Enable virtual library cards for patrons on the OPAC.', 'YesNo')
15
        });
16
        }
17
        );
16
18
17
        # sysprefs
19
        # sysprefs
18
        say $out "Added new system preference 'OPACVirtualCard'";
20
        say $out "Added new system preference 'OPACVirtualCard'";
(-)a/opac/opac-virtual-card.pl (-13 / +11 lines)
Lines 19-57 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use CGI qw ( -utf8 );
22
use CGI        qw ( -utf8 );
23
use C4::Auth qw( get_template_and_user );
23
use C4::Auth   qw( get_template_and_user );
24
use C4::Output qw( output_html_with_http_headers );
24
use C4::Output qw( output_html_with_http_headers );
25
use Koha::Libraries;
25
use Koha::Libraries;
26
use Koha::Patrons;
26
use Koha::Patrons;
27
27
28
29
my $query = CGI->new;
28
my $query = CGI->new;
30
29
31
# if OPACVirtualCard is disabled, leave immediately
30
# if OPACVirtualCard is disabled, leave immediately
32
if ( ! C4::Context->preference('OPACVirtualCard') ) {
31
if ( !C4::Context->preference('OPACVirtualCard') ) {
33
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
32
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
34
    exit;
33
    exit;
35
}
34
}
36
35
37
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
38
    {
37
    {
39
        template_name   => "opac-virtual-card.tt",
38
        template_name => "opac-virtual-card.tt",
40
        query           => $query,
39
        query         => $query,
41
        type            => "opac",
40
        type          => "opac",
42
    }
41
    }
43
);
42
);
44
43
45
my $patron = Koha::Patrons->find( $borrowernumber );
44
my $patron = Koha::Patrons->find($borrowernumber);
45
46
# Find and display patron image if allowed
46
# Find and display patron image if allowed
47
if (C4::Context->preference('OPACpatronimages')) {
47
if ( C4::Context->preference('OPACpatronimages') ) {
48
        $template->param( display_patron_image => 1 ) if $patron->image;
48
    $template->param( display_patron_image => 1 ) if $patron->image;
49
    }
49
}
50
50
51
$template->param(
51
$template->param(
52
    virtualcardview => 1,
52
    virtualcardview => 1,
53
    patron          => $patron,
53
    patron          => $patron,
54
);
54
);
55
55
56
57
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
56
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
58
- 

Return to bug 26777