From 9f42b8ad49fb17c4cbea4825639de7c4212f681c Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 23 Apr 2007 15:21:17 +0000 Subject: [PATCH] renaming currenttransfers to transferstoreceive --- C4/Biblio.pm | 5 +- C4/Circulation.pm | 39 ++++- C4/Context.pm | 5 +- C4/Members.pm | 2 +- C4/Reserves.pm | 2 +- circ/circulation.pl | 16 -- circ/returns.pl | 13 -- circ/transferstoreceive.pl | 143 ++++++++++++++++++ .../prog/en/circ/transferstoreceive.tmpl | 61 ++++++++ .../prog/en/includes/menu-circ.inc | 5 +- members/moremember.pl | 2 +- reserve/modrequest.pl | 4 +- 12 files changed, 250 insertions(+), 47 deletions(-) create mode 100644 circ/transferstoreceive.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/circ/transferstoreceive.tmpl diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 2bf3d8f761..f864e599e7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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 # diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9c0c824f1d..71d3c22d7f 100755 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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; } diff --git a/C4/Context.pm b/C4/Context.pm index 6a25a4ae08..d1b1bac07b 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -875,6 +875,9 @@ Joshua Ferraro =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 # 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 diff --git a/C4/Members.pm b/C4/Members.pm index 6bfb9f520c..f628e48e5a 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -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; diff --git a/C4/Reserves.pm b/C4/Reserves.pm index d7d47bfe42..20292deb46 100755 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -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 diff --git a/circ/circulation.pl b/circ/circulation.pl index 1f79ae8939..f5f79d0cb5 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -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; - } -} diff --git a/circ/returns.pl b/circ/returns.pl index d7ace40a54..f0a9beb930 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -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 index 0000000000..5ec5dac3f8 --- /dev/null +++ b/circ/transferstoreceive.pl @@ -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 index 0000000000..36aa344bdf --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/circ/transferstoreceive.tmpl @@ -0,0 +1,61 @@ + +Koha › Circulation + + + + +
+

Transfers made TO your library the :

+

You are the destination of this transfer

+
+ + + + + + + + + + + + + + + class="problem" > + + + + + + + +
Coming from
Date of transferTitleReserved by LocalisationAction

check this transfer
+

+ "> +   ( ) +
Barcode : +

+
+ +

">  

+ ?subject=Reservation: "> + +

+ +

+ None +

+ +

+ "> + + --> +
+

+ + +
+
+ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc index 5727911d9b..90143c82f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc @@ -5,9 +5,8 @@ Set branch Pending Waiting - Transfers (waiting) - Transfers(current) - Overdues + Transfers to do + Transfersto receive Overdues by branch/department Daily reconciliation diff --git a/members/moremember.pl b/members/moremember.pl index 2615cb661c..5dd6112004 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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) { diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl index 1732eb747a..c2aa3ffc96 100755 --- a/reserve/modrequest.pl +++ b/reserve/modrequest.pl @@ -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'); -- 2.39.5