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

(-)a/C4/Patroncards/Patroncard.pm (+57 lines)
Lines 69-74 sub draw_barcode { Link Here
69
sub draw_guide_box {
69
sub draw_guide_box {
70
    my ($self, $pdf) = @_;
70
    my ($self, $pdf) = @_;
71
    warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
71
    warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
72
72
    my $obj_stream = "q\n";                            # save the graphic state
73
    my $obj_stream = "q\n";                            # save the graphic state
73
    $obj_stream .= "0.5 w\n";                          # border line width
74
    $obj_stream .= "0.5 w\n";                          # border line width
74
    $obj_stream .= "1.0 0.0 0.0  RG\n";                # border color red
75
    $obj_stream .= "1.0 0.0 0.0  RG\n";                # border color red
Lines 79-84 sub draw_guide_box { Link Here
79
    $pdf->Add($obj_stream);
80
    $pdf->Add($obj_stream);
80
}
81
}
81
82
83
sub draw_guide_grid {
84
    my ($self, $pdf) = @_;
85
    warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
86
87
    my $obj_stream = "q\n";   # save the graphic state
88
89
    my $x = $self->{'llx'};
90
    my $y = $self->{'lly'};
91
92
    my $cnt = 0;
93
    for ( $x = $self->{'llx'} ; $x <= $self->{'llx'} + $self->{'width'}; $x+=10) {
94
        my $xx = $x;
95
        my $yy = $y + $self->{'height'};
96
        if ( $cnt % 5 ) {
97
            $obj_stream .= "0.0 1.0 1.0  RG\n";
98
            $obj_stream .= "0 w\n";
99
        } else {
100
            $obj_stream .= "0.0 0.0 1.0  RG\n";
101
            $obj_stream .= "0 w\n";
102
        }
103
        $cnt ++;
104
105
        $obj_stream .= "$x $y m\n";
106
        $obj_stream .= "$xx $yy l\n";
107
108
        $obj_stream .= "s\n";
109
    }
110
111
    $x = $self->{'llx'};
112
    $y = $self->{'lly'};
113
    $cnt = 0;
114
    for ( $y = $self->{'lly'}; $y <= $self->{'lly'} + $self->{'height'}; $y+=10) {
115
116
        my $xx = $x + $self->{'width'};
117
        my $yy = $y;
118
119
        if ( $cnt % 5 ) {
120
            $obj_stream .= "0.0 1.0 1.0  RG\n";
121
            $obj_stream .= "0 w\n";
122
        } else {
123
            $obj_stream .= "0.0 0.0 1.0  RG\n";
124
            $obj_stream .= "0 w\n";
125
        }
126
        $cnt ++;
127
128
        $obj_stream .= "$x $y m\n";
129
        $obj_stream .= "$xx $yy l\n";
130
        $obj_stream .= "s\n";
131
    }
132
133
    $obj_stream .= "Q\n"; # restore the graphic state
134
135
    $pdf->Add($obj_stream);
136
}
137
138
82
sub draw_text {
139
sub draw_text {
83
    my ($self, $pdf, %params) = @_;
140
    my ($self, $pdf, %params) = @_;
84
    warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
141
    warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt (+10 lines)
Lines 176-181 Link Here
176
                                    <input type="radio" name="guide_box" id="guide_box" value="0" checked="checked" />Off
176
                                    <input type="radio" name="guide_box" id="guide_box" value="0" checked="checked" />Off
177
                                    [% END %]
177
                                    [% END %]
178
                                </li>
178
                                </li>
179
                                <li>
180
                                    <label for="guide_grid">Guide grid:</label>
181
                                    [% IF ( guide_grid ) %]
182
                                    <input type="radio" name="guide_grid" id="guide_grid" value="1" checked="checked" />On
183
                                    <input type="radio" name="guide_grid" id="guide_grid" value="0" />Off
184
                                    [% ELSE %]
185
                                    <input type="radio" name="guide_grid" id="guide_grid" value="1" />On
186
                                    <input type="radio" name="guide_grid" id="guide_grid" value="0" checked="checked" />Off
187
                                    [% END %]
188
                                </li>
179
                                </ol>
189
                                </ol>
180
                                </fieldset>
190
                                </fieldset>
181
                                </li>
191
                                </li>
(-)a/patroncards/create-pdf.pl (+1 lines)
Lines 147-152 foreach my $item (@{$items}) { Link Here
147
        );
147
        );
148
148
149
        $patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
149
        $patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
150
        $patron_card->draw_guide_grid($pdf) if $layout_xml->{'guide_grid'};
150
        $patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
151
        $patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
151
152
152
#       Do image foo and place binary image data into layout hash
153
#       Do image foo and place binary image data into layout hash
(-)a/patroncards/edit-layout.pl (-1 / +2 lines)
Lines 156-161 if ($op eq 'edit') { Link Here
156
            layout_name     => $layout->get_attr('layout_name'),
156
            layout_name     => $layout->get_attr('layout_name'),
157
            page_side       => ($layout_xml->{'page_side'} eq 'F' ? 0 : 1),
157
            page_side       => ($layout_xml->{'page_side'} eq 'F' ? 0 : 1),
158
            guide_box       => $layout_xml->{'guide_box'},
158
            guide_box       => $layout_xml->{'guide_box'},
159
            guide_grid      => $layout_xml->{'guide_grid'},
159
            units           => $units,
160
            units           => $units,
160
            @barcode,
161
            @barcode,
161
            barcode_type    => _set_selected($layout_xml->{'barcode'}->[0]->{'type'}, $barcode_types),
162
            barcode_type    => _set_selected($layout_xml->{'barcode'}->[0]->{'type'}, $barcode_types),
Lines 218-223 elsif ($op eq 'save') { Link Here
218
            $layout->{'units'} = $cgi->param($parameter) if $parameter eq 'units';
219
            $layout->{'units'} = $cgi->param($parameter) if $parameter eq 'units';
219
            $layout->{'page_side'} = $cgi->param($parameter) if $parameter eq 'page_side';
220
            $layout->{'page_side'} = $cgi->param($parameter) if $parameter eq 'page_side';
220
            $layout->{'guide_box'} = $cgi->param($parameter) if $parameter eq 'guide_box';
221
            $layout->{'guide_box'} = $cgi->param($parameter) if $parameter eq 'guide_box';
222
            $layout->{'guide_grid'} = $cgi->param($parameter) if $parameter eq 'guide_grid';
221
        }
223
        }
222
    }
224
    }
223
    $layout->{'text'} = $text_lines;
225
    $layout->{'text'} = $text_lines;
224
- 

Return to bug 18541