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

(-)a/C4/Labels/Label.pm (-2 / +1 lines)
Lines 503-516 sub barcode { Link Here
503
    $params{'barcode_data'} = _get_label_item($self->{'item_number'}, 1) if !$params{'barcode_data'};
503
    $params{'barcode_data'} = _get_label_item($self->{'item_number'}, 1) if !$params{'barcode_data'};
504
    $params{'barcode_type'} = $self->{'barcode_type'} if !$params{'barcode_type'};
504
    $params{'barcode_type'} = $self->{'barcode_type'} if !$params{'barcode_type'};
505
505
506
    my $enableBarcodePadding = C4::Context->preference("BarcodePaddingEnable");
507
    my $paddingCharacter = C4::Context->preference("BarcodePaddingCharacter") || 0;
506
    my $paddingCharacter = C4::Context->preference("BarcodePaddingCharacter") || 0;
508
    my $paddingLength = C4::Context->preference("BarcodePaddingLength") || 0;
507
    my $paddingLength = C4::Context->preference("BarcodePaddingLength") || 0;
509
508
510
    if (length($paddingCharacter) > 1) {
509
    if (length($paddingCharacter) > 1) {
511
        $paddingCharacter = substr $paddingCharacter, 0, 1;
510
        $paddingCharacter = substr $paddingCharacter, 0, 1;
512
    }
511
    }
513
    if ($enableBarcodePadding and length($params{'barcode_data'}) < $paddingLength) {
512
    if (length($params{'barcode_data'}) < $paddingLength) {
514
        $params{'barcode_data'} = ($paddingCharacter x ($paddingLength - length($params{'barcode_data'}))) . $params{'barcode_data'};
513
        $params{'barcode_data'} = ($paddingCharacter x ($paddingLength - length($params{'barcode_data'}))) . $params{'barcode_data'};
515
    }
514
    }
516
515
(-)a/installer/data/mysql/atomicupdate/Bug19325-BarcodePadding.syspref.sql (-3 / +2 lines)
Lines 1-4 Link Here
1
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES
1
INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES
2
('BarcodePaddingEnable','0','Enables padding the barcode when printing to PDF',NULL,'YesNo'),
2
('BarcodePaddingLength','0','The total length of the padded barcode. Padding is disabled when this value equals 0.',NULL,'Integer'),
3
('BarcodePaddingLength','0','The total length of the padded barcode',NULL,'Integer'),
3
('BarcodePaddingCharacter','0','The character to use when padding. Only string[0] is used.',NULL,'string');
4
('BarcodePaddingCharacter','0','The character to use when padding. Only string[0] is used.',NULL,'string');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref (-7 / +2 lines)
Lines 40-53 Tools: Link Here
40
            - reports on the Saved Reports page.
40
            - reports on the Saved Reports page.
41
    Labels:
41
    Labels:
42
         -
42
         -
43
            - pref: BarcodePaddingEnable
43
            - "Pads the length of printed barcodes up to a width of"
44
              choices:
45
                yes: "Enable"
46
                no: "Disable"
47
            - "padding the length of printed barcodes up to length"
48
            - pref: BarcodePaddingLength
44
            - pref: BarcodePaddingLength
49
              class: integer
45
              class: integer
50
            - " with the character "
46
            - " with the character "
51
            - pref: BarcodePaddingCharacter
47
            - pref: BarcodePaddingCharacter
52
              class: integer
48
              class: integer
53
            - " This has no effect if the barcode is longer than length. Length and character default to 0 if fields are empty."
49
            - "<br/>Length and character default to 0 if fields are empty. This preference has no effect if the original barcode is longer than BarcodePaddingLength."
54
- 

Return to bug 19325