koha-devel
[Top][All Lists]
Advanced

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

[Koha-devel] Bug Fixes in returns (intranet)


From: Andrés Tarallo
Subject: [Koha-devel] Bug Fixes in returns (intranet)
Date: Wed Feb 2 04:32:36 2005
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803

Today I fixed a bug found by our librarians. There are broken links in returns.tmpl, the patch attached below (returns.tmpl.diff) solves them.

Since is was working in the returns I've also fixed the mixed tabstops in returns.pl. I personally like tabs of 4 spaces, but usssing a tab character is more universal, and everyone can configure his editor to his wishes.

Andres
--- returns.pl  2005-02-02 09:38:30.634713488 -0300
+++ returns.pl.orig     2005-02-02 08:56:19.723470480 -0300
@@ -1,4 +1,7 @@
 #!/usr/bin/perl
+# WARNING: This file contains mixed-sized tabs! (some 4-character, some 8)
+# WARNING: Currently, 4-character tabs seem to be dominant
+# WARNING: But there are still lots of 8-character tabs
 
 #written 11/3/2002 by Finlay
 #script to execute returns of books
@@ -19,9 +22,6 @@
 # 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
-# Revision History:
-# 2005-02-02 A. Tarallo: I've fixed the mixed tabs, now every tab is a tab 
stop.
-# Also made some cosmetical corrections.
 
 use strict;
 use CGI;
@@ -39,13 +39,13 @@
 
 #getting the template
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
-       {
-               template_name   => "circ/returns.tmpl",
-               query           => $query,
-               type            => "intranet",
-               authnotrequired => 0,
-               flagsrequired   => { circulate => 1 },
-       }
+    {
+        template_name   => "circ/returns.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { circulate => 1 },
+    }
 );
 
 #####################
@@ -75,61 +75,61 @@
 my %riborrowernumber;
 my @inputloop;
 foreach ( $query->param ) {
-       (next) unless (/ri-(\d*)/);
-       my %input;
-       my $counter = $1;
-       (next) if ( $counter > 20 );
-       my $barcode        = $query->param("ri-$counter");
-       my $duedate        = $query->param("dd-$counter");
-       my $borrowernumber = $query->param("bn-$counter");
-       $counter++;
-
-       # decode cuecat
-       $barcode = cuecatbarcodedecode($barcode);
-
-       ######################
-       #Are these lines still useful ?
-       $returneditems{$counter}    = $barcode;
-       $riduedate{$counter}        = $duedate;
-       $riborrowernumber{$counter} = $borrowernumber;
-
-       #######################
-       $input{counter} = $counter;
-       $input{barcode} = $barcode;
-       $input{duedate} = $duedate;
-       $input{bornum}  = $borrowernumber;
-       push ( @inputloop, \%input );
+    (next) unless (/ri-(\d*)/);
+    my %input;
+    my $counter = $1;
+    (next) if ( $counter > 20 );
+    my $barcode        = $query->param("ri-$counter");
+    my $duedate        = $query->param("dd-$counter");
+    my $borrowernumber = $query->param("bn-$counter");
+    $counter++;
+
+    # decode cuecat
+    $barcode = cuecatbarcodedecode($barcode);
+
+    ######################
+    #Are these lines still useful ?
+    $returneditems{$counter}    = $barcode;
+    $riduedate{$counter}        = $duedate;
+    $riborrowernumber{$counter} = $borrowernumber;
+
+    #######################
+    $input{counter} = $counter;
+    $input{barcode} = $barcode;
+    $input{duedate} = $duedate;
+    $input{bornum}  = $borrowernumber;
+    push ( @inputloop, \%input );
 }
 
 ############
 # Deal with the requests....
 if ( $query->param('resbarcode') ) {
-       my $item       = $query->param('itemnumber');
-       my $borrnum    = $query->param('borrowernumber');
-       my $resbarcode = $query->param('resbarcode');
-
-       # set to waiting....
-       my $iteminfo = getiteminformation( \%env, $item );
-       my $tobranchcd = ReserveWaiting( $item, $borrnum );
-       my $branchname = $branches->{$tobranchcd}->{'branchname'};
-       my ($borr) = getpatroninformation( \%env, $borrnum, 0 );
-       my $borcnum = $borr->{'cardnumber'};
-       my $name =
-               $borr->{'surname'} . " " . $borr->{'title'} . " " . 
$borr->{'firstname'};
-       my $slip = $query->param('resslip');
+    my $item       = $query->param('itemnumber');
+    my $borrnum    = $query->param('borrowernumber');
+    my $resbarcode = $query->param('resbarcode');
+
+    # set to waiting....
+    my $iteminfo = getiteminformation( \%env, $item );
+    my $tobranchcd = ReserveWaiting( $item, $borrnum );
+    my $branchname = $branches->{$tobranchcd}->{'branchname'};
+    my ($borr) = getpatroninformation( \%env, $borrnum, 0 );
+    my $borcnum = $borr->{'cardnumber'};
+    my $name    =
+      $borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
+    my $slip = $query->param('resslip');
 #    printslip( \%env, $slip ); #removed by paul
 
-       if ( $tobranchcd ne $branch ) {
-               $template->param(
-                       itemtitle  => $iteminfo->{'title'},
-                       iteminfo   => $iteminfo->{'author'},
-                       branchname => $branchname,
-                       name       => $name,
-                       bornum     => $borrnum,
-                       borcnum    => $borcnum,
-                       diffbranch => 1
-               );
-       }
+    if ( $tobranchcd ne $branch ) {
+        $template->param(
+            itemtitle  => $iteminfo->{'title'},
+            iteminfo   => $iteminfo->{'author'},
+            branchname => $branchname,
+            name       => $name,
+            bornum     => $borrnum,
+            borcnum    => $borcnum,
+            diffbranch => 1
+        );
+    }
 }
 
 my $iteminformation;
