koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Circulation.pm C4/Stats.pm circ/brancht...


From: paul poulain
Subject: [Koha-cvs] koha C4/Circulation.pm C4/Stats.pm circ/brancht...
Date: Tue, 17 Apr 2007 16:24:59 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     paul poulain <tipaul>   07/04/17 16:24:59

Modified files:
        C4             : Circulation.pm Stats.pm 
        circ           : branchtransfers.pl 
        koha-tmpl/intranet-tmpl/prog/en/circ: branchtransfers.tmpl 
                                              returns.tmpl 

Log message:
        circulation cleaning continued: working on branchtransfers.pl 
(unfinished, but at least it compiles...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation.pm?cvsroot=koha&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Stats.pm?cvsroot=koha&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/koha/circ/branchtransfers.pl?cvsroot=koha&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl?cvsroot=koha&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl?cvsroot=koha&r1=1.10&r2=1.11

Patches:
Index: C4/Circulation.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- C4/Circulation.pm   17 Apr 2007 08:48:00 -0000      1.12
+++ C4/Circulation.pm   17 Apr 2007 16:24:59 -0000      1.13
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Circulation.pm,v 1.12 2007/04/17 08:48:00 tipaul Exp $
+# $Id: Circulation.pm,v 1.13 2007/04/17 16:24:59 tipaul Exp $
 
 use strict;
 require Exporter;
@@ -44,7 +44,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.12 $' =~ /\d+/g; shift(@v).".".join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.13 $' =~ /\d+/g; shift(@v).".".join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -200,39 +200,25 @@
 
 =cut
 
-#'
-# FIXME - This function tries to do too much, and its API is clumsy.
-# If it didn't also return books, it could be used to change the home
-# branch of a book while the book is on loan.
-#
-# Is there any point in returning the item information? The caller can
-# look that up elsewhere if ve cares.
-#
-# This leaves the ($dotransfer, $messages) tuple. This seems clumsy.
-# If the transfer succeeds, that's all the caller should need to know.
-# Thus, this function could simply return 1 or 0 to indicate success
-# or failure, and set $C4::Circulation::Circ2::errmsg in case of
-# failure. Or this function could return undef if successful, and an
-# error message in case of failure (this would feel more like C than
-# Perl, though).
 sub transferbook {
     my ( $tbr, $barcode, $ignoreRs ) = @_;
     my $messages;
     my %env;
     my $dotransfer      = 1;
     my $branches        = GetBranches();
-    my $item = GetItemnumberFromBarcode( $barcode );
-    my $issue      = GetItemIssues($item->{itemnumber});
+    my $itemnumber = GetItemnumberFromBarcode( $barcode );
+    my $issue      = GetItemIssue($itemnumber);
+    my $biblio = GetBiblioFromItemNumber($itemnumber);
 
     # bad barcode..
-    if ( not $item ) {
+    if ( not $itemnumber ) {
         $messages->{'BadBarcode'} = $barcode;
         $dotransfer = 0;
     }
 
     # get branches of book...
-    my $hbr = $item->{'homebranch'};
-    my $fbr = $item->{'holdingbranch'};
+    my $hbr = $biblio->{'homebranch'};
+    my $fbr = $biblio->{'holdingbranch'};
 
     # if is permanent...
     if ( $hbr && $branches->{$hbr}->{'PE'} ) {
@@ -240,7 +226,6 @@
     }
 
     # can't transfer book if is already there....
-    # FIXME - Why not? Shouldn't it trivially succeed?
     if ( $fbr eq $tbr ) {
         $messages->{'DestinationEqualsHolding'} = 1;
         $dotransfer = 0;
@@ -253,10 +238,9 @@
     }
 
     # find reserves.....
-    # FIXME - Don't call &CheckReserves unless $ignoreRs is true.
     # That'll save a database query.
     my ( $resfound, $resrec ) =
-      CheckReserves( $item->{'itemnumber'} );
+      CheckReserves( $itemnumber );
     if ( $resfound and not $ignoreRs ) {
         $resrec->{'ResFound'} = $resfound;
 
@@ -266,12 +250,12 @@
 
     #actually do the transfer....
     if ($dotransfer) {
-        dotransfer( $item->{'itemnumber'}, $fbr, $tbr );
+        dotransfer( $itemnumber, $fbr, $tbr );
 
         # don't need to update MARC anymore, we do it in batch now
         $messages->{'WasTransfered'} = 1;
     }
-    return ( $dotransfer, $messages, $item );
+    return ( $dotransfer, $messages, $biblio );
 }
 
 # Not exported
@@ -1210,21 +1194,19 @@
 
 sub AddReturn {
     my ( $barcode, $branch ) = @_;
-    my %env;
-    my $messages;
     my $dbh      = C4::Context->dbh;
+    my $messages;
     my $doreturn = 1;
+    my $borrower;
     my $validTransfert = 0;
     my $reserveDone = 0;
     
-    die '$branch not defined' unless defined $branch;  # just in case (bug 170)
     # get information on item
     my $iteminformation = GetItemIssue( GetItemnumberFromBarcode($barcode));
-    if ( not $iteminformation ) {
+    unless ($iteminformation->{'itemnumber'} ) {
         $messages->{'BadBarcode'} = $barcode;
         $doreturn = 0;
-    }
-
+    } else {
     # find the borrower
     if ( ( not $iteminformation->{borrowernumber} ) && $doreturn ) {
         $messages->{'NotIssued'} = $barcode;
@@ -1244,30 +1226,30 @@
         $doreturn = 0;
     }
 
-#     new op dev : if the book returned in an other branch update the holding 
branch
+    #     new op dev : if the book returned in an other branch update the 
holding branch
 
-# update issues, thereby returning book (should push this out into another 
subroutine
-    my ($borrower) = GetMemberDetails( $iteminformation->{borrowernumber}, 0 );
+    # update issues, thereby returning book (should push this out into another 
subroutine
+        $borrower = GetMemberDetails( $iteminformation->{borrowernumber}, 0 );
 
-# case of a return of document (deal with issues and holdingbranch)
+    # case of a return of document (deal with issues and holdingbranch)
 
     if ($doreturn) {
         my $sth =
           $dbh->prepare(
-"update issues set returndate = now() where (borrowernumber = ?) and 
(itemnumber = ?) and (returndate is null)"
+    "update issues set returndate = now() where (borrowernumber = ?) and 
(itemnumber = ?) and (returndate is null)"
           );
         $sth->execute( $borrower->{'borrowernumber'},
             $iteminformation->{'itemnumber'} );
         $messages->{'WasReturned'} = 1;    # FIXME is the "= 1" right?
     }
 
-# continue to deal with returns cases, but not only if we have an issue
+    # continue to deal with returns cases, but not only if we have an issue
 
-# the holdingbranch is updated if the document is returned in an other 
location .
-if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} )
+    # the holdingbranch is updated if the document is returned in an other 
location .
+    if ( $iteminformation->{'holdingbranch'} ne 
C4::Context->userenv->{'branch'} )
         {
                
UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});
 
-#              reload iteminformation holdingbranch with the userenv value
+    #          reload iteminformation holdingbranch with the userenv value
                $iteminformation->{'holdingbranch'} = 
C4::Context->userenv->{'branch'};
         }
     ModDateLastSeen( $iteminformation->{'itemnumber'} );
@@ -1291,7 +1273,7 @@
                );
                $sth->execute( $iteminformation->{'itemnumber'} );
                $sth->finish;
