Bugzilla – Attachment 4935 Details for
Bug 6280
Invalid SQL being passed in circulation checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch (passed QA)
0001-Bug-6280-Don-t-generate-invalid-SQL-in-GetPendingIss.patch (text/plain), 3.97 KB, created by
Paul Poulain
on 2011-08-10 13:00:53 UTC
(
hide
)
Description:
proposed patch (passed QA)
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-08-10 13:00:53 UTC
Size:
3.97 KB
patch
obsolete
>From bd01d71d61562fea0d9bbffc22173d5c14c65117 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Thu, 28 Apr 2011 14:39:45 +0100 >Subject: [PATCH] Bug 6280 : Don't generate invalid SQL in GetPendingIssues > >Change to parameter list in GetPendingIssues made it >callable by an empty list resulting in invalid sql being >sent to server. As this was occuring on most issues error log >was filling up. Put safeguard in the routine >Also don't bother calling when you have no need > >Some of the processing was needlessly obscure > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > C4/Members.pm | 19 +++++++++++++------ > circ/circulation.pl | 8 ++++++-- > members/moremember.pl | 9 ++++++--- > 3 files changed, 25 insertions(+), 11 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index ce694e5..dcc168b 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1032,13 +1032,19 @@ The keys include C<biblioitems> fields except marc and marcxml. > > #' > sub GetPendingIssues { >- my (@borrowernumbers) = @_; >+ my @borrowernumbers = @_; >+ >+ unless (@borrowernumbers ) { # return a ref_to_array >+ return \@borrowernumbers; # to not cause surprise to caller >+ } > > # Borrowers part of the query > my $bquery = ''; > for (my $i = 0; $i < @borrowernumbers; $i++) { >- $bquery .= " borrowernumber = ?"; >- $bquery .= " OR" if ($i < (scalar(@borrowernumbers) - 1)); >+ $bquery .= ' borrowernumber = ?'; >+ if ($i < $#borrowernumbers ) { >+ $bquery .= ' OR'; >+ } > } > > # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance >@@ -1079,9 +1085,10 @@ sub GetPendingIssues { > $sth->execute(@borrowernumbers); > my $data = $sth->fetchall_arrayref({}); > my $today = C4::Dates->new->output('iso'); >- foreach (@$data) { >- $_->{date_due} or next; >- ($_->{date_due} lt $today) and $_->{overdue} = 1; >+ foreach (@{$data}) { >+ if ($_->{date_due} and $_->{date_due} lt $today) { >+ $_->{overdue} = 1; >+ } > } > return $data; > } >diff --git a/circ/circulation.pl b/circ/circulation.pl >index c34db54..da4878f 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -463,8 +463,11 @@ if ($borrower) { > #push @borrowernumbers, $borrower->{'borrowernumber'}; > > # get each issue of the borrower & separate them in todayissues & previous issues >- my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'}); >- my ($relissueslist) = GetPendingIssues(@relborrowernumbers); >+ my $issueslist = GetPendingIssues($borrower->{'borrowernumber'}); >+ my $relissueslist = []; >+ if ( @relborrowernumbers ) { >+ $relissueslist = GetPendingIssues(@relborrowernumbers); >+ } > > build_issue_data($issueslist, 0); > build_issue_data($relissueslist, 1); >@@ -477,6 +480,7 @@ if ($borrower) { > else { > @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues; > } >+ > if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){ > @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues; > } >diff --git a/members/moremember.pl b/members/moremember.pl >index 9292fd0..bfaa402 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -236,9 +236,12 @@ if ( C4::Context->preference('OPACPrivacy') ) { > # > my @borrowernumbers = GetMemberRelatives($borrowernumber); > my $issue = GetPendingIssues($borrowernumber); >-my $relissue = GetPendingIssues(@borrowernumbers); >-my $issuecount = scalar(@$issue); >-my $relissuecount = scalar(@$relissue); >+my $relissue = []; >+if ( @borrowernumbers ) { >+ $relissue = GetPendingIssues(@borrowernumbers); >+} >+my $issuecount = @{$issue}; >+my $relissuecount = @{$relissue}; > my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); > my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format > my @issuedata; >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6280
:
4014
|
4438
| 4935