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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-virtual-card.tt (-1 / +1 lines)
Lines 42-48 Link Here
42
                            </div>
42
                            </div>
43
                        [% END %]
43
                        [% END %]
44
                        <div id="barcode-container">
44
                        <div id="barcode-container">
45
                            <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]"></svg>
45
                            <svg id="patron-barcode" data-barcode="[% patron.cardnumber | html %]" data-barcode-format="[% barcode_format | html %]"></svg>
46
                        </div>
46
                        </div>
47
                        <div id="lib-container">
47
                        <div id="lib-container">
48
                            <p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p>
48
                            <p id="patron-lib"><strong>Library:</strong> [% Branches.GetName( patron.branchcode ) | html %]</p>
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js (-10 / +19 lines)
Lines 1-11 Link Here
1
document.addEventListener("DOMContentLoaded", function() {
1
document.addEventListener("DOMContentLoaded", function() {
2
    var barcodeNumber = document.getElementById("patron-barcode").dataset.barcode;
2
    const svgElement = document.getElementById('patron-barcode');
3
    JsBarcode("#patron-barcode", barcodeNumber, {
3
    var barcodeNumber = svgElement.dataset.barcode;
4
        format: "CODE39",
4
    var barcodeFormat = svgElement.dataset.barcodeFormat;
5
        lineColor: "#000",
5
6
        width: 2,
6
    try {
7
        height: 100,
7
        JsBarcode("#patron-barcode", barcodeNumber, {
8
        displayValue: false,
8
            format: barcodeFormat,
9
        margin: 0
9
            lineColor: "#000",
10
    });
10
            width: 2,
11
});
11
            height: 100,
12
            displayValue: false,
13
            margin: 0
14
        });
15
    } catch (error) {
16
        // Handle the error by displaying a message on the screen
17
        console.error(error);
18
        document.getElementById('barcode-container').innerHTML = `<p><strong>Error: </strong>"${error}"</p>`;
19
    }
20
});
(-)a/opac/opac-virtual-card.pl (-1 / +4 lines)
Lines 48-56 if ( C4::Context->preference('OPACpatronimages') ) { Link Here
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
# Get the desired barcode format
52
my $barcode_format = C4::Context->preference('OPACVirtualCardBarcode');
53
51
$template->param(
54
$template->param(
52
    virtualcardview => 1,
55
    virtualcardview => 1,
53
    patron          => $patron,
56
    patron          => $patron,
57
    barcode_format  => $barcode_format,
54
);
58
);
55
59
56
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
60
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
57
- 

Return to bug 26777