Bug 8315 - remove use C4::* version
[koha.git] / C4 / Patroncards / Patroncard.pm
index 8aef3cd..339b969 100644 (file)
@@ -13,9 +13,9 @@ package C4::Patroncards::Patroncard;
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
 use warnings;
@@ -24,12 +24,12 @@ use autouse 'Data::Dumper' => qw(Dumper);
 use Text::Wrap qw(wrap);
 #use Font::TTFMetrics;
 
-use C4::Creators::Lib 1.000000 qw(get_font_types);
-use C4::Creators::PDF 1.000000 qw(StrWidth);
-use C4::Patroncards::Lib 1.000000 qw(unpack_UTF8 text_alignment leading box get_borrower_attributes);
+use C4::Creators::Lib qw(get_font_types);
+use C4::Creators::PDF qw(StrWidth);
+use C4::Patroncards::Lib qw(unpack_UTF8 text_alignment leading box get_borrower_attributes);
 
 BEGIN {
-    use version; our $VERSION = qv('1.0.0_1');
+    use version; our $VERSION = qv('3.07.00.049');
 }
 
 sub new {
@@ -56,13 +56,13 @@ sub draw_barcode {
     my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
     my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 1% of the label height
     _draw_barcode(      $self,
-                        llx     => $self->{'llx'} + $self->{'layout'}->{'barcode'}->{'llx'},
-                        lly     => $self->{'lly'} + $self->{'layout'}->{'barcode'}->{'lly'},
+                        llx     => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'},
+                        lly     => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'},
                         width   => $barcode_width,
                         y_scale_factor  => $barcode_y_scale_factor,
-                        barcode_type    => $self->{'layout'}->{'barcode'}->{'type'},
-                        barcode_data    => $self->{'layout'}->{'barcode'}->{'data'},
-                        text    => $self->{'layout'}->{'barcode'}->{'text_print'},
+                        barcode_type    => $self->{'layout'}->{'barcode'}->[0]->{'type'},
+                        barcode_data    => $self->{'layout'}->{'barcode'}->[0]->{'data'},
+                        text    => $self->{'layout'}->{'barcode'}->[0]->{'text_print'},
     );
 }
 
@@ -83,8 +83,8 @@ sub draw_text {
     my ($self, $pdf, %params) = @_;
     warn sprintf('No pdf object passed in.') and return -1 if !$pdf;
     my @card_text = ();
-    my $text = $self->{'layout'}->{'text'};
-    return unless (ref($text) eq 'ARRAY'); # just in case there is not text
+    return unless (ref($self->{'layout'}->{'text'}) eq 'ARRAY'); # just in case there is not text
+    my $text = [@{$self->{'layout'}->{'text'}}]; # make a copy of the arrayref *not* simply a pointer
     while (scalar @$text) {
         my $line = shift @$text;
         my $parse_line = $line;
@@ -127,7 +127,7 @@ sub draw_text {
             while (1) {
 #                $line =~ m/^.*(\s\b.*\b\s*|\s&|\<\b.*\b\>)$/; # original regexp... can be removed after dev stage is over
                 $line =~ m/^.*(\s.*\s*|\s&|\<.*\>)$/;
-                warn sprintf('Line wrap failed. DEBUG INFO: Data: \'%s\'\n Method: C4::Patroncards->draw_text Additional Information: Line wrap regexp failed. (Please file in this information in a bug report at http://bugs.koha.org', $line) and last WRAP_LINES if !$1;
+                warn sprintf('Line wrap failed. DEBUG INFO: Data: \'%s\'\n Method: C4::Patroncards->draw_text Additional Information: Line wrap regexp failed. (Please file in this information in a bug report at http://bugs.koha-community.org', $line) and last WRAP_LINES if !$1;
                 $trim = $1 . $trim;
                 $line =~ s/$1//;
                 $string_width = C4::Creators::PDF->StrWidth($line, $text_attribs->{'font'}, $text_attribs->{'font_size'});
@@ -190,7 +190,7 @@ sub draw_image {
     my $images = $self->{'layout'}->{'images'};
     PROCESS_IMAGES:
     foreach my $image (keys %$images) {
-        next PROCESS_IMAGES if $images->{$image}->{'data_source'}->{'image_source'} eq 'none';
+        next PROCESS_IMAGES if $images->{$image}->{'data_source'}->[0]->{'image_source'} eq 'none';
         my $Tx = $self->{'llx'} + $images->{$image}->{'Tx'};
         my $Ty = $self->{'lly'} + $images->{$image}->{'Ty'};
         warn sprintf('No image passed in.') and next if !$images->{$image}->{'data'};