koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha catalogue/catalogue-search.pl cataloguing/...


From: paul poulain
Subject: [Koha-cvs] koha catalogue/catalogue-search.pl cataloguing/...
Date: Fri, 09 Mar 2007 14:46:11 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     paul poulain <tipaul>   07/03/09 14:46:10

Removed files:
        catalogue      : catalogue-search.pl 
        cataloguing    : isbnsearch.pl 
        circ           : renewscript.pl rescirculation.pl resreturns.pl 

Log message:
        rel_3_0 moved to HEAD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/catalogue-search.pl?cvsroot=koha&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/isbnsearch.pl?cvsroot=koha&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/circ/renewscript.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/circ/rescirculation.pl?cvsroot=koha&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/circ/resreturns.pl?cvsroot=koha&r1=1.2&r2=0

Patches:
Index: catalogue/catalogue-search.pl
===================================================================
RCS file: catalogue/catalogue-search.pl
diff -N catalogue/catalogue-search.pl
--- catalogue/catalogue-search.pl       15 Nov 2006 01:41:51 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,268 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-use CGI;
-use C4::Search;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use C4::Biblio;
-use C4::Koha;
-use POSIX qw(ceil floor);
-
-my $query = new CGI;
-my $dbh = C4::Context->dbh;
-
-my $op = $query->param('op'); #show the search form or execute the search
-
-my $format=$query->param('MARC');
-my ($template, $borrowernumber, $cookie);
-
-# get all the common search variables, 
-my @value=$query->param('value');
-my @kohafield=$query->param('kohafield');
-my @and_or=$query->param('and_or');
-my @relation=$query->param('relation');
-my $order=$query->param('order');
-my $reorder=$query->param('reorder');
-my $number_of_results=$query->param('number_of_results');
-my $zoom=$query->param('zoom');
-my $ascend=$query->param('asc');
-my $searchtype=$query->param('searchtype'); ## this is actual query type
-
-my @marclist = $query->param('marclist');
-# collect all the fields ...
-my %search;
-my @forminputs;                #this is for the links to navigate among the 
results
-my (@searchdesc, %hashdesc,$facetsdesc);       #this is to show the 
description of the current search
-my @fields = ('value', 'kohafield', 'and_or', 
'relation','order','barcode','biblionumber','itemnumber','asc','from','searchtype');
-
-###Collect all the marclist values coming from old Koha MARCdetails
-## Although we can not search on all marc fields- if any is matched in Zebra 
we can use it 
-my $sth=$dbh->prepare("Select kohafield from koha_attr where tagfield=? and 
tagsubfield=? and intrashow=1");
-foreach my $marc (@marclist) {
-               if ($marc) {
-               $sth->execute(substr($marc,0,3),substr($marc,3,1));
-                       if ((my $kohafield)=$sth->fetchrow){
-                       push @kohafield,$kohafield;
-                       push @and_or,"address@hidden";
-                       push @value,@value[0] if @kohafield>1;
-                       push @relation ,"address@hidden 5=1";
-                       }
-               }
-}
-#### Now   normal search routine
-foreach my $field (@fields) {
-       $search{$field} = $query->param($field);
-       my @fieldvalue = $query->param($field);
-       foreach my $fvalue (@fieldvalue) {
-               push @forminputs, { field=>$field ,value=> $fvalue} unless 
($field eq 'reorder');
-               
-         }
-}
-## Build the query for facets as well
- for (my $i=0;$i<@value;$i++){
-$facetsdesc.="&value=".$value[$i];
-$facetsdesc.="&kohafield=".$kohafield[$i];
-$facetsdesc.="&relation=".$relation[$i];
-$facetsdesc.="&and_or=".$and_or[$i];
-}
-$facetsdesc.="&order=".$order;
-$hashdesc{'query'} = join " , ", @value;
-push @searchdesc,\%hashdesc;
-
-
-############################################################################
-if ($op eq "do_search"){
- 
-#this fields is just to allow the user come back to the search form with all 
the values  previously entered
-$search{'search_type'} = $query->param('search_type');# this is the panel type
-push @forminputs, {field => 'search_type', value => $search{'search_type'}};
-
-
-       ($template, $borrowernumber, $cookie)
-               = get_template_and_user({template_name => 
"catalogue/catalogue_searchresults.tmpl",
-                                        query => $query,
-                                        type => "intranet",
-                                        authnotrequired => 1,
-       });
-
-       $search{'from'} = 'intranet';
-       $search{'borrowernumber'} = $borrowernumber;
-       $search{'remote_IP'} = $query->remote_addr();
-       $search{'remote_URL'} = $query->url(-query=>1);
-       $search{'searchdesc'} = address@hidden;
-       $template->param(FORMINPUTS => address@hidden);
-       $template->param(reorder => $query->param('reorder'));
-       $template->param(facetsdesc=>$facetsdesc);
-       # do the searchs ....
-        $number_of_results = 10 unless $number_of_results;
-       my $startfrom=$query->param('startfrom');
-       ($startfrom) || ($startfrom=0);
-my ($count,@results,$facets);
-if (!$zoom){
-## using sql search for barcode,biblionumber or itemnumber only useful for 
libraian interface
-       ($count, @results) =sqlsearch($dbh,\%search);
-}else{
-my $sortorder=$order.$ascend if $order;
- ($count,$facets,@results) 
=ZEBRAsearch_kohafields(address@hidden,address@hidden, 
address@hidden,$sortorder, address@hidden, 1,$reorder,$startfrom, 
$number_of_results,"intranet",$searchtype);
-}
-       if ( $count eq "error"){
-       $template->param(error =>1);
-       goto "show";
-       }
-       my $num = scalar(@results) - 1;
-if ( $count == 1){
-    # if its a barcode search by definition we will only have one result.
-    # And if we have a result
-    # lets jump straight to the detail.pl page
-       if ($format eq '1') {
-    print 
$query->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?type=intra&biblionumber=$results[0]->{'biblionumber'}");
-       }else{
-    print 
$query->redirect("/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=$results[0]->{'biblionumber'}");
-       }
-}
-       # sorting out which results to display.
-       # the result number to star to show
-       $template->param(startfrom => $startfrom);
-       $template->param(beginning => $startfrom+1);
-       # the result number to end to show
-       ($startfrom+$num<=$count) ? ($template->param(endat => 
$startfrom+$num+1)) : ($template->param(endat => $count));
-       # the total results searched
-       $template->param(numrecords => $count);
-       $template->param(FORMINPUTS => address@hidden );
-       $template->param(searchdesc => address@hidden );
-       $template->param(SEARCH_RESULTS => address@hidden,
-                       facets_loop => $facets,
-                       );
-
-       #this is to show the images numbers to navigate among the results, if 
it has to show the number highlighted or not
-       my $numbers;
-       @$numbers = ();
-       my $pg = 1;
-       if (defined($query->param('pg'))) {
-               $pg = $query->param('pg');
-       }
-       my $start = 0;
-       
-       $start = ($pg - 1) * $number_of_results;
-       my $pages = ceil($count / $number_of_results);
-       my $total_pages = ceil($count / $number_of_results);
-
-       if ($pg > 1) {
-               my $url = $pg - 1;
-               push @$numbers, { number => "&lt;&lt;", 
-                                             highlight => 0 , 
-                                             startfrom => 0, 
-                                             pg => '1' };
-               push @$numbers, { number => "&lt;", 
-                                                 highlight => 0 , 
forminputs=>address@hidden,
-                                                 startfrom => 
($url-1)*$number_of_results+1, 
-                                                 pg => $url };
-       }
-       my $current_ten = $pg / 10;
-       if ($current_ten == 0) {
-                $current_ten = 0.1;           # In case it´s in ten = 0
-       } 
-       my $from = $current_ten * 10; # Calculate the initial page
-       my $end_ten = $from + 9;
-       my $to;
-       if ($pages > $end_ten) {
-               $to = $end_ten;
-       } else {
-               $to = $pages;
-       }
-       for (my $i = $from; $i <= $to ; $i++) {
-               if ($i == $pg) {   
-                       if ($count > $number_of_results) {
-                               push @$numbers, { number => $i, 
-                                                                 highlight => 
1 , forminputs=>address@hidden,
-                                                                 startfrom => 
($i-1)*$number_of_results , 
-                                                                 pg => $i };
-                       }
-               } else {
-                       push @$numbers, { number => $i, 
-                                                         highlight => 0 , 
forminputs=>address@hidden,
-                                                         startfrom => 
($i-1)*$number_of_results , 
-                                                         pg => $i };
-               }
-       }                                                       
-       if ($pg < $pages) {
-               my $url = $pg + 1;
-               push @$numbers, { number => "&gt;", 
-                                                 highlight => 0 , 
forminputs=>address@hidden,
-                                                 startfrom => 
($url-1)*$number_of_results, 
-                                                 pg => $url };
-               push @$numbers, { number => "&gt;&gt;", 
-                                                 highlight => 0 , 
forminputs=>address@hidden,
-                                                 startfrom => 
($total_pages-1)*$number_of_results, 
-                                                 pg => $total_pages};
-       }
-#      push @$numbers,{forminputs=>@forminputs};
-       $template->param(numbers =>$numbers,
-                       );
-       #show the virtual shelves
-       #my $results = &GetShelfList($borrowernumber);
-       #$template->param(shelvescount => scalar(@{$results}));
-       #$template->param(shelves => $results);
-
-########
-if ($format eq '1') {
-       $template->param(script => "catalogue/MARCdetail.pl");
-}else{
-       $template->param(script => "catalogue/detail.pl");
-}
-
-}else{ ## No search yet
-($template, $borrowernumber, $cookie)
-               = get_template_and_user({template_name => 
"catalogue/catalogue_search.tmpl",
-                                       query => $query,
-                                       type => "intranet",
-                                       authnotrequired => 1,
-                               });
-#show kohafields
-       my $kohafield = $query->param('kohafield');
-       my ($fieldcount,@kohafields)=getkohafields();
-       foreach my $row (@kohafields) {
-               if ($kohafield eq $row->{'kohafield'}) {
-                       $row->{'sel'} = 1;
-               }
-       }
-       $template->param(kohafields => address@hidden);
-##show sorting fields
-my @sorts;
- $order=$query->param('order');
-       foreach my $sort (@kohafields) {
-           if ($sort->{sorts}){
-               push @sorts,$sort;
-               if ($order eq $sort->{'kohafield'}) {
-                       $sort->{'sel'} = 1;
-               }
-          }
-       }
-       $template->param(sorts => address@hidden);
-# load the branches
-my @branches = GetallBranches();
-$template->param(branchloop => address@hidden,);
-
-# load the itemtypes 
-my $itemtypes=GetItemTypes();
-my (@item_type_loop);
-foreach my $thisitemtype (sort keys %$itemtypes) {
-    my %row =(itemtype => $thisitemtype,
-                 description => $itemtypes->{$thisitemtype}->{'description'},
-            );
-    push @item_type_loop, \%row;
-}
-
-$template->param(itemtypeloop=>address@hidden,);
-my $search_type = $query->param('search_type');
-       if ((!$search_type) || ($search_type eq 'zoom'))  {
-               $template->param(zoom_search => 1);
-       } else{
-               $template->param(sql_search => 1);
-       } 
-}
-
-show:
-output_html_with_http_headers $query, $cookie, $template->output();
-

Index: cataloguing/isbnsearch.pl
===================================================================
RCS file: cataloguing/isbnsearch.pl
diff -N cataloguing/isbnsearch.pl
--- cataloguing/isbnsearch.pl   27 Sep 2006 21:19:21 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,190 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-
-use C4::Auth;
-use C4::Biblio;
-use C4::Search;
-use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Breeding;
-use C4::Koha;
-
-my $input      = new CGI;
-my $isbn       = $input->param('isbn');
-my $title      = $input->param('title');
-my $offset     = $input->param('offset');
-my $num        = $input->param('num');
-my $showoffset = $offset + 1;
-my $total;
-my $count;
-my @results;
-my $facets;
-my %search;
-my $toggle;
-my $marc_p = C4::Context->boolean_preference("marc");
-my $SQLorZEBRA=C4::Context->preference("SQLorZEBRA");
-if ( !$isbn && !$title ) {
-    print $input->redirect('addbooks.pl');
-}
-else {
-    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-        {
-            template_name   => "cataloguing/isbnsearch.tmpl",
-            query           => $input,
-            type            => "intranet",
-            authnotrequired => 0,
-            flagsrequired   => { editcatalogue => 1 },
-            debug           => 1,
-        }
-    );
-
-    # fill with books in ACTIVE DB (biblio)
-    if ( !$offset ) {
-        $offset     = 0;
-        $showoffset = 1;
-    }
-    if ( !$num ) { $num = 10 }
-my @kohafield;
-my @value;
-my @relation;
-my @and_or;
-my $order="title,1";
-if ($isbn){
-$search{'isbn'}=$isbn;
-push @kohafield, "isbn";
-push @value,$isbn;
-}else{
-$search{'title'}=$title;
-push @kohafield, "title";
-push @value,$title;
-push @relation, "address@hidden 5=1 address@hidden 6=3 address@hidden 4=1 
address@hidden 3=1 ";
-  }
-$search{avoidquerylog}=1;
-if ($SQLorZEBRA eq "sql"){
-($count, @results) =cataloguing_search(\%search,$num,$offset);
-}else{
-($count,$facets,@results) 
=ZEBRAsearch_kohafields(address@hidden,address@hidden, address@hidden,$order, 
address@hidden, 1,"",$offset, $num,"intranet");
-
-}
-my $grandtotal=$count;
-    if ( $count < ( $offset + $num ) ) {
-        $total = $count;
-    }
-    else {
-        $total = $offset + $num;
-    }    # else
-
-    my @loop_data;
- 
- @address@hidden if $count >0;;
-    $template->param( startfrom => $offset + 1 );
-    ( $offset + $num <= $count )
-      ? ( $template->param( endat => $offset + $num ) )
-      : ( $template->param( endat => $count ) );
-    $template->param( numrecords => $count );
-    my $nextstartfrom = ( $offset + $num < $count ) ? ( $offset + $num ) : 
(-1);
-    my $prevstartfrom = ( $offset - $num >= 0 ) ? ( $offset - $num ) : (-1);
-    $template->param( nextstartfrom => $nextstartfrom );
-    my $displaynext = 1;
-    my $displayprev = 0;
-    ( $nextstartfrom == -1 ) ? ( $displaynext = 0 ) : ( $displaynext = 1 );
-    ( $prevstartfrom == -1 ) ? ( $displayprev = 0 ) : ( $displayprev = 1 );
-    $template->param( displaynext => $displaynext );
-    $template->param( displayprev => $displayprev );
-    my @numbers = ();
-    my $term;
-    my $value;
-
-    if ($isbn) {
-        $term  = "isbn";
-        $value = $isbn;
-    }
-    else {
-        $term  = "title";
-        $value = $title;
-    }
-    if ( $count > 10 ) {
-        for ( my $i = 1 ; $i < $count / 10 + 1 ; $i++ ) {
-            if ( $i < 16 ) {
-                my $highlight = 0;
-                ( $offset == ( $i - 1 ) * 10 ) && ( $highlight = 1 );
-                push @numbers,
-                  {
-                    number    => $i,
-                    highlight => $highlight,
-                    term      => $term,
-                    value     => $value,
-                    startfrom => ( $i - 1 ) * 10
-                };
-            }
-        }
-    }
-
-    # fill with books in breeding farm
-    ( $count, @results ) = BreedingSearch( $title, $isbn );
-    my @breeding_loop = ();
-    for ( my $i = 0 ; $i <= $#results ; $i++ ) {
-        my %row_data;
-        if ( $i % 2 ) {
-            $toggle = "#ffffcc";
-        }
-        else {
-            $toggle = "white";
-        }
-        $row_data{toggle} = $toggle;
-        $row_data{id}     = $results[$i]->{'id'};
-        $row_data{isbn}   = $results[$i]->{'isbn'};
-        $row_data{file}   = $results[$i]->{'file'};
-        $row_data{title}  = $results[$i]->{'title'};
-        $row_data{author} = $results[$i]->{'author'};
-       $row_data{classification} = $results[$i]->{'classification'};
-       $row_data{subclass} = $results[$i]->{'subclass'};
-          push ( @breeding_loop, \%row_data );
-    }
-# get framework list
-       my $frameworks = getframeworks;
-       my @frameworkcodeloop;
-       foreach my $thisframeworkcode (keys %$frameworks) {
-               my %row =(value => $thisframeworkcode,
-                                       frameworktext => 
$frameworks->{$thisframeworkcode}->{'frameworktext'},
-                               );
-               push @frameworkcodeloop, \%row;
-       }
-
-
-    $template->param(
-        isbn          => $isbn,
-        title         => $title,
-        showoffset    => $showoffset,
-        total         => $total,
-       grandtotal         => $grandtotal,
-        offset        => $offset,
-        results_loop          => address@hidden,
-        breeding_loop => address@hidden,
-        numbers       => address@hidden,
-        term          => $term,
-        value         => $value,
-       frameworkcodeloop => address@hidden
-    );
-
-  output_html_with_http_headers $input, $cookie, $template->output;
-}    # else

