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

(-)a/C4/Patroncards/Patroncard.pm (-5 / +8 lines)
Lines 45-50 sub new { Link Here
45
        width                   => $params{'width'},
45
        width                   => $params{'width'},
46
        layout                  => $params{'layout'},
46
        layout                  => $params{'layout'},
47
        text_wrap_cols          => $params{'text_wrap_cols'},
47
        text_wrap_cols          => $params{'text_wrap_cols'},
48
        barcode_height_scale    => $params{'layout'}->{'barcode'}[0]->{'height_scale'} || 0.01,
49
        barcode_width_scale     => $params{'layout'}->{'barcode'}[0]->{'width_scale'} || 0.8,
48
    };
50
    };
49
    bless ($self, $type);
51
    bless ($self, $type);
50
    return $self;
52
    return $self;
Lines 52-65 sub new { Link Here
52
54
53
sub draw_barcode {
55
sub draw_barcode {
54
    my ($self, $pdf) = @_;
56
    my ($self, $pdf) = @_;
55
#FIXME: We do some scaling foo on the barcode here which probably should be done by the one invoking draw_barcode
57
    # Default values for barcode scaling are set in constructor to work with pre-existing installations
56
    my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
58
    my $barcode_height_scale = $self->{'barcode_height_scale'};
57
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 1% of the label height
59
    my $barcode_width_scale = $self->{'barcode_width_scale'};
60
58
    _draw_barcode(      $self,
61
    _draw_barcode(      $self,
59
                        llx     => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'},
62
                        llx     => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'},
60
                        lly     => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'},
63
                        lly     => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'},
61
                        width   => $barcode_width,
64
                        width   => $self->{'width'} * $barcode_width_scale,
62
                        y_scale_factor  => $barcode_y_scale_factor,
65
                        y_scale_factor  => $self->{'height'} * $barcode_height_scale,
63
                        barcode_type    => $self->{'layout'}->{'barcode'}->[0]->{'type'},
66
                        barcode_type    => $self->{'layout'}->{'barcode'}->[0]->{'type'},
64
                        barcode_data    => $self->{'layout'}->{'barcode'}->[0]->{'data'},
67
                        barcode_data    => $self->{'layout'}->{'barcode'}->[0]->{'data'},
65
                        text    => $self->{'layout'}->{'barcode'}->[0]->{'text_print'},
68
                        text    => $self->{'layout'}->{'barcode'}->[0]->{'text_print'},
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt (+8 lines)
Lines 384-389 Link Here
384
                                    <input type="text" name="barcode_lly" id="barcode_lly" size="2" value="[% barcode_lly |html %]" />
384
                                    <input type="text" name="barcode_lly" id="barcode_lly" size="2" value="[% barcode_lly |html %]" />
385
                                </li>
385
                                </li>
386
                                <li>
386
                                <li>
387
                                    <label for="barcode_height_scale">Scale height (relative to card): </label>
388
                                    <input type="text" name="barcode_height_scale" id="barcode_height_scale" size="2" value="[% barcode_height_scale |html %]" />
389
                                </li>
390
                                <li>
391
                                    <label for="barcode_width_scale">Scale width (relative to card): </label>
392
                                    <input type="text" name="barcode_width_scale" id="barcode_width_scale" size="2" value="[% barcode_width_scale |html %]" />
393
                                </li>
394
                                <li>
387
                                    <label for="barcode_type">Barcode type: </label>
395
                                    <label for="barcode_type">Barcode type: </label>
388
                                    <select name="barcode_type" id="barcode_type">
396
                                    <select name="barcode_type" id="barcode_type">
389
                                        [% FOREACH barcode_typ IN barcode_type %]
397
                                        [% FOREACH barcode_typ IN barcode_type %]
(-)a/patroncards/create-pdf.pl (-1 / +2 lines)
Lines 129-136 foreach my $item (@{$items}) { Link Here
129
                height                  => $pc_template->get_attr('label_height'), # of the card
129
                height                  => $pc_template->get_attr('label_height'), # of the card
130
                width                   => $pc_template->get_attr('label_width'),
130
                width                   => $pc_template->get_attr('label_width'),
131
                layout                  => $layout_xml,
131
                layout                  => $layout_xml,
132
                text_wrap_cols          => 30, #FIXME: hardcoded
132
                text_wrap_cols          => 30, #FIXME: hardcoded,
133
        );
133
        );
134
134
        $patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
135
        $patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
135
        $patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
136
        $patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
136
137
(-)a/patroncards/edit-layout.pl (-1 / +2 lines)
Lines 96-101 if ($op eq 'edit') { Link Here
96
            push @text_fields, (
96
            push @text_fields, (
97
                                "field_" . $field_number . "_llx" => $field_params->{'llx'},
97
                                "field_" . $field_number . "_llx" => $field_params->{'llx'},
98
                                "field_" . $field_number . "_lly" => $field_params->{'lly'},
98
                                "field_" . $field_number . "_lly" => $field_params->{'lly'},
99
                                "field_" . $field_number . "_height_scale" => $field_params->{'height_scale'},
100
                                "field_" . $field_number . "_width_scale" => $field_params->{'width_scale'},
99
                                "field_" . $field_number . "_font" => _set_selected($field_params->{'font'}, $font_types),
101
                                "field_" . $field_number . "_font" => _set_selected($field_params->{'font'}, $font_types),
100
                                "field_" . $field_number . "_font_size" => $field_params->{'font_size'},
102
                                "field_" . $field_number . "_font_size" => $field_params->{'font_size'},
101
                                "field_" . $field_number . "_text_alignment" => _set_selected($field_params->{'text_alignment'}, $alignment_types),
103
                                "field_" . $field_number . "_text_alignment" => _set_selected($field_params->{'text_alignment'}, $alignment_types),
102
- 

Return to bug 14107