From 2a39f2baaf1f15d35762266a72705a28b3d32319 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 636487a..64aa24f 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; @@ -53,6 +52,7 @@ use Koha::Libraries; use Koha::Holds; use Koha::RefundLostItemFeeRule; use Koha::RefundLostItemFeeRules; +use Koha::RotatingCollection::Trackings; use Carp; use List::MoreUtils qw( uniq ); use Scalar::Util qw( looks_like_number ); @@ -1962,7 +1962,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