Applying the fix for bug 1416 from paul

Had to edit the patch as it was corrupt
This commit is contained in:
Chris Cormack 2007-09-20 17:39:43 -05:00
parent 3206db0692
commit 1a4fc157bf
11 changed files with 78 additions and 24 deletions

View File

@ -4,6 +4,8 @@
package C4::Reserves;
# Copyright 2000-2002 Katipo Communications
# 2006 SAN Ouest Provence
# 2007 BibLibre Paul POULAIN
#
# This file is part of Koha.
#
@ -47,7 +49,33 @@ C4::Reserves - Koha functions for dealing with reservation.
=head1 DESCRIPTION
this modules provides somes functions to deal with reservations.
Reserves are stored in reserves table.
The following columns contains important values :
- priority >0 : then the reserve is at 1st stage, and not yet affected to any item.
=0 : then the reserve is being dealed
- found : NULL : means the patron requested the 1st available, and we haven't choosen the item
W(aiting) : the reserve has an itemnumber affected, and is on the way
F(inished) : the reserve has been completed, and is done
- itemnumber : empty : the reserve is still unaffected to an item
filled: the reserve is attached to an item
The complete workflow is :
==== 1st use case ====
patron request a document, 1st available : P >0, F=NULL, I=NULL
a library having it run "transfertodo", and clic on the list
if there is no transfer to do, the reserve waiting
patron can pick it up P =0, F=W, I=filled
if there is a transfer to do, write in branchtransfer P =0, F=NULL, I=filled
The pickup library recieve the book, it check in P =0, F=W, I=filled
The patron borrow the book P =0, F=F, I=filled
==== 2nd use case ====
patron requests a document, a given item,
If pickup is holding branch P =0, F=W, I=filled
If transfer needed, write in branchtransfer P =0, F=NULL, I=filled
The pickup library recieve the book, it checks it in P =0, F=W, I=filled
The patron borrow the book P =0, F=F, I=filled
=head1 FUNCTIONS
=over 2
@ -856,7 +884,7 @@ The itemnumber parameter is used to find the biblionumber.
with the biblionumber & the borrowernumber, we can affect the itemnumber
to the correct reserve.
if $transferToDo is set, then the status is set to "Waiting" as well.
if $transferToDo is not set, then the status is set to "Waiting" as well.
otherwise, a transfer is on the way, and the end of the transfer will
take care of the waiting status
=cut
@ -900,9 +928,6 @@ sub ModReserveAffect {
$sth = $dbh->prepare($query);
$sth->execute( $itemnumber, $borrowernumber,$biblionumber);
$sth->finish;
# now fix up the remaining priorities....
# _FixPriority( $data->{'priority'}, $biblio ); # can't work, 1st parameter should be $biblionumbern NOT priority. FIXME : remove this line if no problem seen once it is commented.
return;
}

View File

@ -107,6 +107,7 @@ my %tabsysprefs;
$tabsysprefs{ReservesMaxPickUpDelay}="Circulation";
$tabsysprefs{TransfersMaxDaysWarning}="Circulation";
$tabsysprefs{useDaysMode}="Circulation";
$tabsysprefs{ReservesNeedReturns}="Circulation";
# Intranet
$tabsysprefs{TemplateEncoding}="Intranet";

View File

@ -97,11 +97,10 @@ my $strsth =
biblio.title,
biblio.author
FROM reserves
LEFT JOIN items ON items.biblionumber=reserves.biblionumber,
borrowers,biblio
LEFT JOIN items ON items.biblionumber=reserves.biblionumber
LEFT JOIN borrowers ON reserves.borrowernumber=borrowers.borrowernumber
LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber
WHERE isnull(cancellationdate)
&& reserves.borrowernumber=borrowers.borrowernumber
&& reserves.biblionumber=biblio.biblionumber
&& reserves.found is NULL
&& items.holdingbranch=?
";

View File