@@ -141,45 +141,50 @@
 # actually return book and prepare item table.....
 if ($barcode) {
 
-       # decode cuecat
-       $barcode = cuecatbarcodedecode($barcode);
-       ( $returned, $messages, $iteminformation, $borrower ) =
-               returnbook( $barcode, $branch );
-       if ($returned) {
-               $returneditems{0}    = $barcode;
-               $riborrowernumber{0} = $borrower->{'borrowernumber'};
-               $riduedate{0}        = $iteminformation->{'date_due'};
-               my %input;
-               $input{counter} = 0;
-               $input{first}   = 1;
-               $input{barcode} = $barcode;
-               $input{duedate} = $riduedate{0};
-               $input{bornum}  = $riborrowernumber{0};
-               push ( @inputloop, \%input );
-       } elsif ( !$messages->{'BadBarcode'} ) {
-               my %input;
-               $input{counter} = 0;
-               $input{first}   = 1;
-               $input{barcode} = $barcode;
-               $input{duedate} = 0;
-
-               $returneditems{0} = $barcode;
-               $riduedate{0}     = 0;
-               if ( $messages->{'wthdrawn'} ) {
-                       $input{withdrawn} = 1;
-                       $input{bornum}    = "Item Cancelled";
-                       $riborrowernumber{0} = 'Item Cancelled';
-               } else {
-                       $input{bornum} = " ";
-                       $riborrowernumber{0} = ' ';
-               }
-               push ( @inputloop, \%input );
-       }
-       $template->param(
-               returned  => $returned,
-               itemtitle => $iteminformation->{'title'},
-               itemauthor => $iteminformation->{'author'}
-       );
+    # decode cuecat
+    $barcode = cuecatbarcodedecode($barcode);
+    ( $returned, $messages, $iteminformation, $borrower ) =
+      returnbook( $barcode, $branch );
+    if ($returned) {
+        $returneditems{0}    = $barcode;
+        $riborrowernumber{0} = $borrower->{'borrowernumber'};
+        $riduedate{0}        = $iteminformation->{'date_due'};
+        my %input;
+        $input{counter} = 0;
+        $input{first}   = 1;
+        $input{barcode} = $barcode;
+        $input{duedate} = $riduedate{0};
+        $input{bornum}  = $riborrowernumber{0};
+        push ( @inputloop, \%input );
+    }
+    elsif ( !$messages->{'BadBarcode'} ) {
+        my %input;
+        $input{counter} = 0;
+        $input{first}   = 1;
+        $input{barcode} = $barcode;
+        $input{duedate} = 0;
+
+        $returneditems{0} = $barcode;
+        $riduedate{0}     = 0;
+        if ( $messages->{'wthdrawn'} ) {
+            $input{withdrawn} = 1;
+            $input{bornum}    = "Item Cancelled";
+            $riborrowernumber{0} = 'Item Cancelled';
+        }
+        else {
+            $input{bornum} = " ";
+            $riborrowernumber{0} = ' ';
+        }
+        push ( @inputloop, \%input );
+    }
+    $template->param(
+        returned  => $returned,
+        itemtitle => $iteminformation->{'title'},
+
+        #                                                                      
itembc => $iteminformation->{'barcode'},
+        #                                                                      
itemdatedue => $iteminformation->{'datedue'},
+        itemauthor => $iteminformation->{'author'}
+    );
 }
 $template->param( inputloop => address@hidden );
 