-#         now we check if there is a reservation with the validate of transfer 
if we have one, we can         set it with the status 'W'
+    #         now we check if there is a reservation with the validate of 
transfer if we have one, we can         set it with the status 'W'
         SetWaitingStatus( $iteminformation->{'itemnumber'} );
         }
      else {
@@ -1301,13 +1283,13 @@
      $validTransfert = 1;
     }
 
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# 
-# fix up the overdues in accounts...
+    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# # # 
+    # fix up the overdues in accounts...
     fixoverduesonreturn( $borrower->{'borrowernumber'},
         $iteminformation->{'itemnumber'} );
 
-# find reserves.....
-#     if we don't have a reserve with the status W, we launch the 
Checkreserves routine
+    # find reserves.....
+    #     if we don't have a reserve with the status W, we launch the 
Checkreserves routine
     my ( $resfound, $resrec ) =
       CheckReserves( $iteminformation->{'itemnumber'} );
     if ($resfound) {
@@ -1319,7 +1301,7 @@
     # update stats?
     # Record the fact that this book was returned.
     UpdateStats(
-        \%env, $branch, 'return', '0', '',
+            $branch, 'return', '0', '',
         $iteminformation->{'itemnumber'},
         $iteminformation->{'itemtype'},
         $borrower->{'borrowernumber'}
@@ -1338,7 +1320,7 @@
                warn "was transfered";
                }
     }
-        
+    }
     return ( $doreturn, $messages, $iteminformation, $borrower );
 }
 
