Merge remote-tracking branch 'origin/new/bug_8062'
[koha-ffzg.git] / C4 / Barcodes / PrinterConfig.pm
index d90cd96..25f48eb 100644 (file)
@@ -16,6 +16,7 @@ package C4::Barcodes::PrinterConfig;
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+#use warnings; FIXME - Bug 2505
 use vars qw($VERSION @EXPORT);
 
 use PDF::API2;
@@ -23,7 +24,7 @@ use PDF::API2::Page;
 
 BEGIN {
        # set the version for version checking
-       $VERSION = 0.02;
+    $VERSION = 3.07.00.049;
        require Exporter;
        @EXPORT = qw(&labelsPage &getLabelPosition setPositionsForX setPositionsForY);
 }
@@ -34,7 +35,7 @@ C4::Barcodes::PrinterConfig - Koha module dealing with labels in a PDF.
 
 =head1 SYNOPSIS
 
-       use C4::Barcodes::PrinterConfig;
+use C4::Barcodes::PrinterConfig;
 
 =head1 DESCRIPTION
 
@@ -44,17 +45,21 @@ environment of the pdf file.
 
 =head1 FUNCTIONS
 
-=over 2
+=head2 my @positionsForX;
 
-=cut
+Takes all the X positions of the pdf file.
+
+=head2 my @positionsForY; 
+
+Takes all the Y positions of the pdf file.
 
-my @positionsForX; # Takes all the X positions of the pdf file.
-my @positionsForY; # Takes all the Y positions of the pdf file.
-my $firstLabel = 1; # Test if the label passed as a parameter is the first label to be printed into the pdf file.
+=head2 my $firstLabel = 1; 
 
-=item setPositionsForX
+Test if the label passed as a parameter is the first label to be printed into the pdf file.
 
-       C4::Barcodes::PrinterConfig::setPositionsForX($marginLeft, $labelWidth, $columns, $pageType);
+=head2 setPositionsForX
+
+  C4::Barcodes::PrinterConfig::setPositionsForX($marginLeft, $labelWidth, $columns, $pageType);
 
 Calculate and stores all the X positions across the pdf page.
 
@@ -67,7 +72,12 @@ C<$columns> Indicates how many columns do you want in your page type.
 C<$pageType> Page type to print (eg: a4, legal, etc).
 
 =cut
-#'
+
+# Globals used by the functions
+my @positionsForX;
+my @positionsForY;
+my $firstLabel = 1;
+
 sub setPositionsForX {
        my ($marginLeft, $labelWidth, $columns, $pageType) = @_;
        my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
@@ -81,9 +91,9 @@ sub setPositionsForX {
        @positionsForX = @positions;
 }
 
-=item setPositionsForY
+=head2 setPositionsForY
 
-       C4::Barcodes::PrinterConfig::setPositionsForY($marginBottom, $labelHeigth, $rows, $pageType);
+  C4::Barcodes::PrinterConfig::setPositionsForY($marginBottom, $labelHeigth, $rows, $pageType);
 
 Calculate and stores all tha Y positions across the pdf page.
 
@@ -96,7 +106,7 @@ C<$rows> Indicates how many rows do you want in your page type.
 C<$pageType> Page type to print (eg: a4, legal, etc).
 
 =cut
-#'
+
 sub setPositionsForY {
        my ($marginBottom, $labelHeigth, $rows, $pageType) = @_;
        my $defaultDpi = 72/25.4; # By default we know 25.4 mm -> 1 inch -> 72 dots per inch
@@ -110,16 +120,10 @@ sub setPositionsForY {
        @positionsForY = @positions;
 }
 
-=item getLabelPosition
+=head2 getLabelPosition
 
-       (my $x, my $y, $pdfObject, $pageObject, $gfxObject, $textObject, $coreObject, $labelPosition) = 
-                                       C4::Barcodes::PrinterConfig::getLabelPosition($labelPosition, 
-                                                                                                                                 $pdfObject, 
-                                                                                                                                 $page,
-                                                                                                                                 $gfx,
-                                                                                                                                 $text,
-                                                                                                                                 $fontObject,
-                                                                                                                                 $pageType);   
+  (my $x, my $y, $pdfObject, $pageObject, $gfxObject, $textObject, $coreObject, $labelPosition) = 
+     C4::Barcodes::PrinterConfig::getLabelPosition($labelPosition, $pdfObject, $page, $gfx, $text, $fontObject, $pageType);    
 
 Return the (x,y) position of the label that you are going to print considering the environment.
 
@@ -138,7 +142,7 @@ C<$fontObject> The font object
 C<$pageType> Page type to print (eg: a4, legal, etc).
 
 =cut
-#'
+
 sub getLabelPosition {
        my ($labelNum, $pdf, $page, $gfxObject, $textObject, $fontObject, $pageType) = @_;
        my $indexX = $labelNum % @positionsForX;
@@ -167,9 +171,9 @@ sub getLabelPosition {
        return ($positionsForX[$indexX], $positionsForY[$indexY], $pdf, $page, $gfxObject, $textObject, $fontObject, $labelNum);
 }
 
-=item labelsPage
+=head2 labelsPage
 
-       my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($rows, $columns);
+  my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($rows, $columns);
 
 This function will help you to build the labels panel, where you can choose
 wich label position do you want to start the printer process.
@@ -179,7 +183,7 @@ C<$rows> Indicates how many rows do you want in your page type.
 C<$columns> Indicates how many rows do you want in your page type.
 
 =cut
-#'
+
 sub labelsPage{
        my ($rows, $columns) = @_;
        my @pageType;
@@ -212,8 +216,6 @@ sub labelsPage{
 
 __END__
 
-=back
-
 =head1 AUTHOR
 
 Koha Physics Library UNLP <matias_veleda@hotmail.com>