From efa561be6ce80386a244951831520ed57b893ef2 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 17 May 2017 12:40:46 +0000 Subject: [PATCH] Bug 18606: Get rid of isItemInAnyCollection --- C4/Circulation.pm | 4 ++-- C4/RotatingCollections.pm | 28 ---------------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ae55d7f..b8987a9 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -35,7 +35,6 @@ use C4::Message; use C4::Debug; use C4::Log; # logaction use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units); -use C4::RotatingCollections; use Algorithm::CheckDigits; use Data::Dumper; @@ -56,6 +55,7 @@ use Koha::RefundLostItemFeeRule; use Koha::RefundLostItemFeeRules; use Koha::Account::Lines; use Koha::Account::Offsets; +use Koha::RotatingCollection::Trackings; use Carp; use List::MoreUtils qw( uniq ); use Scalar::Util qw( looks_like_number ); @@ -1938,7 +1938,7 @@ sub AddReturn { my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} ); # if we have a transfer to do, we update the line of transfers with the datearrived - my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} ); + my $is_in_rotating_collection = Koha::RotatingCollection::Trackings->search( { itemnumber => $item->{'itemnumber'} } )->count; if ($datesent) { if ( $tobranch eq $branch ) { my $sth = C4::Context->dbh->prepare( diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm index 7a97cdb..0848c76 100644 --- a/C4/RotatingCollections.pm +++ b/C4/RotatingCollections.pm @@ -51,34 +51,6 @@ BEGIN { ); } -=head2 isItemInAnyCollection - -$inCollection = isItemInAnyCollection( $itemnumber ); - -=cut - -sub isItemInAnyCollection { - my ($itemnumber) = @_; - - my $dbh = C4::Context->dbh; - - my $sth = $dbh->prepare( - "SELECT itemnumber FROM collections_tracking WHERE itemnumber = ?"); - $sth->execute($itemnumber) or return (0); - - my $row = $sth->fetchrow_hashref; - - $itemnumber = $row->{itemnumber}; - if ($itemnumber) { - return 1; - } - else { - return 0; - } -} - -1; - __END__ =head1 AUTHOR -- 2.1.4