@@ -1389,6 +1371,7 @@
 
 sub GetItemIssue {
     my ( $itemnumber) = @_;
+    return unless $itemnumber;
     my $dbh = C4::Context->dbh;
     my @GetItemIssues;
     

Index: C4/Stats.pm
===================================================================
RCS file: /sources/koha/koha/C4/Stats.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- C4/Stats.pm 9 Mar 2007 14:31:47 -0000       1.29
+++ C4/Stats.pm 17 Apr 2007 16:24:59 -0000      1.30
@@ -1,6 +1,6 @@
 package C4::Stats;
 
-# $Id: Stats.pm,v 1.29 2007/03/09 14:31:47 tipaul Exp $
+# $Id: Stats.pm,v 1.30 2007/04/17 16:24:59 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -26,7 +26,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = $VERSION = do { my @v = '$Revision: 1.29 $' =~ /\d+/g;
+$VERSION = $VERSION = do { my @v = '$Revision: 1.30 $' =~ /\d+/g;
     shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
 };
 
@@ -50,9 +50,7 @@
 =cut
 
 @ISA    = qw(Exporter);
address@hidden = qw(&UpdateStats &statsreport &TotalOwing
-  &TotalPaid &getcharges &Getpaidbranch &unfilledreserves &getcredits
-  getrefunds);
address@hidden = qw(&UpdateStats);
 
 =item UpdateStats
 
@@ -78,210 +76,22 @@
 
     #module to insert stats data into stats table
     my (
-        $env,      $branch,         $type,
+        $branch,         $type,
         $amount,   $other,          $itemnum,
-        $itemtype, $borrowernumber, $accountno
+        $itemtype, $borrowernumber
       )
       = @_;
     my $dbh = C4::Context->dbh;
-    if ( $branch eq '' ) {
-        $branch = $env->{'branchcode'};
-    }
-    my $user         = $env->{'usercode'};
-    my $organisation = $env->{'organisation'};
-
     # FIXME - Use $dbh->do() instead
     my $sth = $dbh->prepare(
-        "Insert into statistics (datetime,branch,type,usercode,value,
-                                        
other,itemnumber,itemtype,borrowernumber,proccode,associatedborrower) values 
(now(),?,?,?,?,?,?,?,?,?,?)"
+        "Insert into statistics (datetime,branch,type,value,
+                                        
other,itemnumber,itemtype,borrowernumber) values (now(),?,?,?,?,?,?,?,?)"
     );
     $sth->execute(
-        $branch,    $type,    $user,     $amount,
+        $branch,    $type,    $amount,
         $other,     $itemnum, $itemtype, $borrowernumber,
-        $accountno, $organisation
-    );
-    $sth->finish;
-}
-
-# Otherwise, it'd need a POD.
-sub TotalPaid {
-    my ( $time, $time2, $spreadsheet ) = @_;
-    $time2 = $time unless $time2;
-    my $dbh   = C4::Context->dbh;
-    my $query = "SELECT * FROM statistics,borrowers
-  WHERE statistics.borrowernumber= borrowers.borrowernumber
-  AND (statistics.type='payment' OR statistics.type='writeoff') ";
-    if ( $time eq 'today' ) {
-        $query = $query . " AND datetime = now()";
-    }
-    else {
-        $query .= " AND datetime > '$time'";
-    }
-    if ( $time2 ne '' ) {
-        $query .= " AND datetime < '$time2'";
-    }
-    if ($spreadsheet) {
-        $query .= " ORDER BY branch, type";
-    }
-    my $sth = $dbh->prepare($query);
-    $sth->execute();
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push @results, $data;
-    }
-    $sth->finish;
-    return (@results);
-}
-
-# Otherwise, it needs a POD.
-sub getcharges {
-    my ( $borrowerno, $timestamp, $accountno ) = @_;
-    my $dbh        = C4::Context->dbh;
-    my $timestamp2 = $timestamp - 1;
-    my $query      = "";
-    my $sth;
-
-    # getcharges is now taking accountno. as an argument
-    if ($accountno) {
-        $sth = $dbh->prepare(
-            "Select * from accountlines where borrowernumber=?
-              and accountno = ?"
-        );
-        $sth->execute( $borrowerno, $accountno );
-
-        # this bit left in for old 2 arg usage of getcharges
-    }
-    else {
-        $sth = $dbh->prepare(
-            "Select * from accountlines where borrowernumber=?
-              and timestamp = ? and accounttype <> 'Pay' and
-              accounttype <> 'W'"
-        );
-        $sth->execute( $borrowerno, $timestamp );
-    }
-
-    #  print $query,"<br>";
-    my $i = 0;
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-
-        #    if ($data->{'timestamp'} == $timestamp){
-        $results[$i] = $data;
-        $i++;
-
-        #    }
-    }
-    return (@results);
-}
-
-# Otherwise, it needs a POD.
-sub getcredits {
-    my ( $date, $date2 ) = @_;
-    my $dbh = C4::Context->dbh;
-
-    #takes date converts to timestamps
-    my $padding = "000000";
-    ( my $a, my $b, my $c ) = unpack( "A4 x1 A2 x1 A2", $date );
-    ( my $x, my $y, my $z ) = unpack( "A4 x1 A2 x1 A2", $date2 );
-    my $timestamp  = $a . $b . $c . $padding;
-    my $timestamp2 = $x . $y . $z . $padding;
-
-    my $sth = $dbh->prepare(
-"Select * from accountlines,borrowers where (((accounttype = 'LR')  or 
(accounttype <> 'Pay'))
-                                   and amount < 0  and 
accountlines.borrowernumber = borrowers.borrowernumber
-                                   and timestamp >=?  and timestamp <?)"
-    );
-    $sth->execute( $timestamp, $timestamp2 );
-
-    my $i = 0;
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $results[$i] = $data;
-        $i++;
-    }
-    return (@results);
-}
-
-sub getrefunds {
-    my ( $date, $date2 ) = @_;
-    my $dbh = C4::Context->dbh;
-
-    #takes date converts to timestamps
-    my $padding = "000000";
-    ( my $a, my $b, my $c ) = unpack( "A4 x1 A2 x1 A2", $date );
-    ( my $x, my $y, my $z ) = unpack( "A4 x1 A2 x1 A2", $date2 );
-    my $timestamp  = $a . $b . $c . $padding;
-    my $timestamp2 = $x . $y . $z . $padding;
-
-    my $sth = $dbh->prepare(
-"Select * from accountlines,borrowers where (accounttype = 'REF'               
                                                 
-                                         and accountlines.borrowernumber = 
borrowers.borrowernumber                                                        
                  
-                                                  and timestamp >=?  and 
timestamp <?)"
-    );
-    $sth->execute( $timestamp, $timestamp2 );
-
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        push @results, $data;
-    }
-    return (@results);
-}
-
-# Otherwise, this needs a POD.
-sub Getpaidbranch {
-    my ( $date, $borrno ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-"select * from statistics where type='payment' and datetime >? and  
borrowernumber=?"
-      );
-    $sth->execute( $date, $borrno );
-
-    #  print $query;
-    my $data = $sth->fetchrow_hashref;
-    $sth->finish;
-    return ( $data->{'branch'} );
-}
-
-# FIXME - This is only used in reservereport.pl and reservereport.xls,
-# neither of which is used.
-# Otherwise, it needs a POD.
-sub unfilledreserves {
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare(
-"select *,biblio.title from 
reserves,reserveconstraints,biblio,borrowers,biblioitems where (found <> 'F' or
-           found is NULL) and cancellationdate
-                                                                is NULL and 
biblio.biblionumber=reserves.biblionumber and
-                                                                
reserves.constrainttype='o'
-                                                                and 
(reserves.biblionumber=reserveconstraints.biblionumber
-                                                                and 
reserves.borrowernumber=reserveconstraints.borrowernumber)
-                                                                and
-                                                                
reserves.borrowernumber=borrowers.borrowernumber and
-                                                                
biblioitems.biblioitemnumber=reserveconstraints.biblioitemnumber order by
-                                                                
biblio.title,reserves.reservedate"
-    );
-    $sth->execute;
-    my $i = 0;
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $results[$i] = $data;
-        $i++;
-    }
-    $sth->finish;
-    $sth = $dbh->prepare(
-"select *,biblio.title from reserves,biblio,borrowers where (found <> 'F' or 
found is NULL) and cancellationdate
-                is NULL and biblio.biblionumber=reserves.biblionumber and 
reserves.constrainttype='a' and
-                reserves.borrowernumber=borrowers.borrowernumber
-                order by
-                biblio.title,reserves.reservedate"
     );
