[Koha-patches] [PATCH] Bug 3774: Accounts::chargelostitem uses title, but title not available to it (revised patch)
Michael Hafen
mdhafen at tech.washk12.org
Fri Nov 6 19:08:11 CET 2009
SQL still isn't quite right. The join ... using syntax requires
parenthesis around the using column. The SQL should be...
SELECT issues.*, items.*, biblio.title FROM issues JOIN items USING
(itemnumber) JOIN biblio USING (biblionumber) WHERE issues.itemnumber=?
On Fri, 2009-11-06 at 11:00 -0500, J. David Bavousett wrote:
> This patch fixes the SELECT so that title is available when it is used
> later on, which will prevent 'Use of uninitialized value' errors.
>
> It also uses JOIN properly, which the original query and my initial patch for this
> did not.
> ---
> C4/Accounts.pm | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/C4/Accounts.pm b/C4/Accounts.pm
> index e137587..c82440c 100644
> --- a/C4/Accounts.pm
> +++ b/C4/Accounts.pm
> @@ -283,7 +283,7 @@ sub chargelostitem{
>
> my $dbh = C4::Context->dbh();
> my ($itemnumber) = @_;
> - my $sth=$dbh->prepare("SELECT * FROM issues, items WHERE issues.itemnumber=items.itemnumber and issues.itemnumber=?");
> + my $sth=$dbh->prepare("SELECT issues.*, items.*, biblio.title FROM issues JOIN items USING itemnumber JOIN biblio USING(biblionumber) WHERE issues.itemnumber=?");
> $sth->execute($itemnumber);
> my $issues=$sth->fetchrow_hashref();
>
--
Michael Hafen
Systems Analyst and Programmer
Washington County School District
Utah, USA
for Koha checkout
http://development.washk12.org/gitweb/
or
git://development.washk12.org/koha
More information about the Koha-patches
mailing list