|
Lines 110-124
my $op = $input->param("op");
Link Here
|
| 110 |
my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{VARS}->{'USER_INFO'}->{'branchcode'}:'', $show_mine?$template->{VARS}->{'USER_INFO'}->{'borrowernumber'}:'' ); |
110 |
my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{VARS}->{'USER_INFO'}->{'branchcode'}:'', $show_mine?$template->{VARS}->{'USER_INFO'}->{'borrowernumber'}:'' ); |
| 111 |
|
111 |
|
| 112 |
# build categories list |
112 |
# build categories list |
| 113 |
my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' "); |
113 |
my @DistinctAuthValues = Koha::AuthorisedValue->GetDistinctCat(); |
| 114 |
$sth->execute; |
|
|
| 115 |
|
114 |
|
| 116 |
# the list |
115 |
# the list |
| 117 |
my @category_list; |
116 |
my @category_list; |
| 118 |
|
117 |
|
| 119 |
# a hash, to check that some hardcoded categories exist. |
118 |
# a hash, to check that some hardcoded categories exist. |
| 120 |
my %categories; |
119 |
my %categories; |
| 121 |
while ( my ($category) = $sth->fetchrow_array ) { |
120 |
while ( my ($category) = each @DistinctAuthValues ) { |
| 122 |
push( @category_list, $category ); |
121 |
push( @category_list, $category ); |
| 123 |
$categories{$category} = 1; |
122 |
$categories{$category} = 1; |
| 124 |
} |
123 |
} |
|
Lines 192-208
HideCols($authcat, @hide_cols);
Link Here
|
| 192 |
} |
191 |
} |
| 193 |
# ------------------------------------------------------------ |
192 |
# ------------------------------------------------------------ |
| 194 |
if ( $authcat =~ m/^Asort/ ) { |
193 |
if ( $authcat =~ m/^Asort/ ) { |
| 195 |
my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib }; |
194 |
my @AuthValues = Koha::AuthorisedValue->GetAuthValues($authcat); |
| 196 |
my $sth = $dbh->prepare($query); |
195 |
if ( @AuthValues > 0 ) { |
| 197 |
$sth->execute($authcat ); |
196 |
while ( my ($AuthValue) = each @AuthValues) { |
| 198 |
if ( $sth->rows > 0 ) { |
197 |
my $results = $AuthValue; |
| 199 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
|
|
| 200 |
my $results = $sth->fetchrow_hashref; |
| 201 |
push @authvals, $results->{authorised_value}; |
198 |
push @authvals, $results->{authorised_value}; |
| 202 |
$labels{ $results->{authorised_value} } = $results->{lib}; |
199 |
$labels{ $results->{authorised_value} } = $results->{lib}; |
| 203 |
} |
200 |
} |
| 204 |
} |
201 |
} |
| 205 |
$sth->finish; |
|
|
| 206 |
@authvals = sort { $a <=> $b } @authvals; |
202 |
@authvals = sort { $a <=> $b } @authvals; |
| 207 |
} |
203 |
} |
| 208 |
elsif ( $authcat eq 'MONTHS' && $budget_period_startdate && $budget_period_enddate ) { |
204 |
elsif ( $authcat eq 'MONTHS' && $budget_period_startdate && $budget_period_enddate ) { |
|
Lines 229-265
elsif ( $authcat eq 'MONTHS' && $budget_period_startdate && $budget_period_endda
Link Here
|
| 229 |
} |
225 |
} |
| 230 |
|
226 |
|
| 231 |
elsif ( $authcat eq 'ITEMTYPES' ) { |
227 |
elsif ( $authcat eq 'ITEMTYPES' ) { |
| 232 |
my $query = qq| SELECT itemtype, description FROM itemtypes |; |
228 |
my $sth = Koha::ItemType->GetItemTypes($dbh); |
| 233 |
my $sth = $dbh->prepare($query); |
|
|
| 234 |
$sth->execute( ); |
| 235 |
|
229 |
|
| 236 |
if ( $sth->rows > 0 ) { |
230 |
if ( $sth->rows > 0 ) { |
| 237 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
231 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
| 238 |
my $results = $sth->fetchrow_hashref; |
232 |
my $results = $sth->fetchrow_hashref; |
| 239 |
push @authvals, $results->{itemtype}; |
233 |
push @authvals, $results->{itemtype}; |
| 240 |
$labels{ $results->{itemtype} } = $results->{description}; |
234 |
$labels{ $results->{itemtype} } = $results->{description}; |
| 241 |
} |
235 |
} |
| 242 |
} |
236 |
} |
| 243 |
$sth->finish; |
|
|
| 244 |
|
237 |
|
| 245 |
} elsif ( $authcat eq 'BRANCHES' ) { |
238 |
} elsif ( $authcat eq 'BRANCHES' ) { |
| 246 |
|
239 |
|
| 247 |
my $query = qq| SELECT branchcode, branchname FROM branches |; |
240 |
my $sth = Koha::Libraries->GetBranches($dbh); |
| 248 |
my $sth = $dbh->prepare($query); |
|
|
| 249 |
$sth->execute(); |
| 250 |
|
241 |
|
| 251 |
if ( $sth->rows > 0 ) { |
242 |
if ( $sth->rows > 0 ) { |
| 252 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
243 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
| 253 |
my $results = $sth->fetchrow_hashref; |
244 |
my $results = $sth->fetchrow_hashref; |
| 254 |
push @authvals, $results->{branchcode}; |
245 |
push @authvals, $results->{branchcode}; |
| 255 |
$labels{ $results->{branchcode} } = $results->{branchname}; |
246 |
$labels{ $results->{branchcode} } = $results->{branchname}; |
| 256 |
} |
247 |
} |
| 257 |
} |
248 |
} |
| 258 |
$sth->finish; |
|
|
| 259 |
} elsif ($authcat) { |
249 |
} elsif ($authcat) { |
| 260 |
my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib }; |
250 |
|
| 261 |
my $sth = $dbh->prepare($query); |
251 |
my $sth = Koha::AuthorisedValue->GetAuthValues($authcat,$dbh); |
| 262 |
$sth->execute($authcat); |
|
|
| 263 |
if ( $sth->rows > 0 ) { |
252 |
if ( $sth->rows > 0 ) { |
| 264 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
253 |
for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { |
| 265 |
my $results = $sth->fetchrow_hashref; |
254 |
my $results = $sth->fetchrow_hashref; |