-    $sth->execute;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        $results[$i] = $data;
-        $i++;
-    }
     $sth->finish;
-    return ( $i, address@hidden );
 }
 
 1;

Index: circ/branchtransfers.pl
===================================================================
RCS file: /sources/koha/koha/circ/branchtransfers.pl,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- circ/branchtransfers.pl     4 Apr 2007 16:46:23 -0000       1.28
+++ circ/branchtransfers.pl     17 Apr 2007 16:24:59 -0000      1.29
@@ -26,28 +26,33 @@
 use C4::Circulation;
 use C4::Output;
 use C4::Reserves2;
+use C4::Biblio;
 use C4::Auth;
 use C4::Interface::CGI::Output;
 use C4::Branch; # GetBranches
 use C4::Koha;
 
 ###############################################
-# constants
-
-my %env;
-my $branches = GetBranches;
-my $printers = GetPrinters( \%env );
-
-###############################################
 #  Getting state
 
 my $query = new CGI;
 
-my $branch  = GetBranch( $query,  $branches );
-my $printer = GetPrinter( $query, $printers );
+#######################################################################################
+# Make the page .....
+my ( $template, $cookie );
+my $user;
+( $template, $user, $cookie ) = get_template_and_user(
+    {
+        template_name   => "circ/branchtransfers.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { circulate => 1 },
+    }
+);
 
-my $genbrname = $branches->{$branch}->{'branchname'};
-my $genprname = $printers->{$printer}->{'printername'};
+my $branches = GetBranches;
+my $branch  = GetBranch( $query,  $branches );
 
 my $messages;
 my $found;
@@ -56,14 +61,10 @@
 my $reqmessage;
 my $cancelled;
 my $setwaiting;
-my $reqbrchname;
-my $allmessages;
 
 my $request        = $query->param('request');
 my $borrowernumber = $query->param('borrowernumber');
-
 my $tobranchcd = $query->param('tobranchcd');
-my $frbranchcd = '';
 
 ############
 # Deal with the requests....
@@ -73,32 +74,26 @@
     CancelReserve( 0, $item, $borrowernumber );
     $cancelled   = 1;
     $reqmessage  = 1;
