X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=admin%2Faqplan.pl;h=9cc8c5990d2d089db001c218911702dae30b16be;hb=8e485c6112756f3fe8404d9d4d700535f0e87306;hp=5fb70973b303aface3eae50cbd363f88bea1f5c3;hpb=d43cf0883709b0844d9936f072f497c6217c77b4;p=koha.git diff --git a/admin/aqplan.pl b/admin/aqplan.pl index 5fb70973b3..9cc8c5990d 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -60,7 +60,9 @@ my $budget_period_id = $input->param('budget_period_id'); my $period = GetBudgetPeriod($budget_period_id); my $count = GetPeriodsCount(); my $cur = GetCurrency; - +$template->param( symbol => $cur->{symbol}, + currency => $cur->{currency} + ); $template->param( period_button_only => 1 ) if $count == 0; @@ -72,21 +74,19 @@ my $budget_period_startdate = $period->{'budget_period_startdate'}; my $budget_period_enddate = $period->{'budget_period_enddate'}; my $budget_period_locked = $period->{'budget_period_locked'}; my $budget_period_description = $period->{'budget_period_description'}; -my $budget_period_dropbox = GetBudgetPeriodsDropbox($budget_period_id ); $template->param( budget_period_id => $budget_period_id, budget_period_locked => $budget_period_locked, budget_period_description => $budget_period_description, - budget_period_dropbox => $budget_period_dropbox, auth_cats_loop => $auth_cats_loop, ); # ------- get periods stuff ------------------ -my $borrower_id = $template->{param_map}->{'USER_INFO'}[0]->{'borrowernumber'}; -my $borrower_branchcode = $template->{param_map}->{'USER_INFO'}[0]->{'branchcode'}; +my $borrower_id = $template->{VARS}->{'USER_INFO'}[0]->{'borrowernumber'}; +my $borrower_branchcode = $template->{VARS}->{'USER_INFO'}[0]->{'branchcode'}; my $periods; my $authcat = $input->param('authcat'); @@ -95,7 +95,6 @@ my $show_actual = $input->param('show_actual'); my $show_percent = $input->param('show_percent'); my $output = $input->param("output"); my $basename = $input->param("basename"); -my $mime = $input->param("MIME"); my $del = $input->param("sep"); my $show_mine = $input->param('show_mine') ; @@ -133,7 +132,7 @@ my $op = $input->param("op"); my $budget_branchcode; -my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{param_map}->{'USER_INFO'}[0]->{'branchcode'}:'', $show_mine?$template->{param_map}->{'USER_INFO'}[0]->{'borrowernumber'}:'' ); +my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{VARS}->{'USER_INFO'}[0]->{'branchcode'}:'', $show_mine?$template->{VARS}->{'USER_INFO'}[0]->{'borrowernumber'}:'' ); # build categories list my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' "); @@ -153,6 +152,7 @@ while ( my ($category) = $sth->fetchrow_array ) { push( @category_list, 'MONTHS' ); push( @category_list, 'ITEMTYPES' ); push( @category_list, 'BRANCHES' ); +push( @category_list, $$_{'authcat'} ) foreach @$auth_cats_loop; #reorder the list @category_list = sort { $a cmp $b } @category_list; @@ -173,9 +173,7 @@ my $CGISort; my @authvals; my %labels; - - my @names = $input->param(); - +my @names = $input->param(); # ------------------------------------------------------------ if ( $op eq 'save' ) { #get budgets @@ -292,6 +290,18 @@ elsif ( $authcat eq 'ITEMTYPES' ) { } } $sth->finish; +} elsif ($authcat) { + my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib }; + my $sth = $dbh->prepare($query); + $sth->execute($authcat); + if ( $sth->rows > 0 ) { + for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { + my $results = $sth->fetchrow_hashref; + push @authvals, $results->{authorised_value}; + $labels{ $results->{authorised_value} } = $results->{lib}; + } + } + $sth->finish; } my @authvals_row; @@ -321,11 +331,10 @@ foreach my $n (@names) { # ------------------------------------------------------------ # DEFAULT DISPLAY BEGINS -my @mime = ( C4::Context->preference("MIME") ); my $CGIextChoice = CGI::scrolling_list( -name => 'MIME', -id => 'MIME', - -values => \@mime, + -values => ['CSV'], # FIXME translation -size => 1, -multiple => 0 ); @@ -345,6 +354,10 @@ my ( @budget_lines, %cell_hash ); foreach my $budget (@budgets) { my $budget_lock; + unless (CanUserUseBudget($borrowernumber, $budget, $staff_flags)) { + $budget_lock = 1 + } + # check budget permission if ( $period->{budget_period_locked} == 1 ) { $budget_lock = 1; @@ -441,7 +454,6 @@ $template->param( show_actual => $show_actual, show_percent => $show_percent, show_mine => $show_mine, - cur => $cur->{symbol}, cur_format => $cur_format, CGIextChoice => $CGIextChoice, CGIsepChoice => $CGIsepChoice, @@ -455,7 +467,7 @@ output_html_with_http_headers $input, $cookie, $template->output; sub _print_to_csv { my ( $header, $results ) = @_; - binmode STDOUT, ":utf8"; + binmode STDOUT, ':encoding(UTF-8)'; my $csv = Text::CSV_XS->new( { sep_char => $del,