[Koha-cvs] CVS: koha/C4 Reserves2.pm,1.15,1.16

Finlay Thompson finlayt at users.sourceforge.net
Wed Aug 21 03:31:20 CEST 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv3804/C4

Modified Files:
	Reserves2.pm 
Log Message:

Fixed a bug in the reordering priorities in FillReserve and andother different bug in CheckReserves.


Index: Reserves2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Reserves2.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** Reserves2.pm	19 Aug 2002 06:29:36 -0000	1.15
--- Reserves2.pm	21 Aug 2002 01:31:16 -0000	1.16
***************
*** 99,103 ****
  sub CheckReserves {
      my ($item) = @_;
!     warn "In CheckReserves";
      my $dbh=C4Connect;
      my $qitem=$dbh->quote($item);
--- 99,103 ----
  sub CheckReserves {
      my ($item) = @_;
!     warn "In CheckReserves: itemnumber = $item";
      my $dbh=C4Connect;
      my $qitem=$dbh->quote($item);
***************
*** 113,117 ****
      $dbh->disconnect;
  # if item is not for loan it cannot be reserved either.....
- warn "Not for loan: $notforloan";
      return (0, 0) if ($notforloan);
  # get the reserves...
--- 113,116 ----
***************
*** 130,133 ****
--- 129,134 ----
  	    }
  	}
+     }
+     if ($highest) {
  	$highest->{'itemnumber'} = $item;
  	return ("Reserved", $highest);
***************
*** 159,163 ****
  	my $q_biblio = $dbh->quote($biblio);
  	$borr = $dbh->quote($borr);
! # fix up the priorities on the other records....
  	my $query = "SELECT priority FROM reserves 
                                      WHERE biblionumber   = $q_biblio 
--- 160,164 ----
  	my $q_biblio = $dbh->quote($biblio);
  	$borr = $dbh->quote($borr);
! # get the prioritiy on this record....
  	my $query = "SELECT priority FROM reserves 
                                      WHERE biblionumber   = $q_biblio 
***************
*** 190,197 ****
      my ($res) = @_;
      my $dbh=C4Connect;
! # removing a waiting reserve record....
      my $biblio = $res->{'biblionumber'}; my $qbiblio = $dbh->quote($biblio);
      my $borr = $res->{'borrowernumber'}; $borr = $dbh->quote($borr);
      my $resdate = $res->{'reservedate'}; $resdate = $dbh->quote($resdate);
  # update the database...
      my $query = "UPDATE reserves SET found            = 'F', 
--- 191,207 ----
      my ($res) = @_;
      my $dbh=C4Connect;
! # fillinf a reserve record....
      my $biblio = $res->{'biblionumber'}; my $qbiblio = $dbh->quote($biblio);
      my $borr = $res->{'borrowernumber'}; $borr = $dbh->quote($borr);
      my $resdate = $res->{'reservedate'}; $resdate = $dbh->quote($resdate);
+ # get the prioritiy on this record....
+     my $query = "SELECT priority FROM reserves 
+                                 WHERE biblionumber   = $qbiblio 
+                                   AND borrowernumber = $borr
+                                   AND reservedate    = $resdate)";
+     my $sth=$dbh->prepare($query);
+     $sth->execute;
+     my ($priority) = $sth->fetchrow_array;
+     $sth->finish;
  # update the database...
      my $query = "UPDATE reserves SET found            = 'F', 
***************
*** 203,206 ****
--- 213,220 ----
      $sth->execute;
      $sth->finish;
+ # now fix the priority on the others (if the priority wasnt already sorted!)....
+     unless ($priority == 0) {
+ 	fixpriority($priority, $biblio);
+     }
      $dbh->disconnect;
  }





More information about the Koha-cvs mailing list