koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/barcodes barcodes.pl barcodesGenerator.pl ... [rel_2_2]


From: Mason James
Subject: [Koha-cvs] koha/barcodes barcodes.pl barcodesGenerator.pl ... [rel_2_2]
Date: Mon, 16 Jul 2007 21:17:12 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Mason James <sushi>     07/07/16 21:17:11

Modified files:
        barcodes       : barcodes.pl barcodesGenerator.pl 
                         label-create-template.pl label-edit-template.pl 
                         label-item-search.pl label-manager.pl 
                         label-print-pdf.pl label-save-template.pl 
                         label-templates.pl pdfViewer.pl 
                         printerConfig.pl 

Log message:
        rewinding rel_2_2 barcodes back to pre-july07 LibLime dev work.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/barcodes.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.3.2.4&r2=1.3.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/barcodesGenerator.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.4&r2=1.4.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-create-template.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.4.3&r2=1.1.4.4
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-edit-template.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.4.2&r2=1.1.4.3
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-item-search.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.4&r2=1.1.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-manager.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.5&r2=1.1.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-print-pdf.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.2.17&r2=1.1.2.18
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-save-template.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.4.3&r2=1.1.4.4
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-templates.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.4.3&r2=1.1.4.4
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/pdfViewer.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.1&r2=1.2.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/printerConfig.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.3&r2=1.2.2.4

Patches:
Index: barcodes.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/barcodes.pl,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- barcodes.pl 5 Feb 2006 21:59:21 -0000       1.3.2.4
+++ barcodes.pl 16 Jul 2007 21:17:09 -0000      1.3.2.5
@@ -30,17 +30,16 @@
 use C4::Context;
 use C4::Barcodes::PrinterConfig;
 
-
-
 # This function returns the path to deal with the correct files, considering
 # templates set and language.
 sub getPath {
        my $type = shift @_;
        my $templatesSet = C4::Context->preference('template');
        my $lang = C4::Context->preference('opaclanguages');
-       if ($type eq "intranet") {
+    if ( $type eq "intranet" ) {
                return 
"$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
-       } else {
+    }
+    else {
                return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
        }
 }
@@ -63,85 +62,104 @@
 # Save settings to a configuration file. It delete previous configuration 
settings.
 sub saveConfToFile {
        my $fileName = shift @_;
-       my %keyValues = %{shift @_};
+    my %keyValues = %{ shift @_ };
        my $i;
        open FILE, ">$fileName";                        
        my $i;
-       foreach $i (keys(%keyValues)) {
-    print FILE $i." = ".$keyValues{$i}."\n";
+    foreach $i ( keys(%keyValues) ) {
+        print FILE $i . " = " . $keyValues{$i} . "\n";
        }
        close FILE;
 }
 
 # Load the config file.
-my $filenameConf = 
&getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
+my $filenameConf =
+  &getPath("intranet") . "/includes/labelConfig/itemsLabelConfig.conf";
 my %labelConfig = &loadConfFromFile($filenameConf);
 
 my $input = new CGI;
+
 # Defines type of page to use in the printer process
-my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($labelConfig{'rows'}, 
$labelConfig{'columns'});
+my @labelTable =
+  C4::Barcodes::PrinterConfig::labelsPage( $labelConfig{'rows'},
+    $labelConfig{'columns'} );
 
 # It creates a list of posible intervals to choose codes to generate
-my %list = ('continuous' => 'Continuous Range of items', 'individuals' => 
'Individual Codes');
+my %list = (
+    'continuous'  => 'Continuous Range of items',
+    'individuals' => 'Individual Codes'
+);
 my @listValues = keys(%list);
-my $rangeType = CGI::scrolling_list(-name => 'rangeType',
+my $rangeType  = CGI::scrolling_list(
+    -name     => 'rangeType',
                                        -values => address@hidden,
                                                -labels => \%list,
                                                -size => 1,
                                                                        
-default => ['continuous'],
                                                -multiple => 0,
                                                                        -id => 
"rangeType",
-                                                                       
-onChange => "changeRange(this)");
+    -onChange => "changeRange(this)"
+);
+
 # It creates a list of posible standard codifications. First checks if the 
user has just added a new code.
-if ($input->param('addCode')) {
+if ( $input->param('addCode') ) {
        my $newCountryName = $input->param('countryName');
        my $newCountryCode = $input->param('countryCode'); 
 
-       my $countryCodesFilename = 
&getPath("intranet")."/includes/countryCodes/countryCodes.dat";
+    my $countryCodesFilename =
+      &getPath("intranet") . "/includes/countryCodes/countryCodes.dat";
        open COUNTRY_CODES, ">>$countryCodesFilename";                  
-    print COUNTRY_CODES $newCountryCode." = ".$newCountryName."\n";
+    print COUNTRY_CODES $newCountryCode . " = " . $newCountryName . "\n";
        close COUNTRY_CODES;
 }
 
 # Takes the country codes from a file and use them to set the country list.
-my $countryCodes = 
&getPath("intranet")."/includes/countryCodes/countryCodes.dat";
+my $countryCodes =
+  &getPath("intranet") . "/includes/countryCodes/countryCodes.dat";
 my %list = &loadConfFromFile($countryCodes);
 @listValues = keys(%list);
-my $number_system = CGI::scrolling_list(-name => 'numbersystem',
+my $number_system = CGI::scrolling_list(
+    -name     => 'numbersystem',
                                            -values => address@hidden,
                                                    -labels   => \%list,
                                                    -size     => 1,
-                                                   -multiple => 0);
+    -multiple => 0
+);
 
 # Set the script name
 my $script_name = "/cgi-bin/koha/barcodes/barcodesGenerator.pl";
 
-
 # Get the template to use
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "barcodes/barcodes.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "barcodes/barcodes.tmpl",
                                         type => "intranet",
                                         query => $input,
                                         authnotrequired => 0,
-                                        flagsrequired => {parameters => 1},
+        flagsrequired   => { parameters => 1 },
                                                 debug => 1,
-                                      });
+    }
+);
 
 # Replace the template values with the real ones
