renaming currenttransfers to transferstoreceive
authortipaul <tipaul>
Mon, 23 Apr 2007 15:21:17 +0000 (15:21 +0000)
committertipaul <tipaul>
Mon, 23 Apr 2007 15:21:17 +0000 (15:21 +0000)
12 files changed:
C4/Biblio.pm
C4/Circulation.pm
C4/Context.pm
C4/Members.pm
C4/Reserves.pm
circ/circulation.pl
circ/returns.pl
circ/transferstoreceive.pl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/circ/transferstoreceive.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc
members/moremember.pl
reserve/modrequest.pl

index 2bf3d8f..f864e59 100644 (file)
@@ -760,7 +760,7 @@ sub GetItemsInfo {
         if ( $datedue eq '' ) {
             #$datedue="Available";
             my ( $restype, $reserves ) =
-              C4::Reserves2::CheckReserves( $data->{'itemnumber'} );
+              CheckReserves( $data->{'itemnumber'} );
             if ($restype) {
 
                 #$datedue=$restype;
@@ -3649,6 +3649,9 @@ Joshua Ferraro jmf@liblime.com
 
 # $Id$
 # $Log$
+# Revision 1.198  2007/04/23 15:21:17  tipaul
+# renaming currenttransfers to transferstoreceive
+#
 # Revision 1.197  2007/04/18 17:00:14  tipaul
 # removing all useless %env / $env
 #
index 9c0c824..71d3c22 100755 (executable)
@@ -68,6 +68,7 @@ Also deals with stocktaking.
 # FIXME subs that should probably be elsewhere
 push @EXPORT, qw(
   &FixOverduesOnReturn
+  &cuecatbarcodedecode
 );
 
 # subs to deal with issuing a book
@@ -99,10 +100,12 @@ push @EXPORT, qw(
 
 # subs to remove
 push @EXPORT, qw(
-  &decode
   &dotransfer
 );
 
+# FIXME - At least, I'm pretty sure this is for decoding CueCat stuff.
+# FIXME From Paul : i don't understand what this sub does & why it has to be called on every circ. Speak of this with chris maybe ?
+
 =head2 decode
 
 =head3 $str = &decode($chunk);
@@ -116,9 +119,32 @@ returns it.
 
 =cut
 
-# FIXME - At least, I'm pretty sure this is for decoding CueCat stuff.
+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;
+    }
+}
+
+=head2 decode
+
+=head3 $str = &decode($chunk);
+
+=over 4
+
+=item Decodes a segment of a string emitted by a CueCat barcode scanner and
+returns it.
+
+=back
+
+=cut
 
-# FIXME From Paul : i don't understand what this sub does & why it has to be called on every circ. Speak of this with chris maybe ?
 sub decode {
     my ($encoded) = @_;
     my $seq =
@@ -256,9 +282,6 @@ sub transferbook {
     return ( $dotransfer, $messages, $biblio );
 }
 
-# Not exported
-# FIXME - This is only used in &transferbook. Why bother making it a
-# separate function?
 sub dotransfer {
     my ( $itm, $fbr, $tbr ) = @_;
     
@@ -1668,11 +1691,11 @@ sub CanBookBeRenewed {
             $renewokay = 1;
         }
         $sth2->finish;
-        my ( $resfound, $resrec ) = C4::Reserves2::CheckReserves($itemnumber);
+        my ( $resfound, $resrec ) = CheckReserves($itemnumber);
         if ($resfound) {
             $renewokay = 0;
         }
-        ( $resfound, $resrec ) = C4::Reserves2::CheckReserves($itemnumber);
+        ( $resfound, $resrec ) = CheckReserves($itemnumber);
         if ($resfound) {
             $renewokay = 0;
         }
index 6a25a4a..d1b1bac 100644 (file)
@@ -875,6 +875,9 @@ Joshua Ferraro <jmf at liblime dot com>
 =cut
 
 # $Log$
+# Revision 1.56  2007/04/23 15:21:17  tipaul
+# renaming currenttransfers to transferstoreceive
+#
 # Revision 1.55  2007/04/17 08:48:00  tipaul
 # circulation cleaning continued: bufixing
 #
@@ -944,7 +947,7 @@ Joshua Ferraro <jmf at liblime dot com>
 # In this commit, I created a "fake" user when insecure=ON. It has a fake branch. You may find better to have the 1st branch in branch table instead of a fake one.
 #
 # Revision 1.43.2.8  2006/12/19 16:48:16  alaurin
-# reident programs, and adding branchcode value in reserves2
+# reident programs, and adding branchcode value in reserves
 #
 # Revision 1.43.2.7  2006/12/06 21:55:38  hdl
 # Adding ModZebrations for servers to get serverinfos in Context.pm
index 6bfb9f5..f628e48 100644 (file)
@@ -442,7 +442,7 @@ sub patronflags {
         $flags{'ODUES'} = \%flaginfo;
     }
     my $itemswaiting =
-      C4::Reserves2::GetWaitingReserves( $patroninformation->{'borrowernumber'} );
+      GetWaitingReserves( $patroninformation->{'borrowernumber'} );
     my $nowaiting = scalar @$itemswaiting;
     if ( $nowaiting > 0 ) {
         my %flaginfo;
index d7d47bf..20292de 100755 (executable)
@@ -37,7 +37,7 @@ $VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map
 
 =head1 NAME
 
-C4::Reserves2 - Koha functions for dealing with reservation.
+C4::Reserves - Koha functions for dealing with reservation.
 
 =head1 SYNOPSIS
 
index 1f79ae8..f5f79d0 100755 (executable)
@@ -728,19 +728,3 @@ $template->param(
     SpecifyDueDate     => C4::Context->preference("SpecifyDueDate")
 );
 output_html_with_http_headers $query, $cookie, $template->output;
-
-####################################################################
-# Extra subroutines,,,
-
-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;
-    }
-}
index d7ace40..f0a9beb 100755 (executable)
@@ -531,16 +531,3 @@ $template->param(
 
 # 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;
-    }
-}
diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl
new file mode 100644 (file)
index 0000000..5ec5dac
--- /dev/null
@@ -0,0 +1,143 @@
+#!/usr/bin/perl
+
+# $Id$
+
+# 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::Context;
+use C4::Output;
+use C4::Branch;
+use C4::Auth;
+use C4::Date;
+use C4::Biblio;
+use C4::Circulation;
+use C4::Members;
+use C4::Interface::CGI::Output;
+use Date::Calc qw(
+  Today
+  Add_Delta_Days
+  Date_to_Days
+);
+
+use C4::Koha;
+use C4::Reserves;
+
+my $input = new CGI;
+
+my $theme = $input->param('theme');    # only used if allowthemeoverride is set
+my $itemnumber = $input->param('itemnumber');
+my $todaysdate = join "-", &Today;
+
+# if we have a resturn of the form to delete the transfer, we launch the subrroutine
+if ($itemnumber) {
+    C4::Circulation::Circ2::DeleteTransfer($itemnumber);
+}
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "circ/transferstoreceive.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { circulate => 1 },
+        debug           => 1,
+    }
+);
+
+# set the userenv branch
+my $default = C4::Context->userenv->{'branch'};
+
+# get the all the branches for reference
+my $branches = GetBranches();
+my @branchesloop;
+foreach my $br ( keys %$branches ) {
+    my @transferloop;
+    my %branchloop;
+    $branchloop{'branchname'} = $branches->{$br}->{'branchname'};
+    $branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
+    my @gettransfers =
+      GetTransfersFromTo( $branches->{$br}->{'branchcode'}, $default );
+
+    if (@gettransfers) {
+        foreach my $num (@gettransfers) {
+            my %getransf;
+
+            my ( $sent_year, $sent_month, $sent_day ) = split "-",
+              $num->{'datesent'};
+            $sent_day = ( split " ", $sent_day )[0];
+            ( $sent_year, $sent_month, $sent_day ) =
+              Add_Delta_Days( $sent_year, $sent_month, $sent_day,
+                C4::Context->preference('TransfersMaxDaysWarning'));
+            my $calcDate = Date_to_Days( $sent_year, $sent_month, $sent_day );
+            my $today    = Date_to_Days(&Today);
+            my $warning  = ( $today > $calcDate );
+
+            if ( $warning > 0 ) {
+                $getransf{'messcompa'} = 1;
+            }
+            my $gettitle     = GetBiblioFromItemNumber( $num->{'itemnumber'} );
+            my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );
+
+            $getransf{'title'}        = $gettitle->{'title'};
+            $getransf{'datetransfer'} = format_date( $num->{'datesent'} );
+            $getransf{'biblionumber'} = $gettitle->{'biblionumber'};
+            $getransf{'itemnumber'}   = $gettitle->{'itemnumber'};
+            $getransf{'barcode'}      = $gettitle->{'barcode'};
+            $getransf{'itemtype'}       = $itemtypeinfo->{'description'};
+            $getransf{'homebranch'}     = $gettitle->{'homebranch'};
+            $getransf{'holdingbranch'}  = $gettitle->{'holdingbranch'};
+            $getransf{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
+
+            #                          we check if we have a reserv for this transfer
+            my @checkreserv = GetReservations( $num->{'itemnumber'} );
+            if ( $checkreserv[0] ) {
+                my $getborrower =
+                  GetMemberDetails( $checkreserv[1] );
+                $getransf{'borrowernum'}  = $getborrower->{'borrowernumber'};
+                $getransf{'borrowername'} = $getborrower->{'surname'};
+                $getransf{'borrowerfirstname'} = $getborrower->{'firstname'};
+                if ( $getborrower->{'emailaddress'} ) {
+                    $getransf{'borrowermail'} = $getborrower->{'emailaddress'};
+                }
+                $getransf{'borrowerphone'} = $getborrower->{'phone'};
+
+            }
+            push( @transferloop, \%getransf );
+        }
+
+      #                If we have a return of reservloop we put it in the branchloop sequence
+        $branchloop{'reserv'} = \@transferloop;
+    }
+    else {
+
+#      if we don't have a retrun from reservestobranch we unset branchname and branchcode
+        $branchloop{'branchname'} = 0;
+        $branchloop{'branchcode'} = 0;
+    }
+    push( @branchesloop, \%branchloop );
+}
+
+$template->param(
+    branchesloop => \@branchesloop,
+    show_date    => format_date($todaysdate),
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/circ/transferstoreceive.tmpl b/koha-tmpl/intranet-tmpl/prog/en/circ/transferstoreceive.tmpl
new file mode 100644 (file)
index 0000000..36aa344
--- /dev/null
@@ -0,0 +1,61 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha &rsaquo; Circulation</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
+
+<div id="mainbloc">
+       <h1 class="circulation">Transfers made TO your library the : <!-- TMPL_VAR NAME="show_date" --></h1>
+        <p>You are the destination of this transfer</p>
+       <div id="resultlist">
+       <!-- TMPL_LOOP NAME="branchesloop" -->
+               <!-- TMPL_IF NAME="branchcode" -->
+               <table>
+               <tr>
+                       <th class="circulation" colspan="5">Coming from <!-- TMPL_VAR NAME="branchname" --> </th>
+               </tr>
+               <tr>
+                       <th class="circulation">Date of transfer</th>
+                       <th class="circulation">Title</th>
+                       <th class="circulation">Reserved by </th>
+                       <th class="circulation">Localisation</th>
+                       <th class="circulation">Action</th>
+               </tr>
+               <!-- TMPL_LOOP NAME="reserv" -->
+                       <tr <!-- TMPL_IF NAME="messcompa" --> class="problem" <!-- /TMPL_IF -->>
+                               <td><p><!-- TMPL_VAR NAME="datetransfer" --></p> <!-- TMPL_IF NAME="messcompa" --> check this transfer<!-- /TMPL_IF --></td>
+                               <td>
+                                       <p>
+                                               <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a>
+                                               &nbsp; (<b><!-- TMPL_VAR NAME="itemtype" --> </b>)
+                                               <br />Barcode : <!-- TMPL_VAR NAME="barcode" -->
+                                       </p>
+                               </td>
+                               <td>
+                               <!-- TMPL_IF NAME="borrowername" -->
+                                       <p><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernum"-->"><!-- TMPL_VAR NAME="borrowername" --> &nbsp; <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br /><!-- TMPL_VAR NAME="borrowerphone" --><br />
+                               <!-- TMPL_IF NAME="borrowermail" --><a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Reservation: <!-- TMPL_VAR NAME="title" -->">
+       <!-- TMPL_VAR NAME="borrowermail" --></a><!--/TMPL_IF-->
+                                       </p>
+                               <!-- TMPL_ELSE -->
+                                       <p>
+                                       None
+                                       </p>
+                               <!-- /TMPL_IF -->
+                               </td>
+                               <td><p><!-- TMPL_VAR NAME="homebranch" --> <!-- TMPL_VAR NAME="itemcallnumber" --></p></td>
+                               <td>
+                               <!--<form name="dotransfer" action="currenttransfers.pl" method="post">
+                                               <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->">
+                               <input type="submit" value="Cancel this transfer">
+                               </form>-->
+                               </td>   
+                       </tr>
+               <!-- /TMPL_LOOP -->     
+               </table>
+               <br><br>
+               <!-- /TMPL_IF -->
+       <!-- /TMPL_LOOP -->
+       </div>
+</div>
+<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
index 5727911..90143c8 100644 (file)
@@ -5,9 +5,8 @@
     <a href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set branch</a>
     <a href="/cgi-bin/koha/circ/reserve.pl">Pending</a>
     <a href="/cgi-bin/koha/circ/branchreserves.pl">Waiting</a>
-    <a href="/cgi-bin/koha/circ/waitingreservestransfers.pl">Transfers (waiting)</a>
-    <a href="/cgi-bin/koha/circ/currenttransfers.pl">Transfers(current)</a>
-       <a href="/cgi-bin/koha/circ/overdue.pl">Overdues</a>
+    <a href="/cgi-bin/koha/circ/waitingreservestransfers.pl">Transfers to do</a>
+    <a href="/cgi-bin/koha/circ/currenttransfers.pl">Transfersto receive</a>
     <a href="/cgi-bin/koha/circ/branchoverdues.pl">Overdues by branch/department</a>
     <a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">Daily reconciliation</a>
 </div>
index 2615cb6..5dd6112 100755 (executable)
@@ -246,7 +246,7 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
 #
 # find reserves
 #
-# my ($rescount,$reserves)=FindReserves('',$borrowernumber); #From C4::Reserves2
+# my ($rescount,$reserves)=FindReserves('',$borrowernumber); #From C4::Reserves
 # my @reservedata;
 # $toggle = 0;
 # foreach my $reserveline (@$reserves) {
index 1732eb7..c2aa3ff 100755 (executable)
@@ -43,7 +43,7 @@ my $CancelItemnumber=$input->param('CancelItemnumber');
 
 # 2 possibilitys : cancel an item reservation, or modify or cancel the queded list
 
-# 1) cancel an item reservation by fonction GlobalCancel (in reserves2.pm)
+# 1) cancel an item reservation by fonction GlobalCancel (in reserves.pm)
 if ($CancelBorrowerNumber) {
        GlobalCancel($CancelItemnumber, $CancelBorrowerNumber);
        $biblionumber[0] = $CancelBiblioNumber,
@@ -52,7 +52,7 @@ if ($CancelBorrowerNumber) {
 # 2) Cancel or modify the queue list of reserves (without item linked)
 else {
        for (my $i=0;$i<$count;$i++){
-               UpdateReserve($rank[$i],$biblionumber[$i],$borrower[$i],$branch[$i],$itemnumber[$i]); #from C4::Reserves2
+               UpdateReserve($rank[$i],$biblionumber[$i],$borrower[$i],$branch[$i],$itemnumber[$i]); #from C4::Reserves
        }
 }
 my $from=$input->param('from');