Bugzilla – Attachment 50900 Details for
Bug 12721
Prevent software error if incorrect fieldnames given in sypref StatisticsFields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12721: (followup) Replace mysqlism by DBIx::Class
PASSED-QA-Bug-12721-followup-Replace-mysqlism-by-D.patch (text/plain), 2.70 KB, created by
Katrin Fischer
on 2016-04-28 11:16:15 UTC
(
hide
)
Description:
[PASSED QA] Bug 12721: (followup) Replace mysqlism by DBIx::Class
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-04-28 11:16:15 UTC
Size:
2.70 KB
patch
obsolete
>From 4f77cf05c80a577bacd87061f299279a6fe055a9 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Wed, 27 Apr 2016 12:38:58 +0200 >Subject: [PATCH] [PASSED QA] Bug 12721: (followup) Replace mysqlism by > DBIx::Class > >This patch removes the mysqlism (see comment #18) > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Fixed QA tools complaints about missing lines before >and after =cut in POD. >--- > C4/Members/Statistics.pm | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > >diff --git a/C4/Members/Statistics.pm b/C4/Members/Statistics.pm >index c491819..b8b3a0f 100644 >--- a/C4/Members/Statistics.pm >+++ b/C4/Members/Statistics.pm >@@ -48,8 +48,8 @@ our $fields = get_fields(); > Get fields form syspref 'StatisticsFields' > Returns list of valid fields, defaults to 'location|itype|ccode' > if syspref is empty or does not contain valid fields >-=cut > >+=cut > > sub get_fields { > >@@ -59,14 +59,11 @@ sub get_fields { > if ( $syspref ) { > my @ret; > my @spfields = split ('\|', $syspref); >- my $dbh=C4::Context->dbh; >- my $sth = $dbh->prepare('SHOW COLUMNS FROM items'); >- $sth->execute; >- my $dbfields = $sth->fetchall_hashref('Field'); >- $sth->finish(); >+ my $schema = Koha::Database->new()->schema(); >+ my @columns = $schema->source('Item')->columns; > > foreach my $fn ( @spfields ) { >- push ( @ret, $fn ) if ( $dbfields->{ $fn } ); >+ push ( @ret, $fn ) if ( grep(/^$fn$/, @columns) ); > } > $ret = join( '|', @ret); > } >@@ -76,7 +73,9 @@ sub get_fields { > =head2 construct_query > Build a sql query from a subquery > Adds statistics fields to the select and the group by clause >+ > =cut >+ > sub construct_query { > my $count = shift; > my $subquery = shift; >@@ -95,7 +94,9 @@ sub construct_query { > > =head2 GetTotalIssuesTodayByBorrower > Return total issues for a borrower at this current day >+ > =cut >+ > sub GetTotalIssuesTodayByBorrower { > my ($borrowernumber) = @_; > my $dbh = C4::Context->dbh; >@@ -114,7 +115,9 @@ sub GetTotalIssuesTodayByBorrower { > > =head2 GetTotalIssuesReturnedTodayByBorrower > Return total issues returned by a borrower at this current day >+ > =cut >+ > sub GetTotalIssuesReturnedTodayByBorrower { > my ($borrowernumber) = @_; > my $dbh = C4::Context->dbh; >@@ -128,7 +131,9 @@ sub GetTotalIssuesReturnedTodayByBorrower { > > =head2 GetPrecedentStateByBorrower > Return the precedent state (before today) for a borrower of his checkins and checkouts >+ > =cut >+ > sub GetPrecedentStateByBorrower { > my ($borrowernumber) = @_; > my $dbh = C4::Context->dbh; >-- >1.9.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 12721
:
43573
|
43575
|
44316
|
50622
|
50668
|
50669
|
50792
|
50855
|
50897
|
50898
|
50899
| 50900