-$template->param(SCRIPT_NAME => $script_name);
-$template->param(NUMBER_SYSTEM => $number_system);
-$template->param(PAGES => $labelConfig{'pageType'});
-$template->param(RANGE_TYPE => $rangeType);
-$template->param(LABEL_TABLE => address@hidden);
-$template->param(COL_SPAN => $labelConfig{'columns'});
-if ($input->param('error')) {
-       $template->param(ERROR => 1);
-} else {
-       $template->param(ERROR => 0);
+$template->param( SCRIPT_NAME   => $script_name );
+$template->param( NUMBER_SYSTEM => $number_system );
+$template->param( PAGES         => $labelConfig{'pageType'} );
+$template->param( RANGE_TYPE    => $rangeType );
+$template->param( LABEL_TABLE   => address@hidden );
+$template->param( COL_SPAN      => $labelConfig{'columns'} );
+if ( $input->param('error') ) {
+    $template->param( ERROR => 1 );
 }
-$template->param(intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+else {
+    $template->param( ERROR => 0 );
+}
+$template->param(
+    intranetcolorstylesheet =>
+      C4::Context->preference("intranetcolorstylesheet"),
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
                IntranetNav => C4::Context->preference("IntranetNav"),
-               );
+);
+
 # Shows the template with the real values replaced
 output_html_with_http_headers $input, $cookie, $template->output;

Index: barcodesGenerator.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/barcodesGenerator.pl,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- barcodesGenerator.pl        8 Nov 2004 19:47:16 -0000       1.4
+++ barcodesGenerator.pl        16 Jul 2007 21:17:10 -0000      1.4.2.1
@@ -34,16 +34,16 @@
 use C4::Barcodes::PrinterConfig;
 use Time::localtime; 
 
-
 # This function returns the path to deal with the correct files, considering
 # templates set and language.
 sub getPath {
        my $type = shift @_;
        my $templatesSet = C4::Context->preference('template');
        my $lang = C4::Context->preference('opaclanguages');
-       if ($type eq "intranet") {
+    if ( $type eq "intranet" ) {
                return 
"$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
-       } else {
+    }
+    else {
                return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
        }
 }
@@ -66,18 +66,19 @@
 # Save settings to a configuration file. It delete previous configuration 
settings.
 sub saveConfToFile {
        my $fileName = shift @_;
-       my %keyValues = %{shift @_};
+    my %keyValues = %{ shift @_ };
        my $i;
        open FILE, ">$fileName";                        
        my $i;
-       foreach $i (keys(%keyValues)) {
-    print FILE $i." = ".$keyValues{$i}."\n";
+    foreach $i ( keys(%keyValues) ) {
+        print FILE $i . " = " . $keyValues{$i} . "\n";
        }
        close FILE;
 }
 
 # Load the config file.
-my $filenameConf = 
&getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
+my $filenameConf =
+  &getPath("intranet") . "/includes/labelConfig/itemsLabelConfig.conf";
 my %labelConfig = &loadConfFromFile($filenameConf);
 
 # Creates a CGI object and take its parameters
@@ -99,18 +100,20 @@
     my $sum = 0;
          my $odd_parity = 1;
     my $i;
-    for ($i = length($code) - 1; $i >= 0; $i--){
-          if ( $odd_parity ) {
-                 $sum = $sum + ( 3 * substr($code, $i, 1) );
-     } else {
-                       $sum = $sum + substr($code, $i, 1); }
+        for ( $i = length($code) - 1 ; $i >= 0 ; $i-- ) {
+            if ($odd_parity) {
+                $sum = $sum + ( 3 * substr( $code, $i, 1 ) );
+            }
+            else {
+                $sum = $sum + substr( $code, $i, 1 );
+            }
                  $odd_parity = !$odd_parity;
           }
-    my $check_digit = 10 - ($sum%10);
-       if ($check_digit==10) {
-               $check_digit=0;
+        my $check_digit = 10 - ( $sum % 10 );
+        if ( $check_digit == 10 ) {
+            $check_digit = 0;
        }
-         return $code.$check_digit;
+        return $code . $check_digit;
   }
 
   my $currentCode = shift @_;
@@ -120,49 +123,75 @@
 
 # Assigns a temporary name to the PDF file
 sub assingFilename {
-       my ($from, $to) = @_;
+    my ( $from, $to ) = @_;
        my $ip = $cgi->remote_addr();
-       my $random = int(rand(1000000));
+    my $random  = int( rand(1000000) );
     my $timeObj = localtime();
-       my ($day, $month, $year, $hour, $min, $sec) = ($timeObj->mday,
+    my ( $day, $month, $year, $hour, $min, $sec ) = (
+        $timeObj->mday,
                                                                                
                   $timeObj->mon + 1,
                                                                                
                   $timeObj->year + 1900,
-                                                                               
                   $timeObj->hour,
-                                                                               
                   $timeObj->min,
-                                                                               
                   $timeObj->sec);
-       my $tmpFileName = $random.'-'.$ip.'-(From '.$from.' to 
'.$to.')-['.$day.'.'.$month.'.'.$year.']-['.$hour.':'.$min.':'.$sec.'].pdf';
+        $timeObj->hour, $timeObj->min, $timeObj->sec
+    );
+    my $tmpFileName =
+        $random . '-' . $ip
+      . '-(From '
+      . $from . ' to '
+      . $to . ')-['
+      . $day . '.'
+      . $month . '.'
+      . $year . ']-['
+      . $hour . ':'
+      . $min . ':'
+      . $sec . '].pdf';
        return $tmpFileName;
 }
 
 # Takes inventary codes from database and if they are between
 # the interval specify by parameters, it generates the correspond barcodes
 sub barcodesGenerator {
-       my ($from, $to, $rangeType, $individualCodes,$text_under_label) = @_;
+    my ( $from, $to, $rangeType, $individualCodes, $text_under_label ) = @_;
+
        # Returns a database handler
        my $dbh = C4::Context->dbh;
+
        # Create the query to database
        # Assigns a temporary filename for the pdf file
-       my $tmpFileName = &assingFilename($from, $to);
-       if ($rangeType eq 'continuous2') {
+    my $tmpFileName = &assingFilename( $from, $to );
+    if ( $rangeType eq 'continuous2' ) {
+
                # Set the temp directory for pdf´s files
-               if (!defined($ENV{'TEMP'})) {
+        if ( !defined( $ENV{'TEMP'} ) ) {
                        $ENV{'TEMP'} = '/tmp/';
                }       
-               $tmpFileName = $ENV{'TEMP'}.$tmpFileName;
+        $tmpFileName = $ENV{'TEMP'} . $tmpFileName;
+
                # Creates a PDF object
-               my $pdf = PDF::API2->new(-file => $tmpFileName);
+        my $pdf = PDF::API2->new( -file => $tmpFileName );
+
                # Set the positions where barcodes are going to be placed
-               
C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, 
$labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});
-               
C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, 
$labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});
+        C4::Barcodes::PrinterConfig::setPositionsForX(
+            $labelConfig{'marginLeft'}, $labelConfig{'labelWidth'},
+            $labelConfig{'columns'},    $labelConfig{'pageType'}
+        );
+        C4::Barcodes::PrinterConfig::setPositionsForY(
+            $labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'},
+            $labelConfig{'rows'},         $labelConfig{'pageType'}
+        );
+
                # Creates a font object
                my $tr = $pdf->corefont('Helvetica-Bold');
+
                # Barcode position
-               my ($page, $gfx, $text);
-               for (my $code=$from; $code<=$to; $code++) {
+        my ( $page, $gfx, $text );
+        for ( my $code = $from ; $code <= $to ; $code++ ) {
+
                        # Generetase checksum
                        my $codeC = &checksum($code);
+
                        # Generate the corresponde barcode to $code
-                       my $barcode = $pdf->barcode(-font => $tr,       # The 
font object to use
+            my $barcode = $pdf->barcode(
+                -font => $tr,         # The font object to use
                                                                                
-type => 'ean128',      # Standard of codification
                                                                                
-code => $codeC, # Text to codify
                                                                                
-extn   => '012345',    # Barcode extension (if it is aplicable)
@@ -175,66 +204,90 @@
                                                                                
-text => ''
                                                                                
);
                        
-                       (my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label) = 
C4::Barcodes::PrinterConfig::getLabelPosition(
-                                                                               
                                                                                
                $label, 
-                                                                               
                                                                                
                $pdf, 
-                                                                               
                                                                                
                $page,
-                                                                               
                                                                                
                $gfx,
-                                                                               
                                                                                
                $text,
-                                                                               
                                                                                
                $tr,
-                                                                               
                                                                                
                $pageType);     
+            ( my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label ) =
+              C4::Barcodes::PrinterConfig::getLabelPosition( $label, $pdf,
+                $page, $gfx, $text, $tr, $pageType );
+
                        # Assigns a barcodes to $gfx
-                       $gfx->barcode($barcode, $x, $y , 
(72/$labelConfig{'systemDpi'}));
+            $gfx->barcode( $barcode, $x, $y,
+                ( 72 / $labelConfig{'systemDpi'} ) );
+
                        # Assigns the additional information to the barcode 
(Legend)
-                       $text->translate($x - 48, $y - 22);
+            $text->translate( $x - 48, $y - 22 );
                        if ($text_under_label) {
                                $text->text($text_under_label);
                        }
                }
+
                # Writes the objects added in $gfx to $page
-               $pdf->finishobjects($page,$gfx, $text);
+        $pdf->finishobjects( $page, $gfx, $text );
+
                # Save changes to the PDF
                $pdf->saveas;
+
                # Close the conection with the PDF file
                $pdf->end;
+
                # Show the PDF file
-               print 
$cgi->redirect("/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");
-       } else {
+        print $cgi->redirect(
+            "/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");
+    }
+    else {
                my $rangeCondition;
-               if ($individualCodes ne "") {
+        if ( $individualCodes ne "" ) {
                        $rangeCondition = "AND (I.barcode IN " . 
$individualCodes . ")";
-               } else {
-                       $rangeCondition =  "AND (I.barcode >= " . $from . " AND 
I.barcode <="  . $to . " )";
+        }
+        else {
+            $rangeCondition =
+              "AND (I.barcode >= " . $from . " AND I.barcode <=" . $to . " )";
                }
                        
-               my $query = "SELECT CONCAT('$numbersystem',REPEAT('0',((12 - 
LENGTH('$numbersystem')) - LENGTH(I.barcode))), I.barcode) AS Codigo, B.title, 
B.author FROM biblio B, items I WHERE (I.biblionumber = B.biblioNumber ) " 
.$rangeCondition. " AND (I.barcode <> 'FALTA') ORDER BY Codigo";
+        my $query =
+"SELECT CONCAT('$numbersystem',REPEAT('0',((12 - LENGTH('$numbersystem')) - 
LENGTH(I.barcode))), I.barcode) AS Codigo, B.title, B.author FROM biblio B, 
items I WHERE (I.biblionumber = B.biblioNumber ) "
+          . $rangeCondition
+          . " AND (I.barcode <> 'FALTA') ORDER BY Codigo";
                
                # Prepare the query
                my $sth = $dbh->prepare($query);
