|
Lines 24-37
use C4::Auth;
Link Here
|
| 24 |
use C4::Context; |
24 |
use C4::Context; |
| 25 |
use C4::Output; |
25 |
use C4::Output; |
| 26 |
|
26 |
|
| 27 |
use C4::Branch; |
|
|
| 28 |
use C4::Budgets; |
27 |
use C4::Budgets; |
| 29 |
use C4::Category; |
|
|
| 30 |
use Koha::DateUtils qw/output_pref dt_from_string/; |
28 |
use Koha::DateUtils qw/output_pref dt_from_string/; |
| 31 |
use C4::Koha; |
29 |
use C4::Koha; |
| 32 |
use C4::Reports; |
30 |
use C4::Reports; |
| 33 |
|
31 |
|
| 34 |
use Koha::I18N; |
32 |
use Koha::Libraries; |
|
|
33 |
use Koha::Patron::Categories; |
| 35 |
|
34 |
|
| 36 |
my $cgi = new CGI; |
35 |
my $cgi = new CGI; |
| 37 |
my $template_name = 'reports/suggestions_stats.tt'; |
36 |
my $template_name = 'reports/suggestions_stats.tt'; |
|
Lines 92-98
foreach my $budget (@$budgets) {
Link Here
|
| 92 |
$display_values->{budgetid}->{$budget_id} = $budget->{budget_name}; |
91 |
$display_values->{budgetid}->{$budget_id} = $budget->{budget_name}; |
| 93 |
} |
92 |
} |
| 94 |
|
93 |
|
| 95 |
my @categories = C4::Category->all; |
94 |
my @categories = Koha::Patron::Categories->search( {}, {order_by => ['description']} ); |
| 96 |
foreach my $category (@categories) { |
95 |
foreach my $category (@categories) { |
| 97 |
my $code = $category->categorycode; |
96 |
my $code = $category->categorycode; |
| 98 |
$display_values->{categorycode}->{$code} = $category->description; |
97 |
$display_values->{categorycode}->{$code} = $category->description; |
|
Lines 116-122
foreach my $av (@$suggest) {
Link Here
|
| 116 |
$display_values->{reason}->{$value} = $av->{lib}; |
115 |
$display_values->{reason}->{$value} = $av->{lib}; |
| 117 |
} |
116 |
} |
| 118 |
|
117 |
|
| 119 |
my $branches = C4::Branch::GetBranchesLoop('', 0); |
118 |
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; |
| 120 |
foreach my $branch (@$branches) { |
119 |
foreach my $branch (@$branches) { |
| 121 |
my $branchcode = $branch->{branchcode}; |
120 |
my $branchcode = $branch->{branchcode}; |
| 122 |
$display_values->{branchcode}->{$branchcode} = $branch->{branchname}; |
121 |
$display_values->{branchcode}->{$branchcode} = $branch->{branchname}; |
|
Lines 137-142
output_html_with_http_headers $cgi, $cookie, $template->output;
Link Here
|
| 137 |
sub get_select_expr { |
136 |
sub get_select_expr { |
| 138 |
my ($field, $groupby) = @_; |
137 |
my ($field, $groupby) = @_; |
| 139 |
|
138 |
|
|
|
139 |
# To avoid 'ambiguous column name' error when using borrowers table |
| 140 |
if ($field eq 'branchcode') { |
| 141 |
$field = 'suggestions.branchcode'; |
| 142 |
} |
| 143 |
|
| 140 |
my $select_expr = $field; |
144 |
my $select_expr = $field; |
| 141 |
if ($groupby->{$field}) { |
145 |
if ($groupby->{$field}) { |
| 142 |
if ($groupby->{$field} eq 'year') { |
146 |
if ($groupby->{$field} eq 'year') { |
|
Lines 197-203
sub calculate {
Link Here
|
| 197 |
|
201 |
|
| 198 |
foreach my $filter (qw(status categorycode sort1 sort2 branchcode reason itemtype)) { |
202 |
foreach my $filter (qw(status categorycode sort1 sort2 branchcode reason itemtype)) { |
| 199 |
if ($filters->{$filter}) { |
203 |
if ($filters->{$filter}) { |
| 200 |
push @conditions, "$filter = ?"; |
204 |
my $column = $filter; |
|
|
205 |
|
| 206 |
# To avoid 'ambiguous column name' error when using borrowers table |
| 207 |
if ($column eq 'branchcode') { |
| 208 |
$column = 'suggestions.branchcode'; |
| 209 |
} |
| 210 |
|
| 211 |
push @conditions, "$column = ?"; |
| 201 |
push @bind_values, $filters->{$filter}; |
212 |
push @bind_values, $filters->{$filter}; |
| 202 |
} |
213 |
} |
| 203 |
} |
214 |
} |
| 204 |
- |
|
|