-    $allmessages = 1;
 }
 
 my $ignoreRs = 0;
 if ( $request eq "SetWaiting" ) {
     my $item = $query->param('itemnumber');
     $tobranchcd  = ReserveWaiting( $item, $borrowernumber );
-    $reqbrchname = $branches->{$tobranchcd}->{'branchname'};
     $ignoreRs    = 1;
     $setwaiting  = 1;
     $reqmessage  = 1;
-    $allmessages = 1;
 }
 if ( $request eq 'KillReserved' ) {
     my $biblio = $query->param('biblionumber');
     CancelReserve( $biblio, 0, $borrowernumber );
     $cancelled   = 1;
     $reqmessage  = 1;
-    $allmessages = 1;
 }
 
 # set up the branchselect options....
 my @branchoptionloop;
 foreach my $br ( keys %$branches ) {
-
-    #(next) unless $branches->{$br}->{'CU'}; #FIXME disabled to fix bug 202
     my %branch;
     $branch{selected} = ( $br eq $tobranchcd );
     $branch{code}     = $br;
@@ -109,20 +104,21 @@
 # collect the stack of books already transfered so they can printed...
 my @trsfitemloop;
 my %transfereditems;
-my %frbranchcds;
-my %tobranchcds;
 my $transfered;
 my $barcode = $query->param('barcode');
+# warn "barcode : $barcode";
 if ($barcode) {
 
     my $iteminformation;
     ( $transfered, $messages, $iteminformation ) =
       transferbook( $tobranchcd, $barcode, $ignoreRs );
+#       use Data::Dumper;
+#       warn "Transfered : $transfered / ".Dumper($messages);
     $found = $messages->{'ResFound'};
     if ($transfered) {
         my %item;
-        my $frbranchcd = $iteminformation->{'frbranchcd'};
-        if ( not($found) ) {
+        my $frbranchcd =  C4::Context->userenv->{'branch'};
+#         if ( not($found) ) {
             $item{'biblionumber'} = $iteminformation->{'biblionumber'};
             $item{'title'}        = $iteminformation->{'title'};
             $item{'author'}       = $iteminformation->{'author'};
@@ -130,18 +126,13 @@
             $item{'ccode'}        = $iteminformation->{'ccode'};
             $item{'frbrname'}     = $branches->{$frbranchcd}->{'branchname'};
             $item{'tobrname'}     = $branches->{$tobranchcd}->{'branchname'};
-        }
+#         }
         $item{counter}  = 0;
         $item{barcode}  = $barcode;
         $item{frombrcd} = $frbranchcd;
         $item{tobrcd}   = $tobranchcd;
-##########
-        #Are these lines still useful ???
-        $transfereditems{0} = $barcode;
-        $frbranchcds{0}     = $frbranchcd;
-        $tobranchcds{0}     = $tobranchcd;
-##########
         push( @trsfitemloop, \%item );
+#         warn Dumper(@trsfitemloop);
     }
 }
 
@@ -157,7 +148,7 @@
     $item{barcode}  = $bc;
     $item{frombrcd} = $frbcd;
     $item{tobrcd}   = $tobcd;
-    my ($iteminformation) = GetBiblioFromItemNumer( 0, $bc );
+    my ($iteminformation) = GetBiblioFromItemNumber( 
GetItemnumberFromBarcode($bc) );
     $item{'biblionumber'} = $iteminformation->{'biblionumber'};
     $item{'title'}        = $iteminformation->{'title'};
     $item{'author'}       = $iteminformation->{'author'};
@@ -165,47 +156,16 @@
     $item{'ccode'}        = $iteminformation->{'ccode'};
     $item{'frbrname'}     = $branches->{$frbcd}->{'branchname'};
     $item{'tobrname'}     = $branches->{$tobcd}->{'branchname'};
-##########
-    #Are these lines still useful ???
-    $transfereditems{$counter} = $bc;
-    $frbranchcds{$counter}     = $frbcd;
-    $tobranchcds{$counter}     = $tobcd;
-#########
     push( @trsfitemloop, \%item );
 }
 
-my $title;
-my $surname;
-my $firstname;
-my $borphone;
-my $borstraddress;
-my $borcity;
-my $borzip;
-my $boremail;
-my $borcnum;
 my $itemnumber;
-my $biblionum;
-my $branchname;
-my $wastransferred;
+my $biblionumber;
 
 #####################
 
 if ($found) {
     my $res = $messages->{'ResFound'};
-    $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
-    my ($borr) = GetMemberDetails( $res->{'borrowernumber'}, 0 );
-    $title          = $borr->{'title'};
-    $surname        = $borr->{'surname'};
-    $firstname      = $borr->{'firstname'};
-    $borrowernumber = $borr->{'borrowernumber'};
-    $borphone       = $borr->{'phone'};
-    $borstraddress  = $borr->{'streetaddress'};
-    $borcity        = $borr->{'city'};
-    $borzip         = $borr->{'zipcode'};
-    $boremail       = $borr->{'emailadress'};
-
-    #Hopefully, borr->{borrowernumber}=res->{borrowernumber}
-    $borcnum    = $borr->{'cardnumber'};
     $itemnumber = $res->{'itemnumber'};
 
     if ( $res->{'ResFound'} eq "Waiting" ) {
@@ -213,7 +173,7 @@
     }
     if ( $res->{'ResFound'} eq "Reserved" ) {
         $reserved  = 1;
-        $biblionum = $res->{'biblionumber'};
+        $biblionumber = $res->{'biblionumber'};
     }
 }
 