+
                # Executes the query
                $sth->execute;
-               if ($sth->rows) { # There are inventary codes
+        if ( $sth->rows ) {    # There are inventary codes
                        # Set the temp directory for pdf´s files
-                       if (!defined($ENV{'TEMP'})) {
+            if ( !defined( $ENV{'TEMP'} ) ) {
                                $ENV{'TEMP'} = '/tmp/';
                        }       
+
                        # Assigns a temporary filename for the pdf file
-                       my $tmpFileName = &assingFilename($from, $to);
-                       $tmpFileName = $ENV{'TEMP'}.$tmpFileName;
+            my $tmpFileName = &assingFilename( $from, $to );
+            $tmpFileName = $ENV{'TEMP'} . $tmpFileName;
+
                        # Creates a PDF object
-                       my $pdf = PDF::API2->new(-file => $tmpFileName);
+            my $pdf = PDF::API2->new( -file => $tmpFileName );
+
                        # Set the positions where barcodes are going to be 
placed
-                       
C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, 
$labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});
-                       
C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, 
$labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});
+            C4::Barcodes::PrinterConfig::setPositionsForX(
+                $labelConfig{'marginLeft'}, $labelConfig{'labelWidth'},
+                $labelConfig{'columns'},    $labelConfig{'pageType'}
+            );
+            C4::Barcodes::PrinterConfig::setPositionsForY(
+                $labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'},
+                $labelConfig{'rows'},         $labelConfig{'pageType'}
+            );
+
                        # Creates a font object
                        my $tr = $pdf->corefont('Helvetica-Bold');
+
                        # Barcode position
