new dev : create 3 new program for circulation :

branchreserves : to see reserves for one library (with the branchip selection or librarian preferences)

currenttransfers : show all the transfers are waiting in the library

waitingreservetransfers: show all the book the librarian have to transfer to an another library .

"actions" are bugged, will be corrected .
This commit is contained in:
alaurin 2006-05-19 17:01:02 +00:00
parent ca7dc72536
commit c98bae12bb
11 changed files with 896 additions and 24 deletions

View file

@ -83,8 +83,13 @@ Also deals with stocktaking.
&fixdate
get_return_date_of
get_transfert_infos
&checktransferts
&GetReservesForBranch
&GetReservesToBranch
&GetTransfersFromBib
&getBranchIp
&dotranfer
);
# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
=head2 itemseen
@ -503,11 +508,11 @@ sub transferbook {
my ($resfound, $resrec) = CheckReserves($iteminformation->{'itemnumber'});
if ($resfound and not $ignoreRs) {
$resrec->{'ResFound'} = $resfound;
$messages->{'ResFound'} = $resrec;
$dotransfer = 0;
# $messages->{'ResFound'} = $resrec;
$dotransfer = 1;
}
#actually do the transfer....
if ($dotransfer) {
if ($dotransfer and not $resfound) {
dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr);
$messages->{'WasTransfered'} = 1;
}
@ -524,10 +529,10 @@ sub dotransfer {
$fbr = $dbh->quote($fbr);
$tbr = $dbh->quote($tbr);
#new entry in branchtransfers....
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch)
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datesent, tobranch)
VALUES ($itm, $fbr, now(), $tbr)");
#update holdingbranch in items .....
$dbh->do("UPDATE items set holdingbranch = $tbr WHERE items.itemnumber = $itm");
$dbh->do("UPDATE items set holdingbranch = $tbr WHERE items.itemnumber = $itm");
&itemseen($itm);
&domarctransfer($dbh,$itm);
return;
@ -897,7 +902,7 @@ sub issuebook {
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
}
} elsif ($restype eq "Reserved") {
warn "Reserved";
# warn "Reserved";
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
@ -914,7 +919,7 @@ sub issuebook {
} else {
# my $tobrcd = ReserveWaiting($res->{'itemnumber'}, $res->{'borrowernumber'});
# transferbook($tobrcd,$barcode, 1);
warn "transferbook";
# warn "transferbook";
}
}
}
@ -934,8 +939,8 @@ sub issuebook {
$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef, $env->{'branchcode'});
$sth->finish;
$iteminformation->{'issues'}++;
$sth=$dbh->prepare("update items set issues=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth=$dbh->prepare("update items set issues=?, holdingbranch=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});
$sth->finish;
&itemseen($iteminformation->{'itemnumber'});
itemborrowed($iteminformation->{'itemnumber'});
@ -1092,28 +1097,64 @@ sub returnbook {
$messages->{'wthdrawn'} = 1;
$doreturn = 0;
}
# 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) = getpatroninformation(\%env, $currentborrower, 0);
if ($doreturn) {
my $sth = $dbh->prepare("update issues set returndate = now() where (borrowernumber = ?) and (itemnumber = ?) and (returndate is null)");
$sth->execute($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'});
# FIXME the holdingbranch is updated if the document is returned in an other location .
if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'}){
my $sth_upd_location = $dbh->prepare("UPDATE items SET holdingbranch=? WHERE itemnumber=?");
$sth_upd_location->execute(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});
$sth_upd_location->finish;
$iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'};
}
$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right?
}
itemseen($iteminformation->{'itemnumber'});
($borrower) = getpatroninformation(\%env, $currentborrower, 0);
# transfer book to the current branch
my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
if ($transfered) {
$messages->{'WasTransfered'} = 1; # FIXME is the "= 1" right?
}
# FIXME function transfered still always used ????
# my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
# if ($transfered) {
# $messages->{'WasTransfered'} = 1; # FIXME is the "= 1" right?
# }
# fix up the accounts.....
if ($iteminformation->{'itemlost'}) {
fixaccountforlostandreturned($iteminformation, $borrower);
$messages->{'WasLost'} = 1; # FIXME is the "= 1" right?
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# check if we have a transfer for this document
my $checktransfer = checktransferts($iteminformation->{'itemnumber'});
# if we have a return, we update the line of transfers with the datearrived
if ($checktransfer){
my $sth = $dbh->prepare("update branchtransfers set datearrived = now() where itemnumber= ? AND datearrived IS NULL");
$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'
my $updateWaiting = SetWaitingStatus($iteminformation->{'itemnumber'});
}
# if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly .
else {
# new op dev
my $checkreserves = CheckReserves($iteminformation->{'itemnumber'});
if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves)){
my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'});
$messages->{'WasTransfered'} = 1;
}
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 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
my ($resfound, $resrec) = CheckReserves($iteminformation->{'itemnumber'});
if ($resfound) {
# my $tobrcd = ReserveWaiting($resrec->{'itemnumber'}, $resrec->{'borrowernumber'});
@ -1967,6 +2008,87 @@ SELECT datesent,
return @row;
}
sub DeleteTransfer {
my($itemnumber) = @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("DELETE FROM branchtransfers
where itemnumber=?
AND datearrived is null ");
$sth->execute($itemnumber);
$sth->finish;
}
sub GetTransfersFromBib {
my($frombranch,$tobranch) = @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT itemnumber,datesent,frombranch FROM
branchtransfers
where frombranch=?
AND tobranch=?
AND datearrived is null ");
$sth->execute($frombranch,$tobranch);
my @gettransfers;
my $i=0;
while (my $data=$sth->fetchrow_hashref){
$gettransfers[$i]=$data;
$i++;
}
$sth->finish;
return(@gettransfers);
}
sub GetReservesToBranch {
my($frombranch,$default) = @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT borrowernumber,reservedate,itemnumber,timestamp FROM
reserves
where priority='0' AND cancellationdate is null
AND branchcode=?
AND branchcode!=?
AND found is null ");
$sth->execute($frombranch,$default);
my @transreserv;
my $i=0;
while (my $data=$sth->fetchrow_hashref){
$transreserv[$i]=$data;
$i++;
}
$sth->finish;
return(@transreserv);
}
sub GetReservesForBranch {
my($frombranch) = @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT borrowernumber,reservedate,itemnumber,waitingdate FROM
reserves
where priority='0' AND cancellationdate is null
AND found='W'
AND branchcode=? order by reservedate");
$sth->execute($frombranch);
my @transreserv;
my $i=0;
while (my $data=$sth->fetchrow_hashref){
$transreserv[$i]=$data;
$i++;
}
$sth->finish;
return(@transreserv);
}
sub checktransferts{
my($itemnumber) = @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT datesent,frombranch,tobranch FROM branchtransfers
WHERE itemnumber = ? AND datearrived IS NULL");
$sth->execute($itemnumber);
my @tranferts = $sth->fetchrow_array;
$sth->finish;
return (@tranferts);
}
1;
__END__
@ -1977,3 +2099,4 @@ __END__
Koha Developement team <info@koha.org>
=cut

View file

@ -66,11 +66,153 @@ FIXME
&UpdateReserve
&getreservetitle
&Findgroupreserve
&FastFindReserves
&SetWaitingStatus
&GlobalCancel
&MinusPriority
&OtherReserves
GetFirstReserveDateFromItem
GetNumberReservesFromBorrower
);
# make all your functions, whether exported or not;
=item GlobalCancel
New op dev for the circulation based on item, global is a function to cancel reserv,check other reserves, and transfer document if it's necessary
=cut
#'
sub GlobalCancel {
my $messages;
my $nextreservinfo;
my ($itemnumber,$borrowernumber)=@_;
# step 1 : cancel the reservation
my $CancelReserve = CancelReserve(0,$itemnumber,$borrowernumber);
# step 2 launch the subroutine of the others reserves
my ($messages,$nextreservinfo) = OtherReserves($itemnumber);
return ($messages,$nextreservinfo);
}
=item OtherReserves
New op dev: check queued list of this document and check if this document must be transfered
=cut
#'
sub OtherReserves {
my ($itemnumber)=@_;
my $messages;
my $nextreservinfo;
my ($restype,$checkreserves) = CheckReserves($itemnumber);
if ($checkreserves){
my %env;
my $iteminfo = C4::Circulation::Circ2::getiteminformation(\%env,$itemnumber);
if ($iteminfo->{'holdingbranch'} ne $checkreserves->{'branchcode'}){
$messages->{'transfert'} = $checkreserves->{'branchcode'};
# minus priorities of others reservs
MinusPriority($itemnumber,$checkreserves->{'borrowernumber'},$iteminfo->{'biblionumber'});
# launch the subroutine dotransfer
C4::Circulation::Circ2::dotransfer($itemnumber,$iteminfo->{'holdingbranch'},$checkreserves->{'branchcode'}),
}
# step 2b : case of a reservation on the same branch, set the waiting status
else{
$messages->{'waiting'} = 1;
MinusPriority($itemnumber,$checkreserves->{'borrowernumber'},$iteminfo->{'biblionumber'});
SetWaitingStatus($itemnumber);
}
$nextreservinfo = $checkreserves->{'borrowernumber'};
}
return ($messages,$nextreservinfo);
}
=item MinusPriority
Reduce the values of queuded list
=cut
#'
sub MinusPriority{
my ($itemnumber,$borrowernumber,$biblionumber)=@_;
# first step update the value of the first person on reserv
my $dbh = C4::Context->dbh;
my $sth_upd=$dbh->prepare("UPDATE reserves SET priority = 0 , itemnumber = ?
WHERE cancellationdate is NULL
AND borrowernumber=?
AND biblionumber=?");
$sth_upd->execute($itemnumber,$borrowernumber,$biblionumber);
$sth_upd->finish;
# second step update all others reservs
my $sth_oth=$dbh->prepare("SELECT priority,borrowernumber,biblionumber,reservedate FROM reserves WHERE priority !='0' AND cancellationdate is NULL");
$sth_oth->execute();
while (my ($priority,$borrowernumber,$biblionumber,$reservedate)=$sth_oth->fetchrow_array){
$priority--;
my $sth_upd_oth = $dbh->prepare("UPDATE reserves SET priority = ?
WHERE biblionumber = ?
AND borrowernumber = ?
AND reservedate = ?");
$sth_upd_oth->execute($priority,$biblionumber,$borrowernumber,$reservedate);
$sth_upd_oth->finish;
}
$sth_oth->finish;
}
=item GlobalCancel
New op dev for the circulation based on item, global is a function to cancel reserv,check other reserves, and transfer document if it's necessary
=cut
#'
# New op dev :
# we check if we have a reserves with itemnumber (New op system of reserves), if we found one, we update the status of the reservation when we have : 'priority' = 0, and we have an itemnumber
sub SetWaitingStatus{
# first : check if we have a reservation for this item .
my ($itemnumber)=@_;
my $dbh = C4::Context->dbh;
my $sth_find=$dbh->prepare("SELECT priority,borrowernumber from reserves WHERE itemnumber=? and cancellationdate is NULL and found is NULL and priority='0'");
$sth_find->execute($itemnumber);
my ($priority,$borrowernumber) = $sth_find->fetchrow_array;
$sth_find->finish;
if (not $borrowernumber){
return();
}
else{
# step 2 : if we have a borrowernumber, we update the value found to 'W' for notify the borrower
my $sth_set=$dbh->prepare("UPDATE reserves SET found='W',waitingdate = now() where borrowernumber=? AND itemnumber=? AND found is null");
$sth_set->execute($borrowernumber,$itemnumber);
$sth_set->finish;
}
}
sub FastFindReserves {
my ($itemnumber,$borrowernumber)=@_;
if ($itemnumber){
my $dbh = C4::Context->dbh;
my $sth_res=$dbh->prepare("SELECT reservedate,borrowernumber from reserves WHERE itemnumber=? and cancellationdate is NULL AND (found != 'F' or found is null)");
$sth_res->execute($itemnumber);
my ($reservedate,$borrowernumber)=$sth_res->fetchrow_array;
$sth_res->finish;
return($reservedate,$borrowernumber);
}
if ($borrowernumber){
my $dbh = C4::Context->dbh;
my $sth_find=$dbh->prepare("SELECT * from reserves WHERE borrowernumber=? and cancellationdate is NULL and (found != 'F' or found is null) order by reservedate");
$sth_find->execute($borrowernumber);
my @borrowerreserv;
my $i=0;
while (my $data=$sth_find->fetchrow_hashref){
$borrowerreserv[$i]=$data;
$i++;
}
$sth_find->finish;
return (@borrowerreserv);
}
}
=item FindReserves
@ -551,13 +693,17 @@ sub Findgroupreserve {
# C4::Reserves. Pick one and stick with it.
# XXX - POD
sub CreateReserve {
my
($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title)= @_;
my ($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title,$checkitem,$found)= @_;
my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems);
my $dbh = C4::Context->dbh;
my $const = lc substr($constraint,0,1);
my @datearr = localtime(time);
my $resdate =(1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $waitingdate;
# If the reserv had the waiting status, we had the value of the resdate
if ($found eq 'W'){
$waitingdate = $resdate;
}
#eval {
# updates take place here
if ($fee > 0) {
@ -572,9 +718,9 @@ sub CreateReserve {
}
#if ($const eq 'a'){
my $sth = $dbh->prepare("insert into reserves
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes)
values (?,?,?,?,?,?,?)");
$sth->execute($borrnum,$biblionumber,$resdate,$branch,$const,$priority,$notes);
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes,itemnumber,found,waitingdate)
values (?,?,?,?,?,?,?,?,?,?)");
$sth->execute($borrnum,$biblionumber,$resdate,$branch,$const,$priority,$notes,$checkitem,$found,$waitingdate);
$sth->finish;
#}
if (($const eq "o") || ($const eq "e")) {

137
circ/branchreserves.pl Executable file
View file

@ -0,0 +1,137 @@
#!/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 C4::Context;
use C4::Output;
use CGI;
use HTML::Template;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use Date::Manip;
use C4::Reserves2;
use C4::Search;
my $input = new CGI;
my $item=$input->param('itemnumber');
my $borrowernumber=$input->param('borrowernumber');
my $fbr=$input->param('fbr');
my $tbr=$input->param('tbr');
my $cancel;
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "circ/branchreserves.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $default = C4::Context->userenv->{'branch'};
my @datearr = localtime(time());
my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
# if we have a return from the form we launch the subroutine CancelReserve
if ($item){
my $messages;
my $nextreservinfo;
my %env;
my $waiting;
($messages,$nextreservinfo) = GlobalCancel($item,$borrowernumber);
# if we have a result
if ($nextreservinfo){
my $borrowerinfo = getpatroninformation(\%env,$nextreservinfo);
my $iteminfo = C4::Circulation::Circ2::getiteminformation(\%env,$item);
if ($messages->{'transfert'}){
my $branchname = getbranchname($messages->{'transfert'});
$template->param(
messagetransfert => $messages->{'transfert'},
branchname => $branchname,
);
}
if ($messages->{'waiting'}){
$waiting = 1;
}
$template->param(
message => 1,
nextreservnumber => $nextreservinfo,
nextreservsurname => $borrowerinfo->{'surname'},
nextreservfirstname => $borrowerinfo->{'firstname'},
nextreservitem => $item,
nextreservtitle => $iteminfo->{'title'},
waiting => $waiting
);
}
# if the document is not in his homebranch location and there is not reservation after, we transfer it
if (($fbr ne $tbr) and (not $nextreservinfo)){
C4::Circulation::Circ2::dotransfer($item,$fbr,$tbr);
}
}
my @reservloop;
my @getreserves = GetReservesForBranch($default);
foreach my $num (@getreserves) {
my %getreserv;
my %env;
my $gettitle = getiteminformation(\%env,$num->{'itemnumber'});
my $getborrower = getpatroninformation (\%env,$num->{'borrowernumber'});
$getreserv{'waitingdate'} = format_date($num->{'waitingdate'});
my $calcDate=DateCalc($num->{'waitingdate'},"+".C4::Context->preference('ReservesMaxPickUpDelay')." days");
my $warning=Date_Cmp(ParseDate("today"),$calcDate);
if ($warning>0){
$getreserv{'messcompa'} = 1;
}
$getreserv{'title'} = $gettitle->{'title'};
$getreserv{'itemnumber'} = $gettitle->{'itemnumber'};
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
$getreserv{'barcode'} = $gettitle->{'barcode'};
# $getreserv{'itemtype'} = ItemType($gettitle->{'itemtype'});
$getreserv{'homebranch'} = $gettitle->{'homebranch'};
$getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
if ($gettitle->{'homebranch'} ne $gettitle->{'holdingbranch'}){
$getreserv{'dotransfer'} = 1;
}
$getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
$getreserv{'borrowernum'} = $getborrower->{'borrowernumber'};
$getreserv{'borrowername'} = $getborrower->{'surname'};
$getreserv{'borrowerfirstname'} = $getborrower->{'firstname'} ;
if ($getborrower->{'emailaddress'}){
$getreserv{'borrowermail'} = $getborrower->{'emailaddress'} ;
}
$getreserv{'borrowerphone'} = $getborrower->{'phone'};
push(@reservloop, \%getreserv);
}
$template->param( reserveloop => \@reservloop,
show_date => format_date($todaysdate),
);
print "Content-Type: text/html\n\n", $template->output;

123
circ/currenttransfers.pl Executable file
View file

@ -0,0 +1,123 @@
#!/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 C4::Context;
use C4::Output;
use CGI;
use HTML::Template;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use Date::Manip;
use C4::Koha;
use C4::Search;
use C4::Reserves2;
my $input = new CGI;
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
my $itemnumber = $input->param('itemnumber');
# 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/currenttransfers.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
# set the userenv branch
my $default = C4::Context->userenv->{'branch'};
my @datearr = localtime(time());
my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
# 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 = GetTransfersFromBib($branches->{$br}->{'branchcode'},$default);
if (@gettransfers){
foreach my $num (@gettransfers) {
my %getransf;
my %env;
my $calcDate=DateCalc($num->{'datesent'},"+".C4::Context->preference('TransfersMaxDaysWarning')." days");
my $warning=Date_Cmp(ParseDate("today"),$calcDate);
if ($warning>0){
$getransf{'messcompa'} = 1;
}
my $gettitle = getiteminformation(\%env,$num->{'itemnumber'});
$getransf{'title'} = $gettitle->{'title'};
$getransf{'datetransfer'} = format_date($num->{'datesent'});
$getransf{'biblionumber'} = $gettitle->{'biblionumber'};
$getransf{'itemnumber'} = $gettitle->{'itemnumber'};
$getransf{'barcode'} = $gettitle->{'barcode'};
# $getransf{'itemtype'} = ItemType($gettitle->{'itemtype'});
$getransf{'homebranch'} = $gettitle->{'homebranch'};
$getransf{'holdingbranch'} = $gettitle->{'holdingbranch'};
$getransf{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
# we check if we have a reserv for this transfer
my @checkreserv = FastFindReserves($num->{'itemnumber'});
if (@checkreserv[0]){
my $getborrower = getpatroninformation (\%env,$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)
);
print "Content-Type: text/html\n\n", $template->output;

126
circ/waitingreservestransfers.pl Executable file
View file

@ -0,0 +1,126 @@
#!/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 C4::Context;
use C4::Output;
use CGI;
use HTML::Template;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use Date::Manip;
use C4::Koha;
use C4::Biblio;
my $input = new CGI;
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "circ/waitingreservestransfers.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
# set the userenv branch
my $default = C4::Context->userenv->{'branch'};
my @datearr = localtime(time());
my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
my $item=$input->param('itemnumber');
my $fbr=$input->param('fbr');
my $tbr=$input->param('tbr');
# If we have a return of the form dotransfer, we launch the subroutine dotransfer
if ($item){
C4::Circulation::Circ2::dotransfer($item,$fbr,$tbr);
}
# get the all the branches for reference
my $branches = getbranches();
my @branchesloop;
foreach my $br (keys %$branches) {
my @reservloop;
my %branchloop;
$branchloop{'branchname'} = $branches->{$br}->{'branchname'};
$branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
my @getreserves = GetReservesToBranch($branches->{$br}->{'branchcode'},$default);
if (@getreserves){
foreach my $num (@getreserves) {
my %getreserv;
my %env;
my $gettitle = getiteminformation(\%env,$num->{'itemnumber'});
if ($gettitle->{'holdingbranch'} eq $default){
my $getborrower = getpatroninformation (\%env,$num->{'borrowernumber'});
$getreserv{'reservedate'} = format_date($num->{'reservedate'});
my $calcDate=DateCalc($num->{'reservedate'},"+".C4::Context->preference('MaxDaysRecoveryReserves')." days");
my $warning=Date_Cmp(ParseDate("today"),$calcDate);
if ($warning>0){
$getreserv{'messcompa'} = 1;
}
$getreserv{'title'} = $gettitle->{'title'};
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
$getreserv{'itemnumber'} = $gettitle->{'itemnumber'};
$getreserv{'barcode'} = $gettitle->{'barcode'};
# $getreserv{'itemtype'} = get_iteminfos_of($gettitle->{'itemtype'}->{'description'});
$getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
$getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
$getreserv{'borrowernum'} = $getborrower->{'borrowernumber'};
$getreserv{'borrowername'} = $getborrower->{'surname'};
$getreserv{'borrowerfirstname'} = $getborrower->{'firstname'} ;
if ($getborrower->{'emailaddress'}){
$getreserv{'borrowermail'} = $getborrower->{'emailaddress'} ;
}
$getreserv{'borrowerphone'} = $getborrower->{'phone'};
push(@reservloop, \%getreserv);
}
}
# If we have a return of reservloop we put it in the branchloop sequence
if (@reservloop){
$branchloop{'reserv'} = \@reservloop ;
}
# else, we unset the value of the branchcode .
else{
$branchloop{'branchcode'} = 0;
}
}
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)
);
print "Content-Type: text/html\n\n", $template->output;

View file

@ -0,0 +1,82 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Circulation
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
<h1>Circulation: Branch Reserves</h1>
<div id="mainbloc">
<h1 class="circulation">Reservs of your library the : <!-- TMPL_VAR NAME="show_date" --></h1>
<!-- TMPL_IF NAME="messagetransfert" -->
<div>
<h2>Reserv find for the document(<!-- TMPL_VAR NAME="nextreservtitle" -->)must transfered</h2>
<p>This documen is reserved by : <b> <!-- TMPL_VAR NAME="nextreservsurname" --> <!-- TMPL_VAR NAME="nextreservfirstname" --></b> at the library : <b> <!-- TMPL_VAR NAME="branchname" --> </b>, Please put this document in transfer .
</p>
<form name="cancelReservewithtransfert" action="branchreserves.pl" method="post">
<input type="submit" class="button circulation">
</form>
</div>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="waiting" -->
<div id="bloc25">
<h2 class="circulation">This document is in Waiting status</h2>
<p>This document (<!-- TMPL_VAR NAME="nextreservtitle" -->) is reserved by <b> : <!-- TMPL_VAR NAME="nextreservsurname" --> <!-- TMPL_VAR NAME="nextreservfirstname" --></b>,
Please keep this document for the next reserv .
</p>
<form name="cancelReservewithwaiting" action="branchreserves.pl" method="post">
<input type="submit">
</form>
</div>
<!-- /TMPL_IF -->
<!-- TMPL_UNLESS NAME="message" -->
<div id="resultlist">
<table>
<tr>
<th class="circulation" colspan="5">Reservs of your library</th>
</tr>
<tr>
<th class="circulation">Available since</th>
<th class="circulation">Title</th>
<th class="circulation">Borrower</th>
<th class="circulation">Localisation</th>
<th class="circulation">Action</th>
</tr>
<!-- TMPL_LOOP NAME="reserveloop" -->
<tr <!-- TMPL_IF NAME="messcompa" --> class="problem" <!-- /TMPL_IF -->>
<td><p><!-- TMPL_VAR NAME="waitingdate" --></p> <!-- TMPL_IF NAME="messcompa" --> Reserv Over <!-- /TMPL_IF --></td>
<td>
<p>
<a href="/cgi-bin/koha/MARCdetail.pl?bib=<!-- 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>
<p><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!--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>
</td>
<td><p><!-- TMPL_VAR NAME="homebranch" --> <!-- TMPL_VAR NAME="itemcallnumber" --></p></td>
<td>
<form name="cancelReserve -->" action="branchreserves.pl" method="post">
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernum" -->">
<input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->">
<input type="hidden" name="fbr" value="<!-- TMPL_VAR NAME="holdingbranch" -->">
<input type="hidden" name="tbr" value="<!-- TMPL_VAR NAME="homebranch" -->">
<input type="submit"
<!-- TMPL_IF NAME="dotransfer" -->
value="Cancel reserv and return this document"
<!-- TMPL_ELSE -->
value="Cancel reserv"
<!-- /TMPL_IF -->
>
</form>
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</div>
<!-- /TMPL_UNLESS -->
</div>
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

View file

@ -0,0 +1,59 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Circulation
<!-- 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 in wait for your library the : <!-- TMPL_VAR NAME="show_date" --></h1>
<div id="resultlist">
<!-- TMPL_LOOP NAME="branchesloop" -->
<!-- TMPL_IF NAME="branchcode" -->
<table>
<tr>
<th class="circulation" colspan="5">current transfers from the library : <!-- TMPL_VAR NAME="branchname" --> </th>
</tr>
<tr>
<th class="circulation">Date of transfer</th>
<th class="circulation">Title</th>
<th class="circulation">Borrower</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?bib=<!-- 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?bornum=<!--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>
Transfer without reserv linked
</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" -->

View file

@ -0,0 +1,62 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Circulation
<!-- TMPL_IF Name="borrowernumber" -->
: Issuing to <!-- TMPL_VAR name="surname" -->, <!-- TMPL_VAR name="firstname" -->
(<!-- TMPL_VAR NAME="cardnumber" -->)
<!-- /TMPL_IF -->
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
<h1>Circulation: Transfers in wait</h1>
<div id="mainbloc">
<h1>Transfers to do <!-- TMPL_VAR NAME="show_date" --></h1>
<div id="resultlist">
<!-- TMPL_LOOP NAME="branchesloop" -->
<!-- TMPL_IF NAME="branchcode" -->
<table>
<tr>
<th class="circulation" colspan="5">Reservs in wait to the library : <!-- TMPL_VAR NAME="branchname" --> </th>
</tr>
<tr>
<th class="circulation">Date of reserv</th>
<th class="circulation">Title</th>
<th class="circulation">Borrower</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="reservedate" --></p> <!-- TMPL_IF NAME="messcompa" --> Reserv over <!-- /TMPL_IF --></td>
<td>
<p>
<a href="/cgi-bin/koha/MARCdetail.pl?bib=<!-- 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>
<p><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!--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>
</td>
<td><p><!-- TMPL_VAR NAME="holdingbranch" --> <!-- TMPL_VAR NAME="itemcallnumber" --></p></td>
<td>
<form name="dotransfer" action="waitingreservestransfers.pl" method="post">
<input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->">
<input type="hidden" name="fbr" value="<!-- TMPL_VAR NAME="holdingbranch" -->">
<input type="hidden" name="tbr" value="<!-- TMPL_VAR NAME="branchcode" -->">
<input type="submit" value="Transfer this document">
</form>
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
<br><br>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</div>
</div>
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

View file

@ -0,0 +1,8 @@
<a href="/cgi-bin/koha/circ/circulation.pl">Circulation</a>
<a href="/cgi-bin/koha/circ/circulation.pl">Issues</a>
<a href="/cgi-bin/koha/circ/returns.pl">Returns</a>
<a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfers</a>
<a href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set branch</a>
<a href="/cgi-bin/koha/circ/branchreserves.pl">Waiting reserves</a>
<a href="/cgi-bin/koha/circ/waitingreservestransfers.pl">Transfers to do</a>
<a href="/cgi-bin/koha/circ/currenttransfers.pl">Transfers to recieve</a>

View file

@ -1,4 +1,5 @@
<script language="JavaScript" type="text/javascript">
function _(s) { return s } // dummy function for gettext
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
}

View file

@ -7,14 +7,19 @@
<li><a href="/cgi-bin/koha/circ/circulation.pl">Issues</a></li>
<li><a href="/cgi-bin/koha/circ/returns.pl">Returns</a></li>
<li><a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfers</a></li>
<li><a href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set Branch</a></li>
<li><a href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set branch</a></li>
<li><a href="/cgi-bin/koha/circ/branchreserves.pl">Waiting reserves</a></li>
<li><a href="/cgi-bin/koha/circ/waitingreservestransfers.pl">Transfers to do</a></li>
<li><a href="/cgi-bin/koha/circ/currenttransfers.pl">Transfers to recieve</a></li>
</ul>
</li>
<li>Members
<ul>
<li><a href="/cgi-bin/koha/members/members-home.pl">Member Search</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?actionType=Add">Add Member</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?categorycode=I&actionType=Add">Add Institution</a></li>
<li><a href="/cgi-bin/koha/members/members-home.pl">Search</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=A"/>Add adult</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=C"/>Add child</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=P"/>Add prof</a></li>
<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=I"/>Add org</a></li>
</ul>
</li>
<li>Catalogue