@@ -188,179 +193,193 @@
 my $reserved = 0;
 
 if ( $messages->{'ResFound'} ) {
-       my $res        = $messages->{'ResFound'};
-       my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
-       my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
-       my $name =
-               $borr->{'surname'} . " " . $borr->{'title'} . " " . 
$borr->{'firstname'};
-       my ($iteminfo) = getiteminformation( \%env, 0, $barcode );
-
-       if ( $res->{'ResFound'} eq "Waiting" ) {
-               $template->param(
-                       found         => 1,
-                       name          => $name,
-                       borfirstname  => $borr->{'firstname'},
-                       borsurname    => $borr->{'surname'},
-                       bortitle      => $borr->{'title'},
-                       borphone      => $borr->{'phone'},
-                       borstraddress => $borr->{'streetaddress'},
-                       borcity       => $borr->{'city'},
-                       borzip        => $borr->{'zipcode'},
-                       bornum        => $res->{'borrowernumber'},
-                       borcnum       => $borr->{'cardnumber'},
-                       branchname  => $branches->{ $res->{'branchcode'} 
}->{'branchname'},
-                       waiting     => 1,
-                       itemnumber  => $res->{'itemnumber'},
-                       itemtitle   => $iteminfo->{'title'},
-                       itemauthor  => $iteminfo->{'author'},
-                       itembarcode => $iteminfo->{'barcode'},
-                       itemtype    => $iteminfo->{'itemtype'},
-                       itembiblionumber => $iteminfo->{'biblionumber'}
-               );
-
-       }
-       if ( $res->{'ResFound'} eq "Reserved" ) {
-               my @da         = localtime( time() );
-               my $todaysdate = sprintf( "%0.2d", ( $da[3] + 1 ) ) . "/"
-                 . sprintf( "%0.2d", ( $da[4] + 1 ) ) . "/" . ( $da[5] + 1900 
);
-               $template->param(
-                       found       => 1,
-                       branchname  => $branches->{ $res->{'branchcode'} 
}->{'branchname'},
-                       reserved    => 1,
-                       today       => $todaysdate,
-                       itemnumber  => $res->{'itemnumber'},
-                       itemtitle   => $iteminfo->{'title'},
-                       itemauthor  => $iteminfo->{'author'},
-                       itembarcode => $iteminfo->{'barcode'},
-                       itemtype    => $iteminfo->{'itemtype'},
-                       itembiblionumber => $iteminfo->{'biblionumber'},
-                       borsurname       => $borr->{'surname'},
-                       bortitle         => $borr->{'title'},
-                       borfirstname     => $borr->{'firstname'},
-                       bornum           => $res->{'borrowernumber'},
-                       borcnum          => $borr->{'cardnumber'},
-                       borphone         => $borr->{'phone'},
-                       borstraddress    => $borr->{'streetaddress'},
-                       borsub           => $borr->{'suburb'},
-                       borcity          => $borr->{'city'},
-                       borzip           => $borr->{'zipcode'},
-                       boremail         => $borr->{'emailadress'},
-                       barcode          => $barcode
-               );
-       }
+    my $res        = $messages->{'ResFound'};
+    my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
+    my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
+    my $name =
+      $borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
+    my ($iteminfo) = getiteminformation( \%env, 0, $barcode );
+
+    if ( $res->{'ResFound'} eq "Waiting" ) {
+        $template->param(
+            found         => 1,
+            name          => $name,
+            borfirstname  => $borr->{'firstname'},
+            borsurname    => $borr->{'surname'},
+            bortitle      => $borr->{'title'},
+            borphone      => $borr->{'phone'},
+            borstraddress => $borr->{'streetaddress'},
+            borcity       => $borr->{'city'},
+            borzip        => $borr->{'zipcode'},
+            bornum        => $res->{'borrowernumber'},
+            borcnum       => $borr->{'cardnumber'},
+            branchname  => $branches->{ $res->{'branchcode'} }->{'branchname'},
+            waiting     => 1,
+            itemnumber  => $res->{'itemnumber'},
+            itemtitle   => $iteminfo->{'title'},
+            itemauthor  => $iteminfo->{'author'},
+            itembarcode => $iteminfo->{'barcode'},
+            itemtype    => $iteminfo->{'itemtype'},
+            itembiblionumber => $iteminfo->{'biblionumber'}
+        );
+
+    }
+    if ( $res->{'ResFound'} eq "Reserved" ) {
+        my @da         = localtime( time() );
+        my $todaysdate =
+          sprintf( "%0.2d", ( $da[3] + 1 ) ) . "/"
+          . sprintf( "%0.2d", ( $da[4] + 1 ) ) . "/"
+          . ( $da[5] + 1900 );
+        $template->param(
+            found       => 1,
+            branchname  => $branches->{ $res->{'branchcode'} }->{'branchname'},
+            reserved    => 1,
+            today       => $todaysdate,
+            itemnumber  => $res->{'itemnumber'},
+            itemtitle   => $iteminfo->{'title'},
+            itemauthor  => $iteminfo->{'author'},
+            itembarcode => $iteminfo->{'barcode'},
+            itemtype    => $iteminfo->{'itemtype'},
+            itembiblionumber => $iteminfo->{'biblionumber'},
+            borsurname       => $borr->{'surname'},
+            bortitle         => $borr->{'title'},
+            borfirstname     => $borr->{'firstname'},
+            bornum           => $res->{'borrowernumber'},
+            borcnum          => $borr->{'cardnumber'},
+            borphone         => $borr->{'phone'},
+            borstraddress    => $borr->{'streetaddress'},
+            borsub           => $borr->{'suburb'},
+            borcity          => $borr->{'city'},
+            borzip           => $borr->{'zipcode'},
+            boremail         => $borr->{'emailadress'},
+            barcode          => $barcode
+        );
+    }
 }
 
 # Error Messages
 my @errmsgloop;
 foreach my $code ( keys %$messages ) {
 
-       #    warn $code;
-       my %err;
-       my $exit_required_p = 0;
-       if ( $code eq 'BadBarcode' ) {
-               $err{badbarcode} = 1;
-               $err{msg}        = $messages->{'BadBarcode'};
-       } elsif ( $code eq 'NotIssued' ) {
-               $err{notissued} = 1;
-               $err{msg} = $branches->{ $messages->{'IsPermanent'} 
}->{'branchname'};
-       } elsif ( $code eq 'WasLost' ) {
-               $err{waslost} = 1;
-       } elsif ( $code eq 'ResFound' ) {
-               ;    # FIXME... anything to do here?
-       } elsif ( $code eq 'WasReturned' ) {
-               ;    # FIXME... anything to do here?
-       } elsif ( $code eq 'WasTransfered' ) {
-               ;    # FIXME... anything to do here?
-       } elsif ( $code eq 'wthdrawn' ) {
-               $err{withdrawn} = 1;
-               $exit_required_p = 1;
-       } elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) 
) {
-               if ( $messages->{'IsPermanent'} ne $branch ) {
-                       $err{ispermanent} = 1;
-                       $err{msg}         =
-                               $branches->{ $messages->{'IsPermanent'} 
}->{'branchname'};
-               }
-       } else {
-               die "Unknown error code $code";    # XXX
-       }
-       if (%err) {
-               push ( @errmsgloop, \%err );
-       } 
-       last if $exit_required_p;
+    #    warn $code;
+    my %err;
+    my $exit_required_p = 0;
+    if ( $code eq 'BadBarcode' ) {
+        $err{badbarcode} = 1;
+        $err{msg}        = $messages->{'BadBarcode'};
+    }
+    elsif ( $code eq 'NotIssued' ) {
+        $err{notissued} = 1;
+        $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
+    }
+    elsif ( $code eq 'WasLost' ) {
+        $err{waslost} = 1;
+    }
+    elsif ( $code eq 'ResFound' ) {
+        ;    # FIXME... anything to do here?
+    }
+    elsif ( $code eq 'WasReturned' ) {
+        ;    # FIXME... anything to do here?
+    }
+    elsif ( $code eq 'WasTransfered' ) {
+        ;    # FIXME... anything to do here?
+    }
+    elsif ( $code eq 'wthdrawn' ) {
+        $err{withdrawn} = 1;
+        $exit_required_p = 1;
+    }
+    elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
+        if ( $messages->{'IsPermanent'} ne $branch ) {
+            $err{ispermanent} = 1;
+            $err{msg}         =
+              $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
+        }
+    }
+    else {
+        die "Unknown error code $code";    # XXX
+    }
+    if (%err) {
+        push ( @errmsgloop, \%err );
+    }
+    last if $exit_required_p;
 }
 $template->param( errmsgloop => address@hidden );
 
 # patrontable ....
 if ($borrower) {
-       my $flags = $borrower->{'flags'};
-       my $color = '';
-       my @flagloop;
-       my $flagset;
-       foreach my $flag ( sort keys %$flags ) {
-               my %flaginfo;
-               ( $color eq $linecolor1 ) ? 
-                       ( $color = $linecolor2 ) : ( $color = $linecolor1 ); 
-               unless ($flagset) { $flagset = 1; }
-               $flaginfo{color}   = $color;
-               $flaginfo{redfont} = ( $flags->{$flag}->{'noissues'} );
-               $flaginfo{flag}    = $flag;
-               if ( $flag eq 'CHARGES' ) {
-                       $flaginfo{msg}     = $flag;
-                       $flaginfo{charges} = 1;
-                       $flaginfo{bornum} = $borrower->{borrowernumber};
-               } elsif ( $flag eq 'WAITING' ) {
-                       $flaginfo{msg}     = $flag;
-                       $flaginfo{waiting} = 1;
-                       my @waitingitemloop;
-                       my $items = $flags->{$flag}->{'itemlist'};
-                       foreach my $item (@$items) {
-                           my ($iteminformation) =
-                                       getiteminformation( \%env, 
$item->{'itemnumber'}, 0 );
-                               my %waitingitem;
-                               $waitingitem{biblionum} = 
$iteminformation->{'biblionumber'};
-                           $waitingitem{barcode}   = 
$iteminformation->{'barcode'};
-                           $waitingitem{title}     = 
$iteminformation->{'title'};
-                           $waitingitem{brname}    =
-                           $branches->{ $iteminformation->{'holdingbranch'} 
}->{
-                                       'branchname'};
-                           push ( @waitingitemloop, \%waitingitem );
-                       }
-                       $flaginfo{itemloop} = address@hidden;
-               } elsif ( $flag eq 'ODUES' ) {
-                       my $items = $flags->{$flag}->{'itemlist'};
-                       my @itemloop;
-                       foreach my $item 
-                               ( sort { $a->{'date_due'} cmp $b->{'date_due'} 
} @$items ) {
-
-                               my ($iteminformation) =
-                                       getiteminformation( \%env, 
$item->{'itemnumber'}, 0 );
-                           my %overdueitem;
-                               $overdueitem{duedate}   = $item->{'date_due'};
-                               $overdueitem{biblionum} = 
$iteminformation->{'biblionumber'};
-                               $overdueitem{barcode}   = 
$iteminformation->{'barcode'};
-                               $overdueitem{title}     = 
$iteminformation->{'title'};
-                               $overdueitem{brname}    =
-                                       $branches->{ 
$iteminformation->{'holdingbranch'} }->{
-                                       'branchname'};
-                               push ( @itemloop, \%overdueitem );
-                       }
-                       $flaginfo{itemloop} = address@hidden;
-                       $flaginfo{overdue}  = 1;
-               } else {
-                       $flaginfo{other} = 1;
-                       $flaginfo{msg}   = $flags->{$flag}->{'message'};
-               }
-               push ( @flagloop, \%flaginfo );
-       }
-       $template->param(
-               flagset        => $flagset,
-               flagloop       => address@hidden,
-               ribornum       => $borrower->{'borrowernumber'},
-               riborcnum      => $borrower->{'cardnumber'},
-               riborsurname   => $borrower->{'surname'},
-               ribortitle     => $borrower->{'title'},
-               riborfirstname => $borrower->{'firstname'}
-       );
+    my $flags = $borrower->{'flags'};
+    my $color = '';
+    my @flagloop;
+    my $flagset;
+    foreach my $flag ( sort keys %$flags ) {
+        my %flaginfo;
+        ( $color eq $linecolor1 ) 
+          ? ( $color = $linecolor2 )
+          : ( $color = $linecolor1 );
+        unless ($flagset) { $flagset = 1; }
+        $flaginfo{color}   = $color;
+        $flaginfo{redfont} = ( $flags->{$flag}->{'noissues'} );
+        $flaginfo{flag}    = $flag;
+        if ( $flag eq 'CHARGES' ) {
+            $flaginfo{msg}     = $flag;
+            $flaginfo{charges} = 1;
+           $flaginfo{bornum} = $borrower->{borrowernumber};
+        }
+        elsif ( $flag eq 'WAITING' ) {
+            $flaginfo{msg}     = $flag;
+            $flaginfo{waiting} = 1;
+            my @waitingitemloop;
+            my $items = $flags->{$flag}->{'itemlist'};
+            foreach my $item (@$items) {
+                my ($iteminformation) =
+                  getiteminformation( \%env, $item->{'itemnumber'}, 0 );
+                my %waitingitem;
+                $waitingitem{biblionum} = $iteminformation->{'biblionumber'};
+                $waitingitem{barcode}   = $iteminformation->{'barcode'};
+                $waitingitem{title}     = $iteminformation->{'title'};
+                $waitingitem{brname}    =
+                  $branches->{ $iteminformation->{'holdingbranch'} }->{
+                  'branchname'};
+                push ( @waitingitemloop, \%waitingitem );
+            }
+            $flaginfo{itemloop} = address@hidden;
+        }
+        elsif ( $flag eq 'ODUES' ) {
+            my $items = $flags->{$flag}->{'itemlist'};
+            my @itemloop;
+            foreach my $item ( sort { $a->{'date_due'} cmp $b->{'date_due'} }
+                @$items )
+            {
+                my ($iteminformation) =
+                  getiteminformation( \%env, $item->{'itemnumber'}, 0 );
+                my %overdueitem;
+                $overdueitem{duedate}   = $item->{'date_due'};
+                $overdueitem{biblionum} = $iteminformation->{'biblionumber'};
+                $overdueitem{barcode}   = $iteminformation->{'barcode'};
+                $overdueitem{title}     = $iteminformation->{'title'};
+                $overdueitem{brname}    =
+                  $branches->{ $iteminformation->{'holdingbranch'} }->{
+                  'branchname'};
+                push ( @itemloop, \%overdueitem );
+            }
+            $flaginfo{itemloop} = address@hidden;
+            $flaginfo{overdue}  = 1;
+        }
+        else {
+            $flaginfo{other} = 1;
+            $flaginfo{msg}   = $flags->{$flag}->{'message'};
+        }
+        push ( @flagloop, \%flaginfo );
+    }
+    $template->param(
+        flagset        => $flagset,
+        flagloop       => address@hidden,
+        ribornum       => $borrower->{'borrowernumber'},
+        riborcnum      => $borrower->{'cardnumber'},
+        riborsurname   => $borrower->{'surname'},
+        ribortitle     => $borrower->{'title'},
+        riborfirstname => $borrower->{'firstname'}
+    );
 }
 
 my $color = '';
