Bug 10698: give C4::Circulation::DeleteTransfer() a return value
This patch adds return values to DeleteTransfer: Undef if no parameters are given 1 if a Transfer is deleted 0E0 if a wrong parameter is given It also fixes some unit 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, 20 wallclock secs ( 0.03 usr 0.00 sys + 0.39 cusr 0.02 csys = 0.44 CPU) Result: PASS Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Applied 10681 and 10692 before 10698 Run prove t/db_dependent/Circulation_transfers.t without errors No koha-qa errors on all 3 patches Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
24984fcb7b
commit
924c4f69e0
2 changed files with 5 additions and 4 deletions
|
@ -2828,13 +2828,14 @@ sub GetTransfersFromTo {
|
||||||
|
|
||||||
sub DeleteTransfer {
|
sub DeleteTransfer {
|
||||||
my ($itemnumber) = @_;
|
my ($itemnumber) = @_;
|
||||||
|
return unless $itemnumber;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth = $dbh->prepare(
|
my $sth = $dbh->prepare(
|
||||||
"DELETE FROM branchtransfers
|
"DELETE FROM branchtransfers
|
||||||
WHERE itemnumber=?
|
WHERE itemnumber=?
|
||||||
AND datearrived IS NULL "
|
AND datearrived IS NULL "
|
||||||
);
|
);
|
||||||
$sth->execute($itemnumber);
|
return $sth->execute($itemnumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 AnonymiseIssueHistory
|
=head2 AnonymiseIssueHistory
|
||||||
|
|
|
@ -9,7 +9,7 @@ use C4::Circulation;
|
||||||
use Koha::DateUtils;
|
use Koha::DateUtils;
|
||||||
use DateTime::Duration;
|
use DateTime::Duration;
|
||||||
|
|
||||||
use Test::More tests => 17;
|
use Test::More tests => 19;
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
use_ok('C4::Circulation');
|
use_ok('C4::Circulation');
|
||||||
|
@ -198,8 +198,8 @@ is(C4::Circulation::DeleteBranchTransferLimits('B'),'0E0',"With a wrong id Delet
|
||||||
is( C4::Circulation::DeleteTransfer($item_id1),
|
is( C4::Circulation::DeleteTransfer($item_id1),
|
||||||
1, "A the item1's transfer has been deleted" );
|
1, "A the item1's transfer has been deleted" );
|
||||||
#FIXME :The following tests should pass but don't because currently the routine DeleteTransfer returns nothing
|
#FIXME :The following tests should pass but don't because currently the routine DeleteTransfer returns nothing
|
||||||
#is(C4::Circulation::DeleteTransfer(),undef,"Without itemid DeleteTransfer returns undef");
|
is(C4::Circulation::DeleteTransfer(),undef,"Without itemid DeleteTransfer returns undef");
|
||||||
#is(C4::Circulation::DeleteTransfer(-1),0,"with a wrong itemid DeleteTranfer returns 0");
|
is(C4::Circulation::DeleteTransfer(-1),'0E0',"with a wrong itemid DeleteTranfer returns 0E0");
|
||||||
|
|
||||||
#End transaction
|
#End transaction
|
||||||
$dbh->rollback;
|
$dbh->rollback;
|
||||||
|
|
Loading…
Reference in a new issue