From 0838f76c872b3d837738b20c1bf6590fd8253a81 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 19 Apr 2021 16:18:58 +0100 Subject: [PATCH] Bug 24295: Finally remove GetTransfers from C4/Circulation This patch handles the final removal of GetTransfers from C4::Circulation. Test plan 1/ Check that there is no mention of the GetTransfers method codebase wide now 2/ Run the circulation and transfers tests and check nothing fails.. perhaps even run the full test suit in k-t-d 3/ Signoff --- C4/Circulation.pm | 30 -------------------------- t/db_dependent/Circulation/transfers.t | 17 +-------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2295d40d23..6f62cebbb0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -117,7 +117,6 @@ BEGIN { # subs to deal with transfers push @EXPORT, qw( &transferbook - &GetTransfers &GetTransfersFromTo &updateWrongTransfer &IsBranchTransferAllowed @@ -3426,35 +3425,6 @@ sub AddIssuingCharge { ); } -=head2 GetTransfers - - GetTransfers($itemnumber); - -=cut - -sub GetTransfers { - my ($itemnumber) = @_; - - my $dbh = C4::Context->dbh; - - my $query = ' - SELECT datesent, - frombranch, - tobranch, - branchtransfer_id, - daterequested, - reason - FROM branchtransfers - WHERE itemnumber = ? - AND datearrived IS NULL - AND datecancelled IS NULL - '; - my $sth = $dbh->prepare($query); - $sth->execute($itemnumber); - my @row = $sth->fetchrow_array(); - return @row; -} - =head2 GetTransfersFromTo @results = GetTransfersFromTo($frombranch,$tobranch); diff --git a/t/db_dependent/Circulation/transfers.t b/t/db_dependent/Circulation/transfers.t index 5e639ae90c..22453d907a 100755 --- a/t/db_dependent/Circulation/transfers.t +++ b/t/db_dependent/Circulation/transfers.t @@ -27,7 +27,7 @@ use Koha::Item::Transfers; use t::lib::TestBuilder; -use Test::More tests => 22; +use Test::More tests => 19; use Test::Deep; BEGIN { @@ -38,7 +38,6 @@ can_ok( qw( CreateBranchTransferLimit DeleteBranchTransferLimits - GetTransfers GetTransfersFromTo ) ); @@ -168,20 +167,6 @@ is(CreateBranchTransferLimit(undef,$branchcode_2),undef, #branch_transfer_limits.toBranch and branch_transfer_limits.fromBranch aren't foreign keys #is(CreateBranchTransferLimit(-1,-1,'CODE'),0,"With wrong CreateBranchTransferLimit returns 0 - No transfertlimit added"); -#Test GetTransfers -my @transfers = GetTransfers($item_id1); -cmp_deeply( - \@transfers, - [ re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), $branchcode_1, $branchcode_2, re('[0-9]*'), re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), 'Manual' ], - "Transfers of the item1" -); #NOTE: Only the first transfer is returned -@transfers = GetTransfers; -is_deeply( \@transfers, [], - "GetTransfers without params returns an empty array" ); -@transfers = GetTransfers(-1); -is_deeply( \@transfers, [], - "GetTransfers with a wrong item id returns an empty array" ); - #Test GetTransfersFromTo my @transferfrom1to2 = GetTransfersFromTo( $branchcode_1, $branchcode_2 ); -- 2.20.1