Bug 16741 - Remove dead code "sub itemissues" from C4/Circulation.pm

To verify:
- git grep itemissues
Result: Appears in C4/Circulation.pm only

To test:
- apply patch
- git grep itemissues
Expected result: No occurences
- prove t/db_dependent/Circulation.t
Expected result: Pass OK

Signed-off-by: Claire Gravely <c.gravely@arts.ac.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Marc Véron 2016-08-10 10:12:55 +02:00 committed by Kyle M Hall
parent f8230d5d0a
commit 97552074f0

View file

@ -551,114 +551,6 @@ sub TooMany {
return;
}
=head2 itemissues
@issues = &itemissues($biblioitemnumber, $biblio);
Looks up information about who has borrowed the bookZ<>(s) with the
given biblioitemnumber.
C<$biblio> is ignored.
C<&itemissues> returns an array of references-to-hash. The keys
include the fields from the C<items> table in the Koha database.
Additional keys include:
=over 4
=item C<date_due>
If the item is currently on loan, this gives the due date.
If the item is not on loan, then this is either "Available" or
"Cancelled", if the item has been withdrawn.
=item C<card>
If the item is currently on loan, this gives the card number of the
patron who currently has the item.
=item C<timestamp0>, C<timestamp1>, C<timestamp2>
These give the timestamp for the last three times the item was
borrowed.
=item C<card0>, C<card1>, C<card2>
The card number of the last three patrons who borrowed this item.
=item C<borrower0>, C<borrower1>, C<borrower2>
The borrower number of the last three patrons who borrowed this item.
=back
=cut
#'
sub itemissues {
my ( $bibitem, $biblio ) = @_;
my $dbh = C4::Context->dbh;
my $sth =
$dbh->prepare("Select * from items where items.biblioitemnumber = ?")
|| die $dbh->errstr;
my $i = 0;
my @results;
$sth->execute($bibitem) || die $sth->errstr;
while ( my $data = $sth->fetchrow_hashref ) {
# Find out who currently has this item.
# FIXME - Wouldn't it be better to do this as a left join of
# some sort? Currently, this code assumes that if
# fetchrow_hashref() fails, then the book is on the shelf.
# fetchrow_hashref() can fail for any number of reasons (e.g.,
# database server crash), not just because no items match the
# search criteria.
my $sth2 = $dbh->prepare(
"SELECT * FROM issues
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber
WHERE itemnumber = ?
"
);
$sth2->execute( $data->{'itemnumber'} );
if ( my $data2 = $sth2->fetchrow_hashref ) {
$data->{'date_due'} = $data2->{'date_due'};
$data->{'card'} = $data2->{'cardnumber'};
$data->{'borrower'} = $data2->{'borrowernumber'};
}
else {
$data->{'date_due'} = ($data->{'withdrawn'} eq '1') ? 'Cancelled' : 'Available';
}
# Find the last 3 people who borrowed this item.
$sth2 = $dbh->prepare(
"SELECT * FROM old_issues
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber
WHERE itemnumber = ?
ORDER BY returndate DESC,timestamp DESC"
);
$sth2->execute( $data->{'itemnumber'} );
for ( my $i2 = 0 ; $i2 < 2 ; $i2++ )
{ # FIXME : error if there is less than 3 pple borrowing this item
if ( my $data2 = $sth2->fetchrow_hashref ) {
$data->{"timestamp$i2"} = $data2->{'timestamp'};
$data->{"card$i2"} = $data2->{'cardnumber'};
$data->{"borrower$i2"} = $data2->{'borrowernumber'};
} # if
} # for
$results[$i] = $data;
$i++;
}
return (@results);
}
=head2 CanBookBeIssued
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower,