Bugzilla – Attachment 56110 Details for
Bug 13392
New statistics wizard for suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13392: Remove use of C4::Branch and C4::Category
Bug-13392-Remove-use-of-C4Branch-and-C4Category.patch (text/plain), 2.67 KB, created by
Julian Maurice
on 2016-10-10 14:09:56 UTC
(
hide
)
Description:
Bug 13392: Remove use of C4::Branch and C4::Category
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-10-10 14:09:56 UTC
Size:
2.67 KB
patch
obsolete
>From fd0dd8d8c13e8f86fcecc2822275003cab88bf97 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 10 Oct 2016 14:36:59 +0200 >Subject: [PATCH] Bug 13392: Remove use of C4::Branch and C4::Category > >+ fix a 'ambiguous column name' error when using borrowers table >--- > reports/suggestions_stats.pl | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > >diff --git a/reports/suggestions_stats.pl b/reports/suggestions_stats.pl >index 10a5305..75e671d 100755 >--- a/reports/suggestions_stats.pl >+++ b/reports/suggestions_stats.pl >@@ -24,14 +24,13 @@ use C4::Auth; > use C4::Context; > use C4::Output; > >-use C4::Branch; > use C4::Budgets; >-use C4::Category; > use Koha::DateUtils qw/output_pref dt_from_string/; > use C4::Koha; > use C4::Reports; > >-use Koha::I18N; >+use Koha::Libraries; >+use Koha::Patron::Categories; > > my $cgi = new CGI; > my $template_name = 'reports/suggestions_stats.tt'; >@@ -92,7 +91,7 @@ foreach my $budget (@$budgets) { > $display_values->{budgetid}->{$budget_id} = $budget->{budget_name}; > } > >-my @categories = C4::Category->all; >+my @categories = Koha::Patron::Categories->search( {}, {order_by => ['description']} ); > foreach my $category (@categories) { > my $code = $category->categorycode; > $display_values->{categorycode}->{$code} = $category->description; >@@ -116,7 +115,7 @@ foreach my $av (@$suggest) { > $display_values->{reason}->{$value} = $av->{lib}; > } > >-my $branches = C4::Branch::GetBranchesLoop('', 0); >+my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; > foreach my $branch (@$branches) { > my $branchcode = $branch->{branchcode}; > $display_values->{branchcode}->{$branchcode} = $branch->{branchname}; >@@ -137,6 +136,11 @@ output_html_with_http_headers $cgi, $cookie, $template->output; > sub get_select_expr { > my ($field, $groupby) = @_; > >+ # To avoid 'ambiguous column name' error when using borrowers table >+ if ($field eq 'branchcode') { >+ $field = 'suggestions.branchcode'; >+ } >+ > my $select_expr = $field; > if ($groupby->{$field}) { > if ($groupby->{$field} eq 'year') { >@@ -197,7 +201,14 @@ sub calculate { > > foreach my $filter (qw(status categorycode sort1 sort2 branchcode reason itemtype)) { > if ($filters->{$filter}) { >- push @conditions, "$filter = ?"; >+ my $column = $filter; >+ >+ # To avoid 'ambiguous column name' error when using borrowers table >+ if ($column eq 'branchcode') { >+ $column = 'suggestions.branchcode'; >+ } >+ >+ push @conditions, "$column = ?"; > push @bind_values, $filters->{$filter}; > } > } >-- >2.1.4
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 13392
:
34124
|
34125
|
34135
|
34136
|
34328
|
34329
|
35835
|
35836
|
35837
|
36188
|
36189
|
36190
|
36343
|
36344
|
36345
|
40305
|
40306
|
40307
|
40308
|
48291
|
48292
|
48293
|
48294
|
49088
|
51995
|
51996
|
51997
|
51998
|
51999
|
56110
|
56889
|
60956
|
60957
|
60958
|
60959
|
60960
|
60961
|
60962
|
64459
|
64460
|
64461
|
64462
|
64463
|
64464
|
64465
|
78622
|
78623
|
78624
|
78625
|
78626
|
78627
|
78628
|
78629