Lines 1175-1219
sub GetBorNotifyAcctRecord {
Link Here
|
1175 |
return ( $total, \@acctlines, $numlines ); |
1175 |
return ( $total, \@acctlines, $numlines ); |
1176 |
} |
1176 |
} |
1177 |
|
1177 |
|
1178 |
=head2 checkuniquemember (OUEST-PROVENCE) |
|
|
1179 |
|
1180 |
($result,$categorycode) = &checkuniquemember($collectivity,$surname,$firstname,$dateofbirth); |
1181 |
|
1182 |
Checks that a member exists or not in the database. |
1183 |
|
1184 |
C<&result> is nonzero (=exist) or 0 (=does not exist) |
1185 |
C<&categorycode> is from categorycode table |
1186 |
C<&collectivity> is 1 (= we add a collectivity) or 0 (= we add a physical member) |
1187 |
C<&surname> is the surname |
1188 |
C<&firstname> is the firstname (only if collectivity=0) |
1189 |
C<&dateofbirth> is the date of birth in ISO format (only if collectivity=0) |
1190 |
|
1191 |
=cut |
1192 |
|
1193 |
# FIXME: This function is not legitimate. Multiple patrons might have the same first/last name and birthdate. |
1194 |
# This is especially true since first name is not even a required field. |
1195 |
|
1196 |
sub checkuniquemember { |
1197 |
my ( $collectivity, $surname, $firstname, $dateofbirth ) = @_; |
1198 |
my $dbh = C4::Context->dbh; |
1199 |
my $request = ($collectivity) ? |
1200 |
"SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? " : |
1201 |
($dateofbirth) ? |
1202 |
"SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=? and dateofbirth=?" : |
1203 |
"SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?"; |
1204 |
my $sth = $dbh->prepare($request); |
1205 |
if ($collectivity) { |
1206 |
$sth->execute( uc($surname) ); |
1207 |
} elsif($dateofbirth){ |
1208 |
$sth->execute( uc($surname), ucfirst($firstname), $dateofbirth ); |
1209 |
}else{ |
1210 |
$sth->execute( uc($surname), ucfirst($firstname)); |
1211 |
} |
1212 |
my @data = $sth->fetchrow; |
1213 |
( $data[0] ) and return $data[0], $data[1]; |
1214 |
return 0; |
1215 |
} |
1216 |
|
1217 |
sub checkcardnumber { |
1178 |
sub checkcardnumber { |
1218 |
my ( $cardnumber, $borrowernumber ) = @_; |
1179 |
my ( $cardnumber, $borrowernumber ) = @_; |
1219 |
|
1180 |
|