@@ -226,88 +186,37 @@
     if ( $code eq 'BadBarcode' ) {
         $err{msg}        = $messages->{'BadBarcode'};
         $err{errbadcode} = 1;
-        $allmessages     = 1;
     }
 
     if ( $code eq 'IsPermanent' ) {
         $err{errispermanent} = 1;
         $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
-
-        # Here, msg contains the branchname
-        # Not so satisfied with this... But should work
-        $allmessages = 1;
     }
     $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' );
 
     if ( $code eq 'WasReturned' ) {
         $err{errwasreturned} = 1;
-        $allmessages = 1;
-        my ($borrowerinfo) =
-          GetMemberDetails( $messages->{'WasReturned'}, 0 );
-        $title          = $borrowerinfo->{'title'};
-        $surname        = $borrowerinfo->{'surname'};
-        $firstname      = $borrowerinfo->{'firstname'};
-        $borrowernumber = $borrowerinfo->{'borrowernumber'};
-        $borcnum        = $borrowerinfo->{'cardnumber'};
     }
-
-    #    if ($code eq 'WasTransfered'){
-    # Put code here if you want to notify the user that item was transfered...
-    #        $wastransferred = 1;
-    #    }
     push( @errmsgloop, \%err );
 }
 
-#######################################################################################
-# Make the page .....
-my ( $template, $cookie );
-( $template, $borrowernumber, $cookie ) = get_template_and_user(
-    {
-        template_name   => "circ/branchtransfers.tmpl",
-        query           => $query,
-        type            => "intranet",
-        authnotrequired => 0,
-        flagsrequired   => { circulate => 1 },
-    }
-);
-if ($allmessages) {
-    $template->param( allmessages => 1 );
-}
-
+# use Data::Dumper;
+# warn "FINAL ============= ".Dumper(@trsfitemloop);
 $template->param(
-    genbrname               => $genbrname,
-    genprname               => $genprname,
-    branch                  => $branch,
-    printer                 => $printer,
     found                   => $found,
     reserved                => $reserved,
     waiting                 => $waiting,
-    title                   => $title,
-    surname                 => $surname,
-    firstname               => $firstname,
-    borphone                => $borphone,
-    borstraddress           => $borstraddress,
-    borcity                 => $borcity,
-    borzip                  => $borzip,
-    boremail                => $boremail,
     borrowernumber          => $borrowernumber,
-    borcnum                 => $borcnum,
-    branchname              => $branchname,
     itemnumber              => $itemnumber,
     barcode                 => $barcode,
-    biblionumber            => $biblionum,
+    biblionumber            => $biblionumber,
     tobranchcd              => $tobranchcd,
     reqmessage              => $reqmessage,
     cancelled               => $cancelled,
     setwaiting              => $setwaiting,
-    wastransferred          => $wastransferred,
     trsfitemloop            => address@hidden,
     branchoptionloop        => address@hidden,
     errmsgloop              => address@hidden,
-    intranetcolorstylesheet =>
-      C4::Context->preference("intranetcolorstylesheet"),
-    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-    IntranetNav        => C4::Context->preference("IntranetNav"),
 );
 output_html_with_http_headers $query, $cookie, $template->output;
 

Index: koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl   11 Mar 2007 
21:08:12 -0000      1.8
+++ koha-tmpl/intranet-tmpl/prog/en/circ/branchtransfers.tmpl   17 Apr 2007 
16:24:59 -0000      1.9
@@ -9,12 +9,17 @@
 
 <!-- TMPL_IF Name="found" -->
        <h3>Reserve Found</h3>
-               
                <table>
