From 9d4430b6a762c4d1eb17e75ab980bae36e3b1b3e Mon Sep 17 00:00:00 2001 From: Kenza Zaki Date: Wed, 28 Aug 2013 10:46:07 +0200 Subject: [PATCH] Bug 10795 - Improvements for GetOpenIssue in C4::Circulation This patch adds some improvements for the routine GetOpenIssue. Now, it verifies if the parameter is given (if not it returns undef) and it returns $sth->fetchrow_hashref() instead of a $issue. To test: prove t/db_dependent/Circulation_issue.t t/db_dependent/Circulation_issue.t .. ok All tests successful. Files=1, Tests=16, 2 wallclock secs ( 0.06 usr 0.01 sys + 1.09 cusr 0.07 csys = 1.23 CPU) Result: PASS --- C4/Circulation.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2c568b4..513d0d4 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2311,12 +2311,12 @@ Returns a hashref sub GetOpenIssue { my ( $itemnumber ) = @_; - + return unless $itemnumber; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare( "SELECT * FROM issues WHERE itemnumber = ? AND returndate IS NULL" ); $sth->execute( $itemnumber ); - my $issue = $sth->fetchrow_hashref(); - return $issue; + return $sth->fetchrow_hashref(); + } =head2 GetItemIssues -- 1.7.9.5