koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/circ returns.pl,1.34,1.35


From: Chris Cormack
Subject: [Koha-cvs] CVS: koha/circ returns.pl,1.34,1.35
Date: Wed, 25 Feb 2004 13:44:43 -0800

Update of /cvsroot/koha/koha/circ
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8745/circ

Modified Files:
        returns.pl 
Log Message:
fix for bug 606,
seems to be an error in the tmpl still but the functionality seems to be 
working again


Index: returns.pl
===================================================================
RCS file: /cvsroot/koha/koha/circ/returns.pl,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** returns.pl  18 Feb 2004 16:51:20 -0000      1.34
--- returns.pl  25 Feb 2004 21:44:40 -0000      1.35
***************
*** 7,11 ****
  #script to execute returns of books
  
- 
  # Copyright 2000-2002 Katipo Communications
  #
--- 7,10 ----
***************
*** 37,62 ****
  use C4::Koha;
  
! my $query=new CGI;
  #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},
!                          });
  
  #####################
  #Global vars
  my %env;
! my $headerbackgroundcolor='#99cc33';
! my $linecolor1='#ffffcc';
! my $linecolor2='white';
  
  my $branches = getbranches();
! my $printers = getprinters(\%env);
  
! my $branch = getbranch($query, $branches);
! my $printer = getprinter($query, $printers);
  
  #
--- 36,64 ----
  use C4::Koha;
  
! my $query = new CGI;
! 
  #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 },
!     }
! );
  
  #####################
  #Global vars
  my %env;
! my $headerbackgroundcolor = '#99cc33';
! my $linecolor1            = '#ffffcc';
! my $linecolor2            = 'white';
  
  my $branches = getbranches();
! my $printers = getprinters( \%env );
  
! my $branch  = getbranch( $query,  $branches );
! my $printer = getprinter( $query, $printers );
  
  #
***************
*** 64,72 ****
  #
  
! 
! $env{'branchcode'}=$branch;
! $env{'printer'}=$printer;
! $env{'queue'}=$printer;
! 
  
  # Set up the item stack ....
--- 66,72 ----
  #
  
! $env{'branchcode'} = $branch;
! $env{'printer'}    = $printer;
! $env{'queue'}      = $printer;
  
  # Set up the item stack ....
***************
*** 75,129 ****
  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);
  }
  
  ############
  # 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');
!     printslip(\%env, $slip);
!     if ($tobranchcd ne $branch) {
!               $template->param(       itemtitle => $iteminfo->{'title'},
!                                                                               
iteminfo => $iteminfo->{'author'},
!                                                                               
branchname => $branchname,
!                                                                               
name => $name,
!                                                                               
bornum => $borrnum,
!                                                                               
borcnum => $borcnum,
!                                                                               
diffbranch => 1);
      }
  }
  
- 
  my $iteminformation;
  my $borrower;
--- 75,136 ----
  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 );
  }
  
  ############
  # 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');
!     printslip( \%env, $slip );
! 
!     if ( $tobranchcd ne $branch ) {
!         $template->param(
!             itemtitle  => $iteminfo->{'title'},
!             iteminfo   => $iteminfo->{'author'},
!             branchname => $branchname,
!             name       => $name,
!             bornum     => $borrnum,
!             borcnum    => $borcnum,
!             diffbranch => 1
!         );
      }
  }
  
  my $iteminformation;
  my $borrower;
***************
*** 131,237 ****
  my $messages;
  my $barcode = $query->param('barcode');
  # 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'},
! #                                                                     itembc 
=> $iteminformation->{'barcode'},
! #                                                                     
itemdatedue => $iteminformation->{'datedue'},
!                                                                       
itemauthor => $iteminformation->{'author'});
  }
! $template->param(inputloop => address@hidden);
  
  
! my $found=0;
! my $waiting=0;
! 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
!                                                                               
);
      }
  }
--- 138,258 ----
  my $messages;
  my $barcode = $query->param('barcode');
+ 
  # 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'},
! 
!         #                                                                     
itembc => $iteminformation->{'barcode'},
!         #                                                                     
itemdatedue => $iteminformation->{'datedue'},
!         itemauthor => $iteminformation->{'author'}
!     );
  }
! $template->param( inputloop => address@hidden );
  
+ my $found    = 0;
+ my $waiting  = 0;
+ 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
!         );
      }
  }
***************
*** 239,277 ****
  # 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;
  }
! $template->param(errmsgloop => address@hidden);
  
  # patrontable ....
--- 260,308 ----
  # 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;
  }
! $template->param( errmsgloop => address@hidden );
  
  # patrontable ....
***************
*** 279,389 ****
      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;
!               } 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);
!                       }
!                       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);
!                       }
!                       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='';
! #set up so only the lat 8 returned items display (make for faster loading 
pages)
! 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 ) ;
!             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]);
!               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);
  }
! $template->param(riloop => address@hidden);
  
! $template->param(     genbrname => $branches->{$branch}->{'branchname'},
!                       genprname => $printers->{$printer}->{'printername'},
!                       branch => $branch,
!                       printer => $printer,
!                       errmsgloop => address@hidden
!               );
  
  # actually print the page!
--- 310,448 ----
      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;
!         }
!         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 = '';
! 
! #set up so only the last 8 returned items display (make for faster loading 
pages)
! 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;
!         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
! );
  
  # actually print the page!
***************
*** 393,403 ****
      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:
--- 452,464 ----
      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:




reply via email to

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