From 1a4fc157bfa17dee2a2122b9f86d1c598e063794 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 20 Sep 2007 17:39:43 -0500 Subject: [PATCH] Applying the fix for bug 1416 from paul Had to edit the patch as it was corrupt --- C4/Reserves.pm | 35 ++++++++++++++++--- admin/systempreferences.pl | 1 + circ/pendingreserves.pl | 7 ++-- circ/returns.pl | 20 +++++------ installer/data/en/mandatory/sysprefs.sql | 1 + .../prog/en/modules/circ/returns.tmpl | 5 ++- .../prog/en/modules/reserve/request.tmpl | 6 +++- kohaversion.pl | 2 +- reserve/placerequest.pl | 9 +++-- reserve/request.pl | 2 ++ updater/updatedatabase | 14 ++++++++ 11 files changed, 78 insertions(+), 24 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index f9f974704e..3d948a2c10 100755 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -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; } diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index b651a17f58..4489b183b9 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -107,6 +107,7 @@ my %tabsysprefs; $tabsysprefs{ReservesMaxPickUpDelay}="Circulation"; $tabsysprefs{TransfersMaxDaysWarning}="Circulation"; $tabsysprefs{useDaysMode}="Circulation"; + $tabsysprefs{ReservesNeedReturns}="Circulation"; # Intranet $tabsysprefs{TemplateEncoding}="Intranet"; diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 4952afa052..ac223905e5 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -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=? "; diff --git a/circ/returns.pl b/circ/returns.pl index 1c8cfa4738..31ff40f3dc 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -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'}, diff --git a/installer/data/en/mandatory/sysprefs.sql b/installer/data/en/mandatory/sysprefs.sql index 20cf97407f..48f9b8a51e 100644 --- a/installer/data/en/mandatory/sysprefs.sql +++ b/installer/data/en/mandatory/sysprefs.sql @@ -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'); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl index 7aa1f40ef8..43de66ed57 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl @@ -76,7 +76,10 @@ " value="" /> " value="" /> - + " /> + " /> + " /> + " /> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl index 5cb3f5f9ef..181ada7f97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl @@ -287,7 +287,11 @@ if (alreadyreserved > "0"){ - Document waiting at " /> + + Document waiting at /> + + Waiting to be pulled + Document will be transfered to " /> diff --git a/kohaversion.pl b/kohaversion.pl index 163c1f57f4..db28b5bbe6 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -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; diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 2a5fc050ff..43e64450fc 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -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 { diff --git a/reserve/request.pl b/reserve/request.pl index b9c08afa3b..803956c997 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -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 diff --git a/updater/updatedatabase b/updater/updatedatabase index ed9c5e5e6c..98ccdeef13 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -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) -- 2.39.5