Index: circ/renewscript.pl
===================================================================
RCS file: circ/renewscript.pl
diff -N circ/renewscript.pl
--- circ/renewscript.pl 11 Sep 2006 17:41:55 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: renewscript.pl,v 1.2 2006/09/11 17:41:55 tgarip1957 Exp $
-
-#written 18/1/2000 by address@hidden
-#script to renew items from the web
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use CGI;
-use C4::Circulation::Circ2;
-use C4::Date;
-use C4::Members;
-#get input
-my $input= new CGI;
-
-
-my @names=$input->param();
-my address@hidden;
-my %data;
-my $dbh = C4::Context->dbh;
-for (my $i=0;$i<$count;$i++){
-  if ($names[$i] =~ /renew/){
-    my $temp=$names[$i];
-    $temp=~ s/renew_item_//;
-    $data{$temp}=$input->param($names[$i]);
-  }
-}
-my %env;
-my $barcode;
-my $destination = $input->param("destination");
-my $cardnumber = $input->param("cardnumber");
-my $bornum=$input->param("bornum");
-my $error;
-my $status=0;
-while ( my ($itemno, $value) = each %data) {
-
-   if ($value eq 'y'){
-my $iteminformation = getiteminformation($env, $itemno,0);
-$barcode=$iteminformation->{'barcode'};
-        $status=renewstatus(\%env,$bornum,$itemno);
-       if ($status==1){
-     renewbook($env,$bornum,$itemno);  
-       }else{
-       last;
-       }   
-}
-}
-
-if($destination eq "circ" || $status>1){
-       print 
$input->redirect("/cgi-bin/koha/circ/circulation.pl?bornum=$bornum&error=$status&barcode=$barcode");
-} else {
-       print 
$input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$bornum");
-}
\ No newline at end of file

