add security for the item barcode

This commit is contained in:
btoumi 2007-05-11 14:49:54 +00:00
parent a6db242492
commit c49fb53a45
1 changed files with 16 additions and 1 deletions

View File

@ -855,7 +855,8 @@ sub AddIssue {
my ( $borrower, $barcode, $date, $cancelreserve ) = @_;
my $dbh = C4::Context->dbh;
if ($borrower and $barcode){
my $barcodecheck=CheckValidBarcode($barcode);
if ($borrower and $barcode and $barcodecheck ne '0'){
# my ($borrower, $flags) = &GetMemberDetails($borrowernumber, 0);
# find which item we issue
my $item = GetItem('', $barcode);
@ -2002,6 +2003,20 @@ $sth->finish;
return $countspecial;
}
sub CheckValidBarcode{
my ($barcode) = @_;
my $dbh = C4::Context->dbh;
my $query=qq|SELECT count(*)
FROM items
WHERE barcode=?
|;
my $sth = $dbh->prepare($query);
$sth->execute($barcode);
my $exist=$sth->fetchrow ;
$sth->finish;
return $exist;
}
1;
__END__