Bug 10630: give DelBookseller() a return value

This patch makes DelBookseller returns the number of suppliers it has
deleted or undef if an error has occurred.

It also fixes a test which doesn't pass before in t/db_dependent/Bookseller.t

To test:
prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t .. 1/54
All tests successful.
Files=1, Tests=54,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.48 cusr  0.02 csys =  0.52 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Logical change and makes another test pass :)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kenza Zaki 2013-07-25 09:37:34 +02:00 committed by Galen Charlton
parent ec09fe092e
commit 995a270dd1
2 changed files with 3 additions and 5 deletions

View File

@ -269,8 +269,7 @@ sub DelBookseller {
my $id = shift;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare('DELETE FROM aqbooksellers WHERE id=?');
$sth->execute($id);
return;
return $sth->execute($id);
}
1;

View File

@ -2,7 +2,7 @@
use Modern::Perl;
use Test::More tests => 53;
use Test::More tests => 54;
use C4::Context;
use Koha::DateUtils;
use DateTime::Duration;
@ -104,8 +104,7 @@ is( scalar( C4::Bookseller::GetBookSeller('') ),
#Test DelBookseller
my $del = C4::Bookseller::DelBookseller($id_supplier1);
#FIXME: DelBookSeller always returns undef (if it works or not)
#is( $del, 1, "DelBookseller returns 1 - 1 supplier has been deleted " );
is( $del, 1, "DelBookseller returns 1 - 1 supplier has been deleted " );
is( C4::Bookseller::GetBookSellerFromId($id_supplier1),
undef, "Supplier1 has been deleted - id_supplier1 doesnt exist anymore" );