From 9316c123aa1c8b6bc1c9c296e8278a445b7f9d32 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Rebased-by: Joonas Kylmälä Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- C4/Circulation.pm | 30 -------------------------- t/db_dependent/Circulation/transfers.t | 21 +++--------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 254f893a12..60d3d95494 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -107,7 +107,6 @@ BEGIN { transferbook TooMany - GetTransfers GetTransfersFromTo updateWrongTransfer CalcDateDue @@ -3539,35 +3538,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 e03b54fc02..ca6c37daa4 100755 --- a/t/db_dependent/Circulation/transfers.t +++ b/t/db_dependent/Circulation/transfers.t @@ -17,7 +17,7 @@ use Modern::Perl; use C4::Context; -use C4::Circulation qw( CreateBranchTransferLimit DeleteBranchTransferLimits GetTransfers GetTransfersFromTo TransferSlip ); +use C4::Circulation qw( CreateBranchTransferLimit DeleteBranchTransferLimits GetTransfersFromTo TransferSlip ); use C4::Biblio qw( AddBiblio ); use C4::Items qw( ModItemTransfer ); use Koha::Database; @@ -27,18 +27,17 @@ use Koha::Item::Transfers; use t::lib::TestBuilder; -use Test::More tests => 22; +use Test::More tests => 19; use Test::Deep; BEGIN { - use_ok('C4::Circulation', qw( CreateBranchTransferLimit DeleteBranchTransferLimits GetTransfers GetTransfersFromTo TransferSlip )); + use_ok('C4::Circulation', qw( CreateBranchTransferLimit DeleteBranchTransferLimits GetTransfersFromTo TransferSlip )); } can_ok( 'C4::Circulation', 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.39.5