[Koha-patches] [PATCH] Bug 3774: Accounts::chargelostitem uses title, but title not available to it
Bavousett, David
dBavousett at ptfs.com
Fri Nov 6 16:48:24 CET 2009
Thanks, Paul! I agree--I just got ahead of myself and did a
quick-and-filthy fix. Revised patch coming out in a few minutes.
--JDB
-----Original Message-----
From: paul POULAIN [mailto:paul.poulain at gmail.com] On Behalf Of Paul
Poulain
Sent: Friday, November 06, 2009 10:49 AM
To: Bavousett, David
Cc: patches at koha.org
Subject: Re: [Koha-patches] [PATCH] Bug 3774: Accounts::chargelostitem
uses title, but title not available to it
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.
> ---
> C4/Accounts.pm | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/C4/Accounts.pm b/C4/Accounts.pm
> index e137587..904b9de 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, items, biblio WHERE issues.itemnumber=items.itemnumber and
issues.itemnumber=? and items.biblionumber=biblio.biblionumber");
> $sth->execute($itemnumber);
> my $issues=$sth->fetchrow_hashref();
>
>
MUCH better SQL :
SELECT issues.*, items.*, biblio.title FROM issues JOIN items USING
itemnumber JOIN biblio USING(biblionumber) WHERE issues.itemnumber=?
--
Paul POULAIN
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
Tel : (33) 4 91 81 35 08
More information about the Koha-patches
mailing list