[Koha-cvs] CVS: koha/C4 Members.pm,1.9,1.10 Search.pm,1.106,1.107

Paul POULAIN tipaul at users.sourceforge.net
Mon Sep 5 21:27:23 CEST 2005


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6397/C4

Modified Files:
	Members.pm Search.pm 
Log Message:
moving NewBorrowerNumber sub to Members package

Index: Members.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Members.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Members.pm	5 Sep 2005 19:26:08 -0000	1.9
--- Members.pm	5 Sep 2005 19:27:21 -0000	1.10
***************
*** 50,54 ****
  
  @EXPORT = qw(
! 	&getmember &fixup_cardnumber &findguarantees &findguarantor &modmember &newmember &changepassword
      );
  
--- 50,54 ----
  
  @EXPORT = qw(
! 	&getmember &fixup_cardnumber &findguarantees &findguarantor &NewBorrowerNumber &modmember &newmember &changepassword
      );
  
***************
*** 307,336 ****
  }
  
! # =item NewBorrowerNumber
! # 
! #   $num = &NewBorrowerNumber();
! # 
! # Allocates a new, unused borrower number, and returns it.
! # 
! # =cut
! # #'
! # # FIXME - This is identical to C4::Search::NewBorrowerNumber.
! # # Pick one (preferably this one) and stick with it.
! # 
! # # FIXME - Race condition: this function just says what the next unused
! # # number is, but doesn't allocate it. Hence, two clients adding
! # # patrons at the same time could get the same new borrower number and
! # # clobber each other.
! # # A better approach might be to set borrowernumber autoincrement and 
! # 
! # sub NewBorrowerNumber {
! #   my $dbh = C4::Context->dbh;
! #   my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
! #   $sth->execute;
! #   my $data=$sth->fetchrow_hashref;
! #   $sth->finish;
! #   $data->{'max(borrowernumber)'}++;
! #   return($data->{'max(borrowernumber)'});
! # }
  
  1;
--- 307,330 ----
  }
  
! =item NewBorrowerNumber
! 
!   $num = &NewBorrowerNumber();
! 
! Allocates a new, unused borrower number, and returns it.
! 
! =cut
! #'
! # FIXME - This is identical to C4::Circulation::Borrower::NewBorrowerNumber.
! # Pick one and stick with it. Preferably use the other one. This function
! # doesn't belong in C4::Search.
! sub NewBorrowerNumber {
!   my $dbh = C4::Context->dbh;
!   my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
!   $sth->execute;
!   my $data=$sth->fetchrow_hashref;
!   $sth->finish;
!   $data->{'max(borrowernumber)'}++;
!   return($data->{'max(borrowernumber)'});
! }
  
  1;

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -r1.106 -r1.107
*** Search.pm	5 Sep 2005 19:26:08 -0000	1.106
--- Search.pm	5 Sep 2005 19:27:21 -0000	1.107
***************
*** 67,92 ****
  # make all your functions, whether exported or not;
  
- 
- =item NewBorrowerNumber
- 
-   $num = &NewBorrowerNumber();
- 
- Allocates a new, unused borrower number, and returns it.
- 
- =cut
- #'
- # FIXME - This is identical to C4::Circulation::Borrower::NewBorrowerNumber.
- # Pick one and stick with it. Preferably use the other one. This function
- # doesn't belong in C4::Search.
- sub NewBorrowerNumber {
-   my $dbh = C4::Context->dbh;
-   my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
-   $sth->execute;
-   my $data=$sth->fetchrow_hashref;
-   $sth->finish;
-   $data->{'max(borrowernumber)'}++;
-   return($data->{'max(borrowernumber)'});
- }
- 
  =item catalogsearch
  
--- 67,70 ----





More information about the Koha-cvs mailing list