@ -1,6 +1,8 @@
#!/usr/bin/perl
# Copyright 2000-2002 Katipo Communications
# 2006 SAN-OP
# 2007 BibLibre, Paul POULAIN
#
# This file is part of Koha.
#
@ -21,8 +23,6 @@
script to execute returns of books
written 11/3/2002 by Finlay
=cut
use strict;
@ -103,7 +103,6 @@ if ($query->param('WT-itemNumber')){
updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From'));
}
if ( $query->param('resbarcode') ) {
my $item = $query->param('itemnumber');
my $borrowernumber = $query->param('borrowernumber');
@ -115,13 +114,12 @@ if ( $query->param('resbarcode') ) {
# addin in ModReserveAffect the possibility to check if the document is expected in this library or not,
# if not we send a value in reserve waiting for not implementting waiting status
if ($diffBranchReturned) {
$diffBranchSend = $diffBranchReturned;
}
else {
$diffBranchSend = undef;
}
if ($diffBranchReturned) {
$diffBranchSend = $diffBranchReturned;
}
else {
$diffBranchSend = undef;
}
ModReserveAffect( $item, $borrowernumber,$diffBranchSend);
# check if we have other reservs for this document, if we have a return send the message of transfer
my ( $messages, $nextreservinfo ) = GetOtherReserves($item);
@ -294,6 +292,7 @@ if ( $messages->{'ResFound'} and not $messages->{'WrongTransfer'}) {
gonenoaddress => $borr->{'gonenoaddress'},
currentbranch => $branches->{C4::Context->userenv->{'branch'}}->{'branchname'},
itemnumber => $reserve->{'itemnumber'},
barcode => $barcode,
);
}
@ -319,6 +318,7 @@ if ( $messages->{'ResFound'} and not $messages->{'WrongTransfer'}) {
destbranch => $reserve->{'branchcode'},
transfertodo => ( C4::Context->userenv->{'branch'} eq $reserve->{'branchcode'} ? 0 : 1 ),
reserved => 1,
resbarcode => $barcode,
today => $todaysdate,
itemnumber => $reserve->{'itemnumber'},
borsurname => $borr->{'surname'},

View File

@ -97,3 +97,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('virtualshelves','1','Set virtual shelves management ON or OFF','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('z3950AuthorAuthFields','701,702,700','contains the MARC biblio tags of person authorities to fill biblio.author with w',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('z3950NormalizeAuthor','0','If set, Personal Name Authorities will replace authors in biblio.author','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesNeedReturns','0','If set, a reserve done on an item available in this branch need a check-in, otherwise, a reserve on a specific item, that is on the branch & available is considered as available','','YesNo');

View File

@ -76,7 +76,10 @@
<input type="hidden" name="dd-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="duedate" -->" />
<input type="hidden" name="bn-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="borrowernumber" -->" />
<!-- /TMPL_LOOP -->
<input type="hidden" name="barcode" value="0" />
<input type="hidden" name="itemnumber" value="<!-- TMPL_VAR Name="itemnumber" -->" />
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR Name="borrowernumber" -->" />
<input type="hidden" name="resbarcode" value="<!-- TMPL_VAR Name="barcode" -->" />
<input type="hidden" name="diffBranch" value="<!-- TMPL_VAR Name="destbranch" -->" />
</form>
<!-- /TMPL_IF -->

View File

@ -287,7 +287,11 @@ if (alreadyreserved > "0"){
<td>
<!-- TMPL_IF Name="wait" -->
<!-- TMPL_IF NAME="atdestination" -->
Document waiting at <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value="<!-- TMPL_VAR NAME="wbrcd" -->" />
<!-- TMPL_IF name="found" -->
Document waiting at <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value=<!-- TMPL_VAR NAME="wbrcd" --> />
<!-- TMPL_ELSE -->
Waiting to be pulled
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
Document will be transfered to <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value="<!-- TMPL_VAR NAME="wbrcd" -->" />
<!-- /TMPL_IF -->

View File

@ -8,7 +8,7 @@
# and is automatically called by Auth.pm when needed.
sub kohaversion {
return "3.00.00.002";
return "3.00.00.003";
}
1;

View File

@ -33,7 +33,11 @@ my $input = new CGI;
#print $input->header;
my @bibitems=$input->param('biblioitem');
my @reqbib=$input->param('reqbib');
# FIXME I think reqbib does not exist anymore, it's used in line 82, to AddReserve of contraint type 'o'
# I bet it's a 2.x feature, reserving a given biblioitem, that is useless in Koha 3.0
# we can remove this line, the AddReserve of constrainttype 'o',
# and probably remove the reserveconstraint table as well, I never could fill anything in this table.
my @reqbib=$input->param('reqbib');
my $biblionumber=$input->param('biblionumber');
my $borrower=$input->param('member');
my $notes=$input->param('notes');
@ -51,7 +55,7 @@ if ($checkitem ne ''){
my $item = $checkitem;
$item = GetItem($item);
if ( $item->{'holdingbranch'} eq $branch ){
$found = 'W';
$found = 'W' unless C4::Context->preference('ReservesNeedReturns');
}
@ -77,6 +81,7 @@ if ($type eq 'str8' && $borrowernumber ne ''){
# place a request on 1st available
AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title,$checkitem,$found);
} elsif ($reqbib[0] ne ''){
# FIXME : elsif probably never reached, (see top of the script)
# place a request on a given item
AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$notes,$title,$checkitem, $found);
} else {

View File

@ -361,6 +361,8 @@ foreach my $res ( sort { $a->{found} cmp $b->{found} } @$reserves ) {
if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
$reserve{'atdestination'} = 1;
}
# set found to 1 if reserve is waiting for patron pickup
$reserve{'found'} = 1 if $res->{'found'} eq 'W';
}
# get borrowers reserve info

View File

@ -2189,6 +2189,20 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
=item
Deal with the sessions table that uses CGI::Session
=cut
$DBversion = "3.00.00.003";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
if (C4::Context->preference("opaclanguage") eq "fr") {
$dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesNeedReturns','0','Si ce paramètre est mis à 1, une réservation posée sur un exemplaire présent sur le site devra être passée en retour pour être disponible. Sinon, elle sera automatiquement disponible, Koha considère que le bibliothécaire place la réservation en ayant le document en mains','','YesNo')");
} else {
$dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesNeedReturns','0','If set, a reserve done on an item available in this branch need a check-in, otherwise, a reserve on a specific item, that is on the branch & available is considered as available','','YesNo')");
}
print "Upgrade to $DBversion done (adding ReservesNeedReturns systempref, in circulation)\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)