-               <caption><!-- TMPL_IF Name="reserved" -->Reserve found for <!-- 
TMPL_VAR Name="name" --> (<a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borcnum" --></a>).<!-- /TMPL_IF 
-->
+        <caption>
+            <!-- TMPL_IF Name="reserved" -->
+                Reserve found for <!-- TMPL_VAR Name="name" --> (<a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borrowernumber" --></a>).
+            <!-- /TMPL_IF -->
                <!-- TMPL_IF Name="waiting" -->
-    Item is marked waiting at <!-- TMPL_VAR Name="branchname" --> for <!-- 
TMPL_VAR Name="name" --> (<a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borcnum" --></a>).<!-- /TMPL_IF 
--></caption>
-               <tr><th>
+                Item is marked waiting at <!-- TMPL_VAR Name="branchname" --> 
for <!-- TMPL_VAR Name="name" --> (<a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borrowernumber" --></a>).
+            <!-- /TMPL_IF -->
+        </caption>
+        <tr>
+            <th>
                        <!-- TMPL_IF Name="reserved" -->Set reserve to waiting 
and transfer book to <!-- TMPL_VAR Name="branchname" -->: <!-- /TMPL_IF -->
                        <!-- TMPL_IF Name="waiting" -->Cancel reservation and 
then attempt transfer: <!-- /TMPL_IF -->
                </th>
@@ -27,24 +32,28 @@
                                <!-- /TMPL_LOOP -->
                                <input type="hidden" name="itemnumber" 
value="<!-- TMPL_VAR Name="itemnumber" -->" />
                                <input type="hidden" name="borrowernumber" 
value="<!-- TMPL_VAR Name="borrowernumber" -->" />
-                               <!-- TMPL_IF Name="waiting" --><input 
type="hidden" name="barcode" value="<!-- TMPL_VAR Name="barcode" -->" />
+                    <!-- TMPL_IF Name="waiting" -->
+                        <input type="hidden" name="barcode" value="<!-- 
TMPL_VAR Name="barcode" -->" />
                                        <input type="hidden" name="request" 
value="KillWaiting" />
                                        <input type="submit" value="Cancel" />
                                <!-- /TMPL_IF -->
-                               <!-- TMPL_IF Name="reserved" --><input 
type="hidden" name="request" value="SetWaiting" />
-                                       <input type="submit" value="Waiting" 
/><!-- /TMPL_IF -->
+                    <!-- TMPL_IF Name="reserved" -->
+                        <input type="hidden" name="request" value="SetWaiting" 
/>
+                        <input type="submit" value="Waiting" />
+                    <!-- /TMPL_IF -->
                        </form>
-               </td></tr>
-               <!-- TMPL_IF Name="reserved" --><tr><th>Cancel reservation and 
then attempt transfer:</th>
+            </td>
+        </tr>
+            <!-- TMPL_IF Name="reserved" -->
+                <tr>
+                    <th>Cancel reservation and then attempt transfer:</th>
                        <td>
                        <form method="post" name="mainform" id="mainform" 
action="branchtransfers.pl">
-
                        <!-- TMPL_LOOP Name="trsfitemloop" -->
                                <input type="hidden" name="bc-<!-- TMPL_VAR 
Name="counter" -->" value="<!-- TMPL_VAR Name="barcode" -->" />
                                <input type="hidden" name="fb-<!-- TMPL_VAR 
Name="counter" -->" value="<!-- TMPL_VAR Name="frombrcd" -->" />
                                <input type="hidden" name="tb-<!-- TMPL_VAR 
Name="counter" -->" value="<!-- TMPL_VAR Name="tobrcd" -->" />
                        <!-- /TMPL_LOOP -->
-
                        <input type="hidden" name="biblionumber" value="<!-- 
TMPL_VAR Name="biblionumber" -->" />
                        <input type="hidden" name="borrowernumber" value="<!-- 
TMPL_VAR Name="borrowernumber" -->" />
                        <input type="hidden" name="tobranchcd" value="<!-- 
TMPL_VAR Name="tobranchcd" -->" />
@@ -52,9 +61,11 @@
                        <input type="hidden" name="request" 
value="KillReserved" />
                        <input type="submit" value="Cancel" />
                        </form>
+                    </td>
+                </tr>
                <!-- /TMPL_IF -->
-               </td></tr>
-               <tr><th>Ignore and return to transfers: </th>
+                <tr>
+                    <th>Ignore and return to transfers: </th>
                        <td>
                        <form method="post" name="mainform" id="mainform" 
action="branchtransfers.pl" />
                        <input type="hidden" name="tobranchcd" value=<!-- 
TMPL_VAR Name="tobranchcd" --> />
@@ -67,12 +78,14 @@
                        <input type="submit" value="Ignore" />
                        </form>
                        </td>
-               </tr></table>
+                </tr>
+    </table>
 
 <!-- TMPL_ELSE -->
        <table>
        <caption>Messages</caption>
-       <tr><td>
+        <tr>
+            <td>
        <!-- TMPL_IF Name="reqmessage" -->
                <!-- TMPL_IF Name="cancelled" -->
                        Reserve Cancelled<br>
@@ -80,10 +93,7 @@
                <!-- TMPL_IF Name="setwaiting" -->
                        Item should now be waiting at branch: <!-- TMPL_VAR 
Name="reqbrchname" --><br>
                <!-- /TMPL_IF -->
-       <!-- TMPL_ELSE -->
-           No message.
        <!-- /TMPL_IF -->
-       
        <!-- TMPL_LOOP Name="errmsgloop" -->
                <!-- TMPL_IF Name="errbadcode" -->
                        No Item with barcode: <!-- TMPL_VAR Name="msg" -->
@@ -95,23 +105,33 @@
                        Item is already at destination branch.
                <!-- /TMPL_IF -->
                <!-- TMPL_IF Name="errwasreturned" -->
-                       Item was on loan to <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borcnum" --></a>
+                        Item was on loan to <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
Name="borrowernumber" -->"><!-- TMPL_VAR Name="borrowernumber" --></a>
 <!-- TMPL_VAR Name="name" --> and has been returned.
                <!-- /TMPL_IF -->
-
        <!-- /TMPL_LOOP -->
-       </td></tr></table>
-       
+            </td>
+        </tr>
+    </table>
        <form method="post" name="mainform" id="mainform" 
action="/cgi-bin/koha/circ/branchtransfers.pl">
        <table>
        <caption>Transfer</caption>
-       <tr><th scope="row">Destination branch:</th><td><select 
name="tobranchcd">
+            <tr>
+                <th scope="row">Destination branch:</th>
+                <td>
+                    <select name="tobranchcd">
                        <!-- TMPL_LOOP Name="branchoptionloop" -->
-                               <option value="<!-- TMPL_VAR Name="code" -->" 
<!-- TMPL_VAR Name="selected" -->><!-- TMPL_VAR Name="name" --></option>
+                            <option value="<!-- TMPL_VAR Name="code" -->" <!-- 
TMPL_VAR Name="selected" -->>
+                                <!-- TMPL_VAR Name="name" -->
+                            </option>
                        <!-- /TMPL_LOOP -->
-               </select></td></tr>
-<tr><th scope="row">Enter barcode</th><td><input name="barcode" size="15" 
/></td></tr>
-</table>
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <th scope="row">Enter barcode</th>
+                <td><input name="barcode" size="15" /></td>
+            </tr>
+        </table>
        <input type="hidden" name="tobranchcd" value="<!-- TMPL_VAR 
Name="tobrancd" -->" />
        <!-- TMPL_LOOP Name="trsfitemloop" -->
                <input type="hidden" name="bc-<!-- TMPL_VAR Name="counter" -->" 
value="<!-- TMPL_VAR Name="barcode" -->" />
@@ -121,17 +141,23 @@
        <input type="submit" value="Do transfer" />
        </form>
        
-       <!-- TMPL_IF Name="transferred" -->
+    <!-- TMPL_IF Name="trsfitemloop" -->
                <table>
                <caption>Transfered Items</caption>
-               <tr><th>Bar 
Code</th><th>Title</th><th>Author</th><th>Type</th><th>From</th><th>To</th></tr>
+            <tr>
+                <th>Bar Code</th>
+                <th>Title</th>
+                <th>To</th>
+            </tr>
                <!-- TMPL_LOOP Name="trsfitemloop" -->
-                       <tr><td>
-                       <a 
href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR 
Name="biblionumber" -->&amp;type=intra"><!-- TMPL_VAR Name="barcode" 
--></a></td>
-                       <td><!-- TMPL_VAR Name="title" --></td>
-                       <td><!-- TMPL_VAR Name="author" --></td>
-                       <td><!-- TMPL_VAR Name="ccode" --></td>
-                       <td><!-- TMPL_VAR Name="frbrname" --></td>
+                <tr>
+                    <td>
+                        <a 
href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR 
Name="biblionumber" -->><!-- TMPL_VAR Name="barcode" --></a>
+                    </td>
+                    <td>
+                        <p><!-- TMPL_VAR Name="title" --> (<!-- TMPL_VAR 
Name="author" -->)</p>
+                        <p><!-- TMPL_VAR Name="ccode" --></p>
+                    </td>
                        <td><!-- TMPL_VAR Name="tobrname" --></td>
                        </tr>
                <!-- /TMPL_LOOP -->

Index: koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl   17 Apr 2007 08:46:05 
-0000      1.10
+++ koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl   17 Apr 2007 16:24:59 
-0000      1.11
@@ -7,7 +7,7 @@
 
 <!-- case of a mistake in transfert loop -->
 <!-- TMPL_IF Name="WrongTransfer" -->
-    <h3 class="problem">This item was not transfered initialy to this library 
!</h3>
+    <h3 class="problem">This item should not be in this library !</h3>
     <table>
     <tr>
         <th>Title : </th>
@@ -32,7 +32,7 @@
         </tr>
         <tr><th>Action : </th>
             <td class="problem">
-                this document must be transfered to : <!-- TMPL_VAR 
Name="TransferWaitingAt" -->
+                This item must be transfered to : <!-- TMPL_VAR 
Name="TransferWaitingAt" -->
             </td>
         </tr>
     </table>
@@ -146,9 +146,9 @@
     <!-- case of simple return no issue or transfer but with a reservation  -->
     <!-- TMPL_IF Name="reserved" -->
         <!-- TMPL_IF Name="transfertodo"-->
-            <h3>Reserve With necesary transfert Found</h3>
+            <h3>Reserve at an other library, transfer to do</h3>
         <!-- TMPL_ELSE -->
-            <h3>Waiting Reserve Found in your library</h3>
+            <h3>Waiting reserve found in your library</h3>
         <!-- /TMPL_IF -->
         <table>
             <caption><a 
href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR 
NAME="itembiblionumber" -->"><!-- TMPL_VAR Name="title" --></a></caption>




reply via email to

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