-                       my ($page, $gfx, $text);
-                       while (my ($code,$title,$author) = 
$sth->fetchrow_array) {
+            my ( $page, $gfx, $text );
+            while ( my ( $code, $title, $author ) = $sth->fetchrow_array ) {
+
                                # Generetase checksum
                                $code = &checksum($code);
+
                                # Generate the corresponde barcode to $code
-                               my $barcode = $pdf->barcode(-font => $tr,       
# The font object to use
+                my $barcode = $pdf->barcode(
+                    -font => $tr,       # The font object to use
                                                                                
        -type => 'ean13',       # Standard of codification
                                                                                
        -code => $code, # Text to codify
                                                                                
        -extn   => '012345',    # Barcode extension (if it is aplicable)
@@ -247,35 +300,41 @@
                                                                                
        -text => ''
                                                                                
        );
                                
-                               (my $x, my $y, $pdf, $page, $gfx, $text, $tr, 
$label) = C4::Barcodes::PrinterConfig::getLabelPosition(
-                                                                               
                                                                                
                        $label, 
-                                                                               
                                                                                
                        $pdf, 
-                                                                               
                                                                                
                        $page,
-                                                                               
                                                                                
                        $gfx,
-                                                                               
                                                                                
                        $text,
-                                                                               
                                                                                
                        $tr,
-                                                                               
                                                                                
                        $pageType);     
+                ( my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label ) =
+                  C4::Barcodes::PrinterConfig::getLabelPosition( $label, $pdf,
+                    $page, $gfx, $text, $tr, $pageType );
+
                                # Assigns a barcodes to $gfx
-                               $gfx->barcode($barcode, $x, $y , 
(72/$labelConfig{'systemDpi'}));
+                $gfx->barcode( $barcode, $x, $y,
+                    ( 72 / $labelConfig{'systemDpi'} ) );
+
                                # Assigns the additional information to the 
barcode (Legend)
-                               $text->translate($x - 48, $y - 22);
+                $text->translate( $x - 48, $y - 22 );
                                if ($text_under_label) {
                                        $text->text($text_under_label);
-                               } else {
-                                       $text->text(substr $title, 0, 30);
-                                       $text->translate($x - 48, $y - 29);
-                                       $text->text(substr $author, 0, 30);
                                }
+                else {
+                    $text->text( substr $title, 0, 30 );
+                    $text->translate( $x - 48, $y - 29 );
+                    $text->text( substr $author, 0, 30 );
                        }
+            }
+
                        # Writes the objects added in $gfx to $page
-                       $pdf->finishobjects($page,$gfx, $text);
+            $pdf->finishobjects( $page, $gfx, $text );
+
                        # Save changes to the PDF
                        $pdf->saveas;
+
                        # Close the conection with the PDF file
                        $pdf->end;
+
                        # Show the PDF file
-                       print 
$cgi->redirect("/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");
-               } else {
+            print $cgi->redirect(
+                
"/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");
+        }
+        else {
+
                        # Rollback and shows the error legend
                        print 
$cgi->redirect("/cgi-bin/koha/barcodes/barcodes.pl?error=1");
                }
@@ -283,4 +342,5 @@
        }
 }
 
-barcodesGenerator($from, $to, $rangeType, $individualCodes,$text_under_label);
\ No newline at end of file
+barcodesGenerator( $from, $to, $rangeType, $individualCodes,
+    $text_under_label );

Index: label-create-template.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/Attic/label-create-template.pl,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -b -r1.1.4.3 -r1.1.4.4
--- label-create-template.pl    11 Jul 2007 13:12:42 -0000      1.1.4.3
+++ label-create-template.pl    16 Jul 2007 21:17:10 -0000      1.1.4.4
@@ -10,12 +10,10 @@
 use HTML::Template;
 use POSIX;
 
-#use Data::Dumper;
-use Smart::Comments;
+use Data::Dumper;
 
 my $dbh   = C4::Context->dbh;
 my $query = new CGI;
-### $query
 
 my $tmpl_code    = $query->param('tmpl_code');
 my $tmpl_desc    = $query->param('tmpl_desc');
@@ -29,11 +27,11 @@
 my $rows         = $query->param('rows');
 my $colgap       = $query->param('colgap');
 my $rowgap       = $query->param('rowgap');
+my $active       = $query->param('active');
 my $units        = $query->param('units');
 my $fontsize     = $query->param('fontsize');
 
-my $batch_id     = $query->param('batch_id');
-
+$active = 1 if ( $active eq 'on' );
 
 my $op = $query->param('op');
 my @resultsloop;
@@ -71,16 +69,37 @@
 }
 
 elsif ( $op eq 'create' ) {
+
+    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+        {
+            template_name   => "barcodes/label-templates.tmpl",
+            query           => $query,
+            type            => "intranet",
+            authnotrequired => 1,
+            flagsrequired   => { catalogue => 1 },
+            debug           => 1,
+        }
+    );
+
     CreateTemplate(
 
         $tmpl_code, $tmpl_desc, $page_width,
         $page_height, $label_width, $label_height, $topmargin,
         $leftmargin,  $cols,        $rows,         $colgap,
-        $rowgap,      $fontsize,     $units );
+        $rowgap,      $active,      $fontsize,     $units
 
- print $query->redirect("./label-templates.pl");
-exit;
+    );
 
-}
+    @resultsloop = GetAllLabelTemplates();
+
+    $template->param(
+        resultsloop => address@hidden,
 
+        intranetcolorstylesheet =>
+          C4::Context->preference("intranetcolorstylesheet"),
+        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+        IntranetNav        => C4::Context->preference("IntranetNav"),
+    );
+
+}
 output_html_with_http_headers $query, $cookie, $template->output;

Index: label-edit-template.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/Attic/label-edit-template.pl,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -b -r1.1.4.2 -r1.1.4.3
--- label-edit-template.pl      10 Jul 2007 10:54:04 -0000      1.1.4.2
+++ label-edit-template.pl      16 Jul 2007 21:17:10 -0000      1.1.4.3
@@ -10,12 +10,11 @@
 use HTML::Template;
 use POSIX;
 
-# use Data::Dumper;
+use Data::Dumper;
 
 my $dbh       = C4::Context->dbh;
 my $query     = new CGI;
-
-my $tmpl_id = $query->param('tmpl_id');
+my $tmpl_code = $query->param('tmpl_code');
 
 my $width      = $query->param('width');
 my $height     = $query->param('height');
@@ -37,7 +36,8 @@
     }
 );
 
-my $tmpl = GetSingleLabelTemplate($tmpl_id);
+my $tmpl = GetSingleLabelTemplate($tmpl_code);
+warn Dumper $tmpl;
 
 my @units = (
     { unit => 'INCH',  desc => 'Inches' },
@@ -51,6 +51,7 @@
         $unit->{'selected'} = 1;
     }
 }