@@ -369,71 +388,78 @@
 my $count = 0;
 my @riloop;
 foreach ( sort { $a <=> $b } keys %returneditems ) {
-       my %ri;
-       if ( $count < 8 ) {
-               ( $color eq $linecolor1 ) 
-                 ? ( $color = $linecolor2 )
-                 : ( $color = $linecolor1 );
-               $ri{color} = $color;
-               my $barcode = $returneditems{$_};
-               my $duedate = $riduedate{$_};
-               my $overduetext;
-               my $borrowerinfo;
-               if ($duedate) {
-                       my @tempdate = split ( /-/, $duedate );
-               $ri{year}=$tempdate[0];
-               $ri{month}=$tempdate[1];
-               $ri{day}=$tempdate[2];
-                       my $duedatenz  = 
"$tempdate[2]/$tempdate[1]/$tempdate[0]";
-                       my @datearr    = localtime( time() );
-                       my $todaysdate =
-                         $datearr[5] . '-'
-                         . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
-                         . sprintf( "%0.2d", $datearr[3] );
-               $ri{duedate}=$duedate;
-                       my ($borrower) =
-                         getpatroninformation( \%env, $riborrowernumber{$_}, 0 
);
-                       $ri{bornum}       = $borrower->{'borrowernumber'};
-                       $ri{borcnum}      = $borrower->{'cardnumber'};
-                       $ri{borfirstname} = $borrower->{'firstname'};
-                       $ri{borsurname}   = $borrower->{'surname'};
-                       $ri{bortitle}     = $borrower->{'title'};
-               } else { $ri{bornum} = $riborrowernumber{$_}; }
-
+    my %ri;
+    if ( $count < 8 ) {
+        ( $color eq $linecolor1 ) 
+          ? ( $color = $linecolor2 )
+          : ( $color = $linecolor1 );
+        $ri{color} = $color;
+        my $barcode = $returneditems{$_};
+        my $duedate = $riduedate{$_};
+        my $overduetext;
+        my $borrowerinfo;
+        if ($duedate) {
+            my @tempdate = split ( /-/, $duedate );
+           $ri{year}=$tempdate[0];
+           $ri{month}=$tempdate[1];
+           $ri{day}=$tempdate[2];
+            my $duedatenz  = "$tempdate[2]/$tempdate[1]/$tempdate[0]";
+            my @datearr    = localtime( time() );
+            my $todaysdate =
+              $datearr[5] . '-'
+              . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
+              . sprintf( "%0.2d", $datearr[3] );
+           $ri{duedate}=$duedate;
+            my ($borrower) =
+              getpatroninformation( \%env, $riborrowernumber{$_}, 0 );
+            $ri{bornum}       = $borrower->{'borrowernumber'};
+            $ri{borcnum}      = $borrower->{'cardnumber'};
+            $ri{borfirstname} = $borrower->{'firstname'};
+            $ri{borsurname}   = $borrower->{'surname'};
+            $ri{bortitle}     = $borrower->{'title'};
+        }
+        else {
+            $ri{bornum} = $riborrowernumber{$_};
+        }
 #        my %ri;
-               my ($iteminformation) = getiteminformation( \%env, 0, $barcode 
);
-               $ri{color}            = $color;
-               $ri{itembiblionumber} = $iteminformation->{'biblionumber'};
-               $ri{itemtitle}        = $iteminformation->{'title'};
-               $ri{itemauthor}       = $iteminformation->{'author'};
-               $ri{itemtype}         = $iteminformation->{'itemtype'};
-               $ri{barcode}          = $barcode;
-       } else { last; }
-
-       $count++;
-       push ( @riloop, \%ri );
+        my ($iteminformation) = getiteminformation( \%env, 0, $barcode );
+        $ri{color}            = $color;
+        $ri{itembiblionumber} = $iteminformation->{'biblionumber'};
+        $ri{itemtitle}        = $iteminformation->{'title'};
+        $ri{itemauthor}       = $iteminformation->{'author'};
+        $ri{itemtype}         = $iteminformation->{'itemtype'};
+        $ri{barcode}          = $barcode;
+    }
+    else {
+        last;
+    }
+    $count++;
+    push ( @riloop, \%ri );
 }
 $template->param( riloop => address@hidden );
 
 $template->param(
-       genbrname  => $branches->{$branch}->{'branchname'},
-       genprname  => $printers->{$printer}->{'printername'},
-       branch     => $branch,
-       printer    => $printer,
-       errmsgloop => address@hidden
+    genbrname  => $branches->{$branch}->{'branchname'},
+    genprname  => $printers->{$printer}->{'printername'},
+    branch     => $branch,
+    printer    => $printer,
+    errmsgloop => address@hidden
 );
 
 # actually print the page!
 output_html_with_http_headers $query, $cookie, $template->output;
 
 sub cuecatbarcodedecode {
-       my ($barcode) = @_;
-       chomp($barcode);
-       my @fields = split ( /\./, $barcode );
-       my @results = map( decode($_), @fields[ 1 .. $#fields ] );
-       if ( $#results == 2 ) {
-               return $results[2];
-       } else { return $barcode; }
+    my ($barcode) = @_;
+    chomp($barcode);
+    my @fields = split ( /\./, $barcode );
+    my @results = map( decode($_), @fields[ 1 .. $#fields ] );
+    if ( $#results == 2 ) {
+        return $results[2];
+    }
+    else {
+        return $barcode;
+    }
 }
 
 # Local Variables:
--- returns.tmpl        2005-02-02 09:57:59.657994936 -0300
+++ returns.tmpl.orig   2005-02-02 09:51:57.503050856 -0300
@@ -133,7 +133,7 @@
                        <p>Title: <!-- TMPL_VAR NAME="itemtitle" --></p>
                        <h2 class="circulation">Borrower Information</h2>
                        <p>
-                       <a 
href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="ribornum" 
-->" onclick="openWindow('/cgi-bin/koha/members/moremember.pl?bornum=<!-- 
TMPL_VAR NAME="ribornum" -->','Member'); return false;">
+                       <a href="/cgi-bin/koha/moremember.pl?bornum=<!-- 
TMPL_VAR NAME="ribornum" -->" 
onclick="openWindow('/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR 
NAME="ribornum" -->','Member'); return false;">
                                <!-- TMPL_VAR NAME="riborcnum" -->
                        </a>
                        <!-- TMPL_VAR NAME="riborsurname" -->, <!-- TMPL_VAR 
NAME="ribortitle" --> <!-- TMPL_VAR NAME="riborfirstname" --></p>
@@ -212,7 +212,7 @@
                                        <td><!-- TMPL_VAR NAME="itemtype" 
--></td>
                                        <td>
                                        <!-- TMPL_IF Name="duedate" -->
-                                               <a 
href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME="bornum" 
-->" onclick="openWindow('/cgi-bin/koha/members/moremember.pl?bornum=<!-- 
TMPL_VAR NAME="bornum" -->','Member'); return false;">
+                                               <a 
href="/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR NAME="bornum" -->" 
onclick="openWindow('/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR 
NAME="bornum" -->','Member'); return false;">
                                                        <!-- TMPL_VAR 
NAME="borcnum" -->
                                                </a> <!-- TMPL_VAR 
NAME="borfirstname" --> <!-- TMPL_VAR NAME="borsurname" -->
                                        <!-- TMPL_ELSE -->

reply via email to

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