Bug 10699: add explicit return value for DeleteBranchTransferLimits()

This patch adds return values to DeleteBranchTransferLimits:
1 if a Transfer Limit is deleted
undef if no parameters is given
0E0 if a wrong parameter is given

More, it fixes and adds some tests in t/db_dependent/Circulation_transfers.t

To test :
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 19 wallclock secs ( 0.02 usr  0.01 sys +  0.39 cusr  0.02 csys =  0.44 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with patch for bug 10692 applied.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 88f15db30a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Kenza Zaki 2013-08-08 11:40:13 +02:00 committed by Tomas Cohen Arazi
parent 41f12d9eda
commit b7e3e0efa6
2 changed files with 5 additions and 4 deletions

View File

@ -3264,9 +3264,10 @@ Deletes all the branch transfer limits for one branch
sub DeleteBranchTransferLimits {
my $branch = shift;
return unless $branch;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("DELETE FROM branch_transfer_limits WHERE fromBranch = ?");
$sth->execute($branch);
return $sth->execute($branch);
}
sub ReturnLostItem{

View File

@ -9,7 +9,7 @@ use C4::Circulation;
use Koha::DateUtils;
use DateTime::Duration;
use Test::More tests => 15;
use Test::More tests => 17;
BEGIN {
use_ok('C4::Circulation');
@ -191,8 +191,8 @@ is(
1,
"A Branch TransferLimit has been deleted"
);
#FIXME :The following test should pass but doesn't because currently the routine DeleteBranchTransferLimit returns nothin
#is(C4::Circulation::DeleteBranchTransferLimits(),undef,"Without parameters DeleteBranchTransferLimit returns undef");
is(C4::Circulation::DeleteBranchTransferLimits(),undef,"Without parameters DeleteBranchTransferLimit returns undef");
is(C4::Circulation::DeleteBranchTransferLimits('B'),'0E0',"With a wrong id DeleteBranchTransferLimit returns 0E0");
#Test DeleteTransfer
is( C4::Circulation::DeleteTransfer($item_id1),