+warn Dumper @units;
 
 $template->param(
 

Index: label-item-search.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-item-search.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- label-item-search.pl        12 Jul 2007 07:38:11 -0000      1.1.2.4
+++ label-item-search.pl        16 Jul 2007 21:17:10 -0000      1.1.2.5
@@ -34,9 +34,6 @@
 use C4::SearchMarc;
 use C4::Koha;    # XXX subfield_is_koha_internal_p
 
-#use Smart::Comments;
-#use Data::Dumper;
-
 # Creates a scrolling list with the associated default value.
 # Using more than one scrolling list in a CGI assigns the same default value 
to all the
 # scrolling lists on the page !?!? That's why this function was written.
@@ -44,11 +41,6 @@
 my $query           = new CGI;
 my $type            = $query->param('type');
 my $op              = $query->param('op');
-my $batch_id        = $query->param('batch_id');
-my $dateaccessioned = $query->param('dateaccessioned');
-
-### $query;
-
 my $dbh = C4::Context->dbh;
 
 my $startfrom = $query->param('startfrom');
@@ -183,16 +175,8 @@
         from           => $from,
         to             => $to,
         numbers        => address@hidden,
-        batch_id       => $batch_id,
     );
 }
-
-#
-#
-#   search section
-#
-#
-
 else {
     ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         {
@@ -204,34 +188,38 @@
             debug           => 1,
         }
     );
-
-
-   #using old rel2.2 getitemtypes for testing!!!!, not devweek's GetItemTypes()
-
-    my $itemtypes = getitemtypes;
-    my @itemtypeloop;
-    my ($thisitemtype );
-    foreach my $thisitemtype (keys %$itemtypes) {
-            my %row =(value => $thisitemtype,
-                           description => 
$itemtypes->{$thisitemtype}->{'description'},
+    my $sth =
+      $dbh->prepare(
+        "Select itemtype,description from itemtypes order by description");
+    $sth->execute;
+    my @itemtype;
+    my %itemtypes;
+    push @itemtype, "";
+    $itemtypes{''} = "";
+    while ( my ( $value, $lib ) = $sth->fetchrow_array ) {
+        push @itemtype, $value;
+        $itemtypes{$value} = $lib;
+    }
+
+    my $CGIitemtype = CGI::scrolling_list(
+        -name     => 'value',
+        -values   => address@hidden,
+        -labels   => \%itemtypes,
+        -size     => 1,
+        -multiple => 0
                             );  
-            push @itemtypeloop, \%row;
-    }  
-
+    $sth->finish;
 
-    $template->param(
-    itemtypeloop =>address@hidden,
-        batch_id     => $batch_id,
-    );
+    $template->param( CGIitemtype => $CGIitemtype, );
+}
 
-    # Print the page
-    $template->param(
+# Print the page
+$template->param(
         intranetcolorstylesheet =>
           C4::Context->preference("intranetcolorstylesheet"),
         intranetstylesheet => C4::Context->preference("intranetstylesheet"),
         IntranetNav        => C4::Context->preference("IntranetNav"),
-    );
-}
+);
 output_html_with_http_headers $query, $cookie, $template->output;
 
 # Local Variables:

Index: label-manager.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-manager.pl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- label-manager.pl    12 Jul 2007 07:38:11 -0000      1.1.2.5
+++ label-manager.pl    16 Jul 2007 21:17:10 -0000      1.1.2.6
@@ -9,52 +9,28 @@
 use HTML::Template;
 use POSIX;
 
-#use Data::Dumper;
-#use Smart::Comments;
-
 my $dbh            = C4::Context->dbh;
 my $query          = new CGI;
 my $op             = $query->param('op');
-my $layout_id =    $query->param('layout_id');
-my $layoutname =    $query->param('layoutname');
 my $barcodetype    = $query->param('barcodetype');
-
-
-my $bcn          = $query->param('tx_barcode');
-my $author          = $query->param('tx_author');
-
-my $title          = $query->param('tx_title');
-my $isbn           = $query->param('tx_isbn');
-my $issn           = $query->param('tx_issn');
-my $itemtype       = $query->param('tx_itemtype');
-my $dcn            = $query->param('tx_dewey');
-my $classif        = $query->param('tx_classif');
-my $itemcallnumber = $query->param('tx_itemcallnumber');
-my $subclass       = $query->param('tx_subclass');
-my $author         = $query->param('tx_author');
+my $title          = $query->param('title');
+my $isbn           = $query->param('isbn');
+my $itemtype       = $query->param('itemtype');
+my $bcn            = $query->param('bcn');
+my $dcn            = $query->param('dcn');
+my $classif        = $query->param('classif');
+my $itemcallnumber = $query->param('itemcallnumber');
+my $subclass       = $query->param('subclass');
+my $author         = $query->param('author');
 my $tmpl_id        = $query->param('tmpl_id');
+my $itemnumber     = $query->param('itemnumber');
 my $summary        = $query->param('summary');
 my $startlabel     = $query->param('startlabel');
 my $printingtype   = $query->param('printingtype');
 my $guidebox       = $query->param('guidebox');
 my $fontsize       = $query->param('fontsize');
-my @itemnumber     = $query->param('itemnumber');
 
-
-# little block for displaying active layout/template/batch in templates
-# ----------
-my $batch_id     = $query->param('batch_id');
-my $active_layout = get_active_layout();
-my $active_template = GetActiveLabelTemplate();
-my $active_layout_name = $active_layout->{'layoutname'};
-my $active_template_name = $active_template->{'tmpl_code'};
-# ----------
-
-#if (!$batch_id ) {
-#    $batch_id  = get_highest_batch();
-#}
-
-my ($itemnumber) = @itemnumber if (scalar(@itemnumber) == 1);
+warn "ID =$tmpl_id";
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
@@ -67,44 +43,19 @@
     }
 );
 