Index: circ/rescirculation.pl
===================================================================
RCS file: circ/rescirculation.pl
diff -N circ/rescirculation.pl
--- circ/rescirculation.pl      15 Nov 2006 01:41:51 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,460 +0,0 @@
-#!/usr/bin/perl
-
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
-#written 8/5/2002 by Finlay
-#script to execute issuing of books
-# New functions added 07-08-2005 Tumer Garip address@hidden
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Circulation::Circ3;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use C4::Koha;
-use C4::Date;
-use C4::Context;
-use C4::Members;
-use C4::Print;
-#
-# PARAMETERS READING
-#
-my $query=new CGI;
-
-my ($template, $loggedinuser, $cookie) = get_template_and_user
-    ({
-       template_name   => 'circ/rescirculation.tmpl',
-       query           => $query,
-       type            => "intranet",
-       authnotrequired => 0,
-       flagsrequired   => { circulate => 1 },
-    });
-my $branches = GetBranches();
-my $printers = getprinters();
-my $branch=C4::Context->preference("defaultBranch");
-my $printer = getprinter($query, $printers);
-
-my $findborrower = $query->param('findborrower');
-$findborrower =~ s|,| |g;
-$findborrower =~ s|'| |g;
-my $borrowernumber = $query->param('borrnumber');
-
-my $print=$query->param('print');
-my $barcode = $query->param('barcode');
-my $year=$query->param('year');
-my $month=$query->param('month');
-my $day=$query->param('day');
-my $stickyduedate=$query->param('stickyduedate');
-my $issueconfirmed = $query->param('issueconfirmed');
-my $cancelreserve = $query->param('cancelreserve');
-
-my $renew=0;
- 
-#set up cookie.....
-my $branchcookie;
-my $printercookie;
-#if ($query->param('setcookies')) {
-#      $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", 
-expires=>'+1y');
-#      $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", 
-expires=>'+1y');
-#}
-
-my %env; # FIXME env is used as an "environment" variable. Could be dropped 
probably...
-
-$env{'branchcode'}=$branch;
-$env{'printer'}=$printer;
-$env{'queue'}=$printer;
-
-my $todaysdate =get_today();
-
-
-# check and see if we should print
- if ($barcode eq ''  && $print eq 'maybe'){
-       $print = 'yes';
- }
- if ($print eq 'yes' && $borrowernumber ne ''){
-       printslip(\%env,$borrowernumber);
-       $query->param('borrnumber','');
-       $borrowernumber='';
- }
-
-#
-# STEP 2 : FIND BORROWER
-# if there is a list of find borrowers....
-#
-my $borrowerslist;
-my $message;
-if ($findborrower) {
-       my 
($count,$borrowers)=BornameSearch(\%env,$findborrower,'cardnumber','web');
-       my @address@hidden;
-       if ($#borrowers == -1) {
-               $query->param('findborrower', '');
-               $message =  "'$findborrower'";
-       } elsif ($#borrowers == 0) {
-               $query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
-               $query->param('barcode','');
-               $borrowernumber=$borrowers[0]->{'borrowernumber'};
-       } else {
-               $borrowerslist = address@hidden;
-       }
-}
-
-# get the borrower information.....
-my $borrower;
-my $bornum=$query->param('bornum');
-if ($bornum){
-$borrowernumber=$bornum;
-}
-
-if ($borrowernumber) {
-       $borrower = 
C4::Circulation::Circ2::getpatroninformation(\%env,$borrowernumber,0);
-       my ($od,$issue,$fines,$resfine)=borrdata3(\%env,$borrowernumber);
-if ($resfine >0 || $fines) {
-$template->param(
-                       flagged => 1,
-                       noissues => 'true',
-                        );
-}
-       $template->param(overduecount => $od,
-                                                       issuecount => $issue,
-                                                       finetotal => $fines,
-                                                       resfine => $resfine);
-my $picture;
- my $htdocs = C4::Context->config('opacdir');
-
-$picture =$htdocs. 
"/htdocs/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg";
- if (-e $picture)
-{ 
-
-   $template->param(borrowerphoto => 
"http://library.neu.edu.tr/uploaded-files/users-photo/".$borrower->{'cardnumber'}.".jpg");
- }else{
-$picture = 
"http://cc.neu.edu.tr/stdpictures/".$borrower->{'cardnumber'}.".jpg";
-  $template->param(borrowerphoto => $picture);
-}
-}
-$renew=$query->param('renew');
-
-#
-# STEP 3 : ISSUING
-#
-#Try to issue
-
-if ($barcode) {
-
-       $barcode = cuecatbarcodedecode($barcode);
-#      my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
-       if ($issueconfirmed) {
-                       issuebook(\%env, $borrower, $barcode, $cancelreserve);
-my ($od,$issue,$fines,$resfine)=borrdata3(\%env,$borrowernumber);
-       $template->param(overduecount => $od,
-                                                       issuecount => $issue,
-                                                       finetotal => $fines,
-                                                       resfine => $resfine);
-       } else {
-               my ($error, $question) = canbookbeissued(\%env, $borrower, 
$barcode, $year, $month, $day);
-               my $noerror=1;
-               my $noquestion = 1;
-               foreach my $impossible (keys %$error) {
-                       $template->param($impossible => $$error{$impossible},
-                                                       IMPOSSIBLE => 1);
-                       $noerror = 0;
-               }
-               foreach my $needsconfirmation (keys %$question) {
-                       $template->param($needsconfirmation => 
$$question{$needsconfirmation},
-                                                       NEEDSCONFIRMATION => 1);
-                       $noquestion = 0;
-               }
-               $template->param(day => $day,
-                                               month => $month,
-                                               year => $year);
-               if ($noerror && ($noquestion || $issueconfirmed)) {
-                       issuebook(\%env, $borrower, $barcode);
-                       my 
($od,$issue,$fines,$resfine)=borrdata3(\%env,$borrowernumber);
-                               $template->param(overduecount => $od,
-                                                       issuecount => $issue,
-                                                       finetotal => $fines,
-                                                       resfine => $resfine);
-               }
-       }
-       }#barcode
-
-
-
-
-
-##################################################################################
-# BUILD HTML
-
-# make the issued books table.....
-my $todaysissues='';
-my $previssues='';
-my @realtodayissues;
-my @realprevissues;
-my $allowborrow;
-if ($borrower) {
-# get each issue of the borrower & separate them in todayissues & previous 
issues
-       my @todaysissues;
-       my @previousissues;
-       my $issueslist = getissues($borrower);
-       
-       # split in 2 arrays for today & previous
-       foreach my $it (keys %$issueslist) {
-               my $issuedate = $issueslist->{$it}->{'timestamp'};
-               $issuedate = substr($issuedate, 0, 10);
-#warn "$todaysdate,$issuedate";
-               if ($todaysdate == $issuedate) {
-                       push @todaysissues, $issueslist->{$it};
-               } else {
-                       push @previousissues, $issueslist->{$it};
-               }
-    }
-
-
-       my $od; # overdues
-       my $togglecolor;
-       # parses today & build Template array
-       foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} 
@todaysissues){
-               my $dd = $book->{'duetime'};
-               my $overdue = $book->{'overdue'};
-#              $dd=format_date($dd);
-#              $datedue=~s/-//g;
-               if ($overdue) {
-                       $od = 1;
-               } else {
-                       $od=0;
-               }
-               $book->{'od'}=$od;
-               $book->{'dd'}=$dd;
-               
-               if ($togglecolor) {
-                       $togglecolor=0;
-               } else {
-                       $togglecolor=1;
-               }
-               $book->{'tcolor'}=$togglecolor;
-               if ($book->{'author'} eq ''){
-                       $book->{'author'}=' ';
-               }    
-               push @realtodayissues,$book;
-       }
-
-       # parses previous & build Template array
-    foreach my $book (sort {$a->{'date_due'} cmp $b->{'date_due'}} 
@previousissues){
-               my $dd = $book->{'duedate'};
-               my $overdue = $book->{'overdue'};
-#              $dd=format_date($dd);
-               my $pcolor = '';
-               my $od = '';
-#              $datedue=~s/-//g;
-               if ($overdue) {
-                       $od = 1;
-               } else {
-                       $od = 0;
-               }
-               
-               if ($togglecolor) {
-                       $togglecolor=0;
-               } else {
-                       $togglecolor=1;
-               }
-               $book->{'dd'}=$dd; 
-               $book->{'od'}=$od;
-               $book->{'tcolor'}=$togglecolor;
-               if ($book->{'author'} eq ''){
-                       $book->{'author'}=' ';
-               }    
-               push @realprevissues,$book
-       }
-}
-
-
-my @values;
-my %labels;
-my $CGIselectborrower;
-if ($borrowerslist) {
-       foreach (sort {$a->{'surname'}.$a->{'firstname'} cmp 
$b->{'surname'}.$b->{'firstname'}} @$borrowerslist){
-               push @values,$_->{'borrowernumber'};
-               $labels{$_->{'borrowernumber'}} ="$_->{'surname'}, 
$_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'}) ...  
$_->{'streetaddress'} ";
-       }
-       $CGIselectborrower=CGI::scrolling_list( -name     => 'borrnumber',
-                               -values   => address@hidden,
-                               -labels   => \%labels,
-                               -size     => 7,
-                               -multiple => 0 );
-}
-#title
-
-my ($patrontable, $flaginfotable) = patrontable($borrower);
-my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'};
-my @temp=split(/\$/,$amountold);
-$amountold=$temp[1];
-$template->param( today=>format_date($todaysdate),
-               findborrower => $findborrower,
-               borrower => $borrower,
-               borrowernumber => $borrowernumber,
-               branch => $branch,
-               printer => $printer,
-               branchname => $branches->{$branch}->{'branchname'},
-               printername => $printers->{$printer}->{'printername'},
-               firstname => $borrower->{'firstname'},
-               surname => $borrower->{'surname'},
-               categorycode => 
getborrowercategory($borrower->{'categorycode'}),
-               streetaddress => $borrower->{'streetaddress'},
-               emailaddress => $borrower->{'emailaddress'},
-               borrowernotes => $borrower->{'borrowernotes'},
-               city => $borrower->{'city'},
-               phone => $borrower->{'phone'},
-               cardnumber => $borrower->{'cardnumber'},
-               amountold => $amountold,
-               barcode => $barcode,
-               renew=>$renew,
-               stickyduedate => $stickyduedate,
-               message => $message,
-               CGIselectborrower => $CGIselectborrower,
-               todayissues => address@hidden,
-               previssues => address@hidden,
-       );
-# set return date if stickyduedate
-if ($stickyduedate) {
-       my $t_year = "year".$year;
-       my $t_month = "month".$month;
-       my $t_day = "day".$day;
-       $template->param(
-               $t_year => 1,
-               $t_month => 1,
-               $t_day => 1,
-       );
-}
-
-
-if ($branchcookie) {
-    $cookie=[$cookie, $branchcookie, $printercookie];
-}
-
-output_html_with_http_headers $query, $cookie, $template->output;
-
-####################################################################
-# Extra subroutines,,,
-
-sub patrontable {
-    my ($borrower) = @_;
-    my $flags = $borrower->{'flags'};
-    my $flaginfotable='';
-    my $flaginfotext;
-    #my $flaginfotext='';
-    my $flag;
-    my $color='';
-    foreach $flag (sort keys %$flags) {
-#      my @itemswaiting='';
-       $flags->{$flag}->{'message'}=~s/\n/<br>/g;
-       if ($flags->{$flag}->{'noissues'}) {
-               $template->param(
-                       flagged => 1,
-                       noissues => 'true',
-                        );
-               if ($flag eq 'GNA'){
-                       $template->param(
-                               gna => 'true'
-                               );
-                       }
-               if ($flag eq 'LOST'){
-                       $template->param(
-                               lost => 'true'
-                       );
-                       }
-               if ($flag eq 'DBARRED'){
-                       $template->param(
-                               dbarred => 'true'
-                       );
-                       }
-               if ($flag eq 'CHARGES') {
-                       $template->param(
-                               charges => 'true',
-                               chargesmsg => $flags->{'CHARGES'}->{'message'}
-                                );
-               }
-       } else {
-                if ($flag eq 'CHARGES') {
-                       $template->param(
-                               charges => 'true',
-                               flagged => 1,
-                               chargesmsg => $flags->{'CHARGES'}->{'message'}
-                        );
-               }
-               if ($flag eq 'WAITING') {
-                       my $items=$flags->{$flag}->{'itemlist'};
-                       my @itemswaiting;
-                       foreach my $item (@$items) {
-                       my ($iteminformation) = getiteminformation(\%env, 
$item->{'itemnumber'}, 0);
-                       $iteminformation->{'branchname'} = 
$branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
-                       push @itemswaiting, $iteminformation;
-                       }
-                       $template->param(
-                               flagged => 1,
-                               waiting => 'true',
-                               waitingmsg => $flags->{'WAITING'}->{'message'},
-                               itemswaiting => address@hidden,
-                                );
-               }
-               if ($flag eq 'ODUES') {
-                       $template->param(
-                               odues => 'true',
-                               flagged => 1,
-                               oduesmsg => $flags->{'ODUES'}->{'message'}
-                                );
-
-                       my $items=$flags->{$flag}->{'itemlist'};
-                       {
-                           my @itemswaiting;
-                       foreach my $item (@$items) {
-                               my ($iteminformation) = 
getiteminformation(\%env, $item->{'itemnumber'}, 0);
-                               push @itemswaiting, $iteminformation;
-                       }
-                       }
-                       if ($query->param('module') ne 'returns'){
-                               $template->param( nonreturns => 'true' );
-                       }
-               }
-               if ($flag eq 'NOTES') {
-                       $template->param(
-                               notes => 'true',
-                               flagged => 1,
-                               notesmsg => $flags->{'NOTES'}->{'message'}
-                                );
-               }
-       }
-    }
-    return($patrontable, $flaginfotext);
-}
-
-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;
-    }
-}
-
-# Local Variables:
-# tab-width: 8
-# End:

