From 97552074f028eefe81d27a4cba681bd5f0f1cd95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Wed, 10 Aug 2016 10:12:55 +0200 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- C4/Circulation.pm | 108 ---------------------------------------------- 1 file changed, 108 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9b95bbf24a..1304d119b3 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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 table in the Koha database. -Additional keys include: - -=over 4 - -=item C - -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 - -If the item is currently on loan, this gives the card number of the -patron who currently has the item. - -=item C, C, C - -These give the timestamp for the last three times the item was -borrowed. - -=item C, C, C - -The card number of the last three patrons who borrowed this item. - -=item C, C, C - -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, -- 2.39.5