-if ( $op eq 'save_conf' ) {    # this early sub is depreciated, use 
save_layout()
-   
+if ( $op eq 'save_conf' ) {
    SaveConf(
-        $barcodetype,    $title,  $isbn, 
-        $issn,    $itemtype,         $bcn,            $dcn, 
-       $classif, $subclass,         $itemcallnumber,      $author, 
-        $tmpl_id, $printingtype,   $guidebox,       $startlabel, $layoutname
-    );
-     print $query->redirect("../label-home.pl");
-    exit;
-}
-
-
-elsif  ( $op eq 'save_layout' ) {
-    save_layout(
-        $barcodetype,    $title,  $isbn, 
-        $issn,    $itemtype,         $bcn,            $dcn, 
-       $classif, $subclass,         $itemcallnumber,      $author, 
-        $tmpl_id, $printingtype,   $guidebox,       $startlabel, $layoutname,
-        $layout_id
+        $barcodetype,    $title,  $isbn,    $itemtype,
+        $bcn,            $dcn,    $classif, $subclass,
+        $itemcallnumber, $author, $tmpl_id, $printingtype,
+        $guidebox,       $startlabel
     );
 
-### $layoutname
-
-     print $query->redirect("../label-home.pl");
-    exit;
 }
-
-
-
-
-
-elsif ( $op eq 'add' ) {   # add item
-    my $query2 = "INSERT INTO labels ( itemnumber, batch_id ) values ( ?,? )";
+elsif ( $op eq 'add' ) {
+    my $query2 = "INSERT INTO labels ( itemnumber ) values ( ? )";
     my $sth2   = $dbh->prepare($query2);
-    for my $inum (@itemnumber) {
-               $sth2->execute($inum, $batch_id);
-    }
+    $sth2->execute($itemnumber);
        $sth2->finish;
 }
 elsif ( $op eq 'deleteall' ) {
@@ -114,38 +65,59 @@
     $sth2->finish;
 }
 elsif ( $op eq 'delete' ) {
+    warn "MASON, deleting label..";
     my $query2 = "DELETE FROM labels where itemnumber = ?";
     my $sth2   = $dbh->prepare($query2);
     $sth2->execute($itemnumber);
     $sth2->finish;
 }
 
+#  first lets do a read of the labels table , to get the a list of the
+# currently entered items to be prinited
 
-elsif ( $op eq 'delete_batch' ) {
-    delete_batch($batch_id);
-     print $query->redirect("label-manager.pl?batch_id=");
-        exit;
-}
-
-elsif ( $op eq 'add_batch' ) {
-    $batch_id= add_batch();
+my @resultsloop = ();
+my $count;
+my @data;
+my $query3 = "Select * from labels";
+my $sth    = $dbh->prepare($query3);
+$sth->execute();
+
+my $cnt = $sth->rows;
+my $i1  = 1;
+while ( my $data = $sth->fetchrow_hashref ) {
+
+    # lets get some summary info from each item
+    my $query1 = "
+                       select * from biblio,biblioitems,items where 
itemnumber=? and 
+                               
items.biblioitemnumber=biblioitems.biblioitemnumber and 
+                               biblioitems.biblionumber=biblio.biblionumber";
+
+    my $sth1 = $dbh->prepare($query1);
+    $sth1->execute( $data->{'itemnumber'} );
+    my $data1 = $sth1->fetchrow_hashref();
+
+    $data1->{'labelno'} = $i1;
+    $data1->{'summary'} =
+      "$data1->{'barcode'}, $data1->{'title'}, $data1->{'isbn'}";
+
+    push( @resultsloop, $data1 );
+    $sth1->finish;
 
+    $i1++;
 }
+$sth->finish;
 
-elsif ( $op eq 'set_active_layout' ) {
-    set_active_layout($layout_id);
-     print $query->redirect("../label-home.pl");
-    exit;
-}
+# this script can be run from the side nav, and is not passed a value for 
$startrow
+# so lets get it from the DB
 
+my $dbh    = C4::Context->dbh;
+my $query2 = "SELECT * FROM labels_conf LIMIT 1";
+my $sth    = $dbh->prepare($query2);
+$sth->execute();
 
-#  first lets do a read of the labels table , to get the a list of the
-# currently entered items to be prinited
+my $data = $sth->fetchrow_hashref;
+$sth->finish;
 
-my @batches = get_batches();
-my @resultsloop = get_label_items($batch_id);
-my $tmpl =GetActiveLabelTemplate();
-### $tmpl
 #calc-ing number of sheets
 #my $number_of_results = scalar @resultsloop;
 #my $sheets_needed = ( ( --$number_of_results + $startrow ) / 8 );
@@ -156,14 +128,7 @@
 #my $labels_remaining = ( $tot_labels - $start_results );
 
 $template->param(
-    batch_id => $batch_id,
-       batch_count => scalar @resultsloop,
-    active_layout_name => $active_layout_name,
-    active_template_name => $active_template_name,
-
     resultsloop => address@hidden,
-    batches => address@hidden,
-       tmpl_desc => $tmpl->{'tmpl_desc'},
 
     #  startrow         => $startrow,
     #  sheets           => $sheets_needed,

Index: label-print-pdf.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-print-pdf.pl,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -b -r1.1.2.17 -r1.1.2.18
--- label-print-pdf.pl  10 Jul 2007 10:54:04 -0000      1.1.2.17
+++ label-print-pdf.pl  16 Jul 2007 21:17:11 -0000      1.1.2.18
@@ -11,8 +11,7 @@
 use PDF::Reuse;
 use PDF::Reuse::Barcode;
 use POSIX;
-#use C4::Labels;
-#use Smart::Comments;
+use C4::Labels;
 
 my $htdocs_path = C4::Context->config('intrahtdocs');
 my $cgi         = new CGI;
@@ -23,13 +22,7 @@
 # get the printing settings
 my $template    = GetActiveLabelTemplate();
 my $conf_data   = get_label_options();
-
-my $batch_id =   $cgi->param('batch_id');
-my @resultsloop = get_label_items($batch_id);
-
-$DB::single = 1;
-
-
+my @resultsloop  = get_label_items();
 my $barcodetype  = $conf_data->{'barcodetype'};
 my $printingtype = $conf_data->{'printingtype'};
 my $guidebox     = $conf_data->{'guidebox'};
@@ -37,25 +30,15 @@
 my $fontsize     = $template->{'fontsize'};
 my $units        = $template->{'units'};
 
-### $printingtype;
-
-=c
-################### defaults for testing
-my $barcodetype  = 'CODE39';
-my $printingtype = 'BARBIB';
-my $guidebox     = 1;
-my $start_label  = 1;
-my $units        = 'POINTS'
-=cut
-
-#my $fontsize = 3;
-
 #warn "UNITS $units";
 #warn "fontsize = $fontsize";
 #warn Dumper $template;
 
 my $unitvalue = GetUnitsValue($units);
 
+#warn $unitvalue;
+#warn $units;
+
 my $tmpl_code = $template->{'tmpl_code'};
 my $tmpl_desc = $template->{'tmpl_desc'};
 
@@ -75,7 +58,7 @@
 
 my $text_wrap_cols = GetTextWrapCols( $fontsize, $label_width );
 
-#warn $label_cols, $label_rows;
+warn $label_cols, $label_rows;
 
 # set the paper size
 my $lowerLeftX  = 0;
@@ -125,13 +108,7 @@
 }
 
 else {
-
-    #eval {
     $rowcount = ceil( $start_label / $label_cols );
-
-    #} ;
-    #$rowcount = 1 if $@;
-
     $colcount = ( $start_label - ( ( $rowcount - 1 ) * $label_cols ) );
 
     $x_pos = $left_margin + ( $label_width * ( $colcount - 1 ) ) +
@@ -144,87 +121,38 @@
 
 warn "ROW COL $rowcount, $colcount";
 
-my $barcodetype = 'Code39';
-
-#
-#    main foreach loop
-#
+#my $barcodetype = 'Code39';
 
 foreach $item (@resultsloop) {
-#    warn "$x_pos, $y_pos, $label_width, $label_height";
-    my $barcode = $item->{'barcode'};
 
-    if ( $printingtype eq 'BAR' ) {
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
-        DrawBarcode( $x_pos, $y_pos, $label_height, $label_width, $barcode,
-            $barcodetype );
-        CalcNextLabelPos();
+    warn "-----------------\nbar: $item->{'barcode'}";
+    if ($guidebox) {
+        drawbox( $x_pos, $y_pos, $label_width, $label_height );
     }
-    elsif ( $printingtype eq 'BARBIB' ) {
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
-
-        # reposoitioning barcode up the top of label
-        my $barcode_height = ($label_height / 1.5 );    ## scaling voodoo
-        my $text_height    = $label_height / 2;
-        my $barcode_y      = $y_pos + ( $label_height / 2.5  );   ## scaling 
voodoo
-
-        DrawBarcode( $x_pos, $barcode_y, $barcode_height, $label_width,
-            $barcode, $barcodetype );
-        DrawSpineText( $y_pos, $text_height, $fontsize, $x_pos,
-            $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
-
-        CalcNextLabelPos();
-
-    }    # correct
-    elsif ( $printingtype eq 'BIBBAR' ) {
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
-        my $barcode_height = $label_height / 2;
-        DrawBarcode( $x_pos, $y_pos, $barcode_height, $label_width, $barcode,
-            $barcodetype );
-        DrawSpineText( $y_pos, $label_height, $fontsize, $x_pos,
-            $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
 
-        CalcNextLabelPos();
+    if ( $printingtype eq 'spine' || $printingtype eq 'both' ) {
+        if ($guidebox) {
+            drawbox( $x_pos, $y_pos, $label_width, $label_height );
     }
 
-    elsif ( $printingtype eq 'ALT' ) {
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
-        DrawBarcode( $x_pos, $y_pos, $label_height, $label_width, $barcode,
-            $barcodetype );
-        CalcNextLabelPos();
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
         DrawSpineText( $y_pos, $label_height, $fontsize, $x_pos,
             $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
-
         CalcNextLabelPos();
     }
 
+    if ( $printingtype eq 'barcode' || $printingtype eq 'both' ) {
+        if ($guidebox) {
+            drawbox( $x_pos, $y_pos, $label_width, $label_height );
+        }
 
-    elsif ( $printingtype eq 'BIB' ) {
-        drawbox( $x_pos, $y_pos, $label_width, $label_height ) if $guidebox;
-        DrawSpineText( $y_pos, $label_height, $fontsize, $x_pos,
-            $left_text_margin, $text_wrap_cols, \$item, \$conf_data );
+        DrawBarcode( $x_pos, $y_pos, $label_height, $label_width,
+            $item->{'barcode'}, $barcodetype );
         CalcNextLabelPos();
     }
 
-
-
-
-
-
-
-
-
-
-
 }    # end for item loop
 prEnd();
 
-#
-#
-#
-#
-#
 sub CalcNextLabelPos {
     if ( $colcount lt $label_cols ) {
 

Index: label-save-template.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/Attic/label-save-template.pl,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -b -r1.1.4.3 -r1.1.4.4
--- label-save-template.pl      11 Jul 2007 12:57:38 -0000      1.1.4.3
+++ label-save-template.pl      16 Jul 2007 21:17:11 -0000      1.1.4.4
@@ -10,9 +10,7 @@
 use HTML::Template;
 use POSIX;
 
-#use Data::Dumper;
-#use Smart::Comments;
-
+use Data::Dumper;
 
 my $dbh   = C4::Context->dbh;
 my $query = new CGI;
@@ -34,17 +32,39 @@
 my $units        = $query->param('units');
 my $active       = $query->param('active');
 
+warn "ACTIVE = $active $fontsize";
+$active = 1 if ( $active == 'on' );
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "barcodes/label-templates.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 1,
+        flagsrequired   => { catalogue => 1 },
+        debug           => 1,
+    }
+);
+
+my @resultsloop;
 
 SaveTemplate(
 
     $tmpl_id,     $tmpl_code,   $tmpl_desc,    $page_width,
     $page_height, $label_width, $label_height, $topmargin,
     $leftmargin,  $cols,        $rows,         $colgap,
-    $rowgap,      $fontsize,     $units
+    $rowgap,      $active,      $fontsize,     $units
 
 );
address@hidden = GetAllLabelTemplates();
 
+$template->param(
+    resultsloop => address@hidden,
 
- print $query->redirect("./label-templates.pl");
-
+    intranetcolorstylesheet =>
+      C4::Context->preference("intranetcolorstylesheet"),
+    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+    IntranetNav        => C4::Context->preference("IntranetNav"),
+);
 
+output_html_with_http_headers $query, $cookie, $template->output;

Index: label-templates.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/Attic/label-templates.pl,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -b -r1.1.4.3 -r1.1.4.4
--- label-templates.pl  10 Jul 2007 12:14:42 -0000      1.1.4.3
+++ label-templates.pl  16 Jul 2007 21:17:11 -0000      1.1.4.4
@@ -10,14 +10,16 @@
 use HTML::Template;
 use POSIX;
 
-#use Data::Dumper;
+use Data::Dumper;
 
 my $dbh       = C4::Context->dbh;
 my $query     = new CGI;
 my $op        = $query->param('op');
 my $tmpl_code = $query->param('tmpl_code');
-my $tmpl_id = $query->param('tmpl_id');
 
+if ( !$op ) {
+    $op = 'display';
+}
 
 my $width      = $query->param('width');
 my $height     = $query->param('height');
@@ -39,39 +41,24 @@
     }
 );
 
-
 my @resultsloop;
 
-
-if ( $op eq 'set_active_template' ) {
-    SetActiveTemplate($tmpl_id);
+if ( $op eq 'display' ) {
+    @resultsloop = GetAllLabelTemplates();
 }
 
 elsif ( $op eq 'delete' ) {
-    DeleteTemplate($tmpl_id);
+    DeleteTemplate($tmpl_code);
+    @resultsloop = GetAllLabelTemplates();
 }
 
 elsif ( $op eq 'save' ) {
+    warn "SSSSSSSSSSSSSSSSSSSSSSSSSAVING!!!!!!!!!!!!!!!!!!";
     SaveTemplate($tmpl_code);
-}
-
     @resultsloop = GetAllLabelTemplates();
-
-# little block for displaying active layout/template/batch in templates
-# ----------
-my $batch_id     = $query->param('batch_id');
-my $active_layout = get_active_layout();
-my $active_template = GetActiveLabelTemplate();
-my $active_layout_name = $active_layout->{'layoutname'};
-my $active_template_name = $active_template->{'tmpl_code'};
-# ----------
+}
 
 $template->param(
-
-    batch_id => $batch_id,
-    active_layout_name => $active_layout_name,
-    active_template_name => $active_template_name,
-
     resultsloop => address@hidden,
 
     intranetcolorstylesheet =>

Index: pdfViewer.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/pdfViewer.pl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -b -r1.2.2.1 -r1.2.2.2
--- pdfViewer.pl        5 Sep 2005 22:18:09 -0000       1.2.2.1
+++ pdfViewer.pl        16 Jul 2007 21:17:11 -0000      1.2.2.2
@@ -31,8 +31,8 @@
 my $filename = "barcodes.pdf";
 my $tmpFileName = $cgi->param('tmpFileName');
 print "Content-Disposition: attachment; filename = $filename\n\n";
-print $cgi->header(-type => 'application/pdf'),
-      $cgi->start_html(-title=>"Codify to PDF");
+print $cgi->header( -type => 'application/pdf' ),
+  $cgi->start_html( -title => "Codify to PDF" );
 open fh, "<$tmpFileName";
 while (<fh>) {
  print;

Index: printerConfig.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/printerConfig.pl,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -b -r1.2.2.3 -r1.2.2.4
--- printerConfig.pl    5 Feb 2006 21:59:21 -0000       1.2.2.3
+++ printerConfig.pl    16 Jul 2007 21:17:11 -0000      1.2.2.4
@@ -39,9 +39,10 @@
        my $type = shift @_;
        my $templatesSet = C4::Context->preference('template');
        my $lang = C4::Context->preference('opaclanguages');
-       if ($type eq "intranet") {
+    if ( $type eq "intranet" ) {
                return 
"$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
-       } else {
+    }
+    else {
                return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
        }
 }
@@ -64,12 +65,12 @@
 # Save settings to a configuration file.
 sub saveConfToFile {
        my $fileName = shift @_;
-       my %keyValues = %{shift @_};
+    my %keyValues = %{ shift @_ };
        my $i;
        open FILE, ">$fileName";                        
        my $i;
-       foreach $i (keys(%keyValues)) {
-    print FILE $i." = ".$keyValues{$i}."\n";
+    foreach $i ( keys(%keyValues) ) {
+        print FILE $i . " = " . $keyValues{$i} . "\n";
        }
        close FILE;
 }
@@ -77,44 +78,52 @@
 # Creates a CGI object and take his parameters
 my $input = new CGI;
 
-if ($input->param('saveSettings')) {
-       my $labelConf = 
&getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
-       my %newConfiguration = (pageType => $input->param('pageType'),  
+if ( $input->param('saveSettings') ) {
+    my $labelConf =
+      &getPath("intranet") . "/includes/labelConfig/itemsLabelConfig.conf";
+    my %newConfiguration = (
+        pageType     => $input->param('pageType'),
                                                        columns => 
$input->param('columns'),            
                                                        rows => 
$input->param('rows'),  
                                                        systemDpi => 
$input->param('systemDpi'),        
                                                        labelWidth => 
$input->param('labelWidth'),      
                                                        labelHeigth => 
$input->param('labelHeigth'),    
                                                        marginBottom => 
$input->param('marginBottom'),  
-                                                       marginLeft => 
$input->param('marginLeft'));     
-       saveConfToFile($labelConf, \%newConfiguration);
-       print $input->redirect('/cgi-bin/koha/barcodes/barcodes.pl')
+        marginLeft   => $input->param('marginLeft')
+    );
+    saveConfToFile( $labelConf, \%newConfiguration );
+    print $input->redirect('/cgi-bin/koha/barcodes/barcodes.pl');
 }
 
 # Get the template to use
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "barcodes/printerConfig.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "barcodes/printerConfig.tmpl",
                                         type => "intranet",
                                         query => $input,
                                         authnotrequired => 0,
-                                        flagsrequired => {parameters => 1},
+        flagsrequired   => { parameters => 1 },
                                                 debug => 1,
-                                      });
+    }
+);
 
-my $filenameConf = 
&getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
+my $filenameConf =
+  &getPath("intranet") . "/includes/labelConfig/itemsLabelConfig.conf";
 my %labelConfig = &loadConfFromFile($filenameConf);
 
-$template->param(COLUMNS => $labelConfig{'columns'});
-$template->param(ROWS => $labelConfig{'rows'});
-$template->param(SYSTEM_DPI => $labelConfig{'systemDpi'});
-$template->param(LABEL_WIDTH => $labelConfig{'labelWidth'});
-$template->param(LABEL_HEIGTH => $labelConfig{'labelHeigth'});
-$template->param(MARGIN_TOP => $labelConfig{'marginBottom'});
-$template->param(MARGIN_LEFT => $labelConfig{'marginLeft'});
-$template->param(SCRIPT_NAME => '/cgi-bin/koha/barcodes/printerConfig.pl');
-$template->param("$labelConfig{'pageType'}" => 1);
-$template->param(intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+$template->param( COLUMNS      => $labelConfig{'columns'} );
+$template->param( ROWS         => $labelConfig{'rows'} );
+$template->param( SYSTEM_DPI   => $labelConfig{'systemDpi'} );
+$template->param( LABEL_WIDTH  => $labelConfig{'labelWidth'} );
+$template->param( LABEL_HEIGTH => $labelConfig{'labelHeigth'} );
+$template->param( MARGIN_TOP   => $labelConfig{'marginBottom'} );
+$template->param( MARGIN_LEFT  => $labelConfig{'marginLeft'} );
+$template->param( SCRIPT_NAME  => '/cgi-bin/koha/barcodes/printerConfig.pl' );
+$template->param( "$labelConfig{'pageType'}" => 1 );
+$template->param(
+    intranetcolorstylesheet =>
+      C4::Context->preference("intranetcolorstylesheet"),
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
                IntranetNav => C4::Context->preference("IntranetNav"),
-               );
+);
 output_html_with_http_headers $input, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]