Index: circ/resreturns.pl
===================================================================
RCS file: circ/resreturns.pl
diff -N circ/resreturns.pl
--- circ/resreturns.pl  15 Nov 2006 01:41:51 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,478 +0,0 @@
-#!/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
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Circulation::Circ3;
-use C4::Search;
-use C4::Output;
-use C4::Print;
-use C4::Reserves2;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-
-use C4::Koha;
-use C4::Members;
-my $query = new CGI;
-
-#getting the template
-my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
-    {
-        template_name   => "circ/resreturns.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 );
-
-#
-# Some code to handle the error if there is no branch or printer setting.....
-#
-my $branch=C4::Context->preference("defaultBranch");
-$env{'branchcode'} = $branch;
-$env{'printer'}    = $printer;
-$env{'queue'}      = $printer;
-
-# Set up the item stack ....
-my %returneditems;
-my %riduedate;
-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 ); #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
-        );
-    }
-}
-
-my $iteminformation;
-my $borrower;
-my $returned = 0;
-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'} ) {
-               if ( $messages->{'NotIssued'} ) {
-               my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select date_due from issues where 
itemnumber=? and isnull(returndate)");
-               $sth->execute($iteminformation->{'itemnumber'});
-               my ($date_due) = $sth->fetchrow;
-               
-               $sth->finish;
-                       if ($date_due){ 
-                       print 
$query->redirect("/cgi-bin/koha/circ/returns.pl?barcode=$barcode");
-                       }
-               }
-        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} = "&nbsp;";
-            $riborrowernumber{0} = '&nbsp;';
-        }
-        push ( @inputloop, \%input );
-    }
-    $template->param(
-        returned  => $returned,
-        itemtitle => $iteminformation->{'title'},
-
-        #                                                                      
itembc => $iteminformation->{'barcode'},
-        #                                                                      
itemdatedue => $iteminformation->{'date_due'},
-        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
-        );
-    }
-}
-
-# 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 ....
-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 $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) =C4::Circulation::Circ2::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!
-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;
-    }
-}
-
-# Local Variables:
-# tab-width: 4
-# End:




reply via email to

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