[Koha-cvs] CVS: koha insertdata.pl,1.21,1.22 memberentry.pl,1.35,1.36
Chris Cormack
rangi at users.sourceforge.net
Thu Oct 23 22:26:58 CEST 2003
Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv7479
Modified Files:
insertdata.pl memberentry.pl
Log Message:
Fix for bug 631, race conditions on borrowernumber when entering a new
borrower.
Depends on borrowernumber having auto_increment set in the database
Index: insertdata.pl
===================================================================
RCS file: /cvsroot/koha/koha/insertdata.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** insertdata.pl 19 May 2003 15:22:12 -0000 1.21
--- insertdata.pl 23 Oct 2003 20:26:56 -0000 1.22
***************
*** 46,52 ****
}
my $dbh = C4::Context->dbh;
! my $query="Select * from borrowers where borrowernumber=$data{'borrowernumber'}";
my $sth=$dbh->prepare($query);
! $sth->execute;
if (my $data2=$sth->fetchrow_hashref){
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
--- 46,52 ----
}
my $dbh = C4::Context->dbh;
! my $query="Select * from borrowers where borrowernumber=?";
my $sth=$dbh->prepare($query);
! $sth->execute($data{'borrowernumber'});
if (my $data2=$sth->fetchrow_hashref){
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
***************
*** 71,78 ****
$data{'joining'}=format_date_in_iso($data{'joining'});
$data{'expiry'}=format_date_in_iso($data{'expiry'});
$query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
firstname,altnotes,dateofbirth,contactname,emailaddress,textmessaging,dateenrolled,streetcity,
altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
! initials,ethnicity,borrowernumber,physstreet,branchcode,zipcode,homezipcode) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
'$data{'sex'}','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
'$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
--- 71,79 ----
$data{'joining'}=format_date_in_iso($data{'joining'});
$data{'expiry'}=format_date_in_iso($data{'expiry'});
+ $data{'borrowernumber'}=NewBorrowerNumber();
$query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
firstname,altnotes,dateofbirth,contactname,emailaddress,textmessaging,dateenrolled,streetcity,
altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
! initials,ethnicity,physstreet,branchcode,zipcode,homezipcode) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
'$data{'sex'}','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
'$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
***************
*** 80,84 ****
'$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
'$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
! '$data{'ethnicity'}','$data{'borrowernumber'}','$data{'streetaddress'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}')";
}
# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
--- 81,85 ----
'$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
'$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
! '$data{'ethnicity'}','$data{'streetaddress'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}')";
}
# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
***************
*** 104,108 ****
}
! #print $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
--- 105,109 ----
}
! warn $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
Index: memberentry.pl
===================================================================
RCS file: /cvsroot/koha/koha/memberentry.pl,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** memberentry.pl 9 Jul 2003 20:27:55 -0000 1.35
--- memberentry.pl 23 Oct 2003 20:26:56 -0000 1.36
***************
*** 51,57 ****
my $member=$input->param('bornum');
! if ($member eq ''){
! $member=NewBorrowerNumber();
! }
my $type=$input->param('type') || '';
my $modify=$input->param('modify');
--- 51,57 ----
my $member=$input->param('bornum');
! # if ($member eq ''){
! # $member=NewBorrowerNumber();
! # }
my $type=$input->param('type') || '';
my $modify=$input->param('modify');
More information about the Koha-cvs
mailing list