X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Faqbudgets.pl;h=3ff1bd6d69ef15a5260bbfdf06c4e1ccaee179fd;hb=df6ba9bc5fb407fbb56ec6f047b780f524bcd083;hp=22c80c89543b8a570648d7c55ef8f45e2041867a;hpb=d6e6d920b56d7690a7b2c59171f89929bd057613;p=koha_gimpoz diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index 22c80c8954..3ff1bd6d69 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -52,7 +52,9 @@ my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( ); my $cur = GetCurrency(); -$template->param( cur => $cur->{symbol} ); +$template->param( symbol => $cur->{symbol}, + currency => $cur->{currency} + ); my $op = $input->param('op'); @@ -62,10 +64,9 @@ my $show = $input->param('show'); # SET TO 1, BY A FORM SUMBIT $show_mine = $input->param('show_mine') if $show == 1; # IF USER DOESNT HAVE PERM FOR AN 'ADD', THEN REDIRECT TO THE DEFAULT VIEW... -if ( not defined $template->{param_map}->{'CAN_user_acquisition_budget_add_del'} && $op == 'add_form' ) { +if ( not defined $template->{VARS}->{'CAN_user_acquisition_budget_add_del'} && $op == 'add_form' ) { $op = ''; } - my $num=FormatNumber; my $script_name = "/cgi-bin/koha/admin/aqbudgets.pl"; @@ -73,9 +74,9 @@ my $budget_hash = $input->Vars; my $budget_id = $$budget_hash{budget_id}; my $budget_permission = $input->param('budget_permission'); my $budget_period_dropbox = $input->param('budget_period_dropbox'); +my $filter_budgetbranch = $input->param('filter_budgetbranch'); #filtering non budget keys delete $$budget_hash{$_} foreach grep {/filter|^op$|show/} keys %$budget_hash; -my $filter_budgetbranch = $input->param('filter_budgetbranch'); my $filter_budgetname = $input->param('filter_budgetname'); $template->param( notree => ($filter_budgetbranch or $show_mine) @@ -121,7 +122,6 @@ $template->param(auth_cats_loop => GetBudgetAuthCats($$period{budget_period_id}) # Used to create form to add or modify a record if ($op eq 'add_form') { #### ------------------- ADD_FORM ------------------------- - # if no buget_id is passed then its an add # pass the period_id to build the dropbox - because we only want to show budgets from this period my $dropbox_disabled; @@ -184,16 +184,17 @@ if ($op eq 'add_form') { $template->param(authorised_value_categories1 => \@auth_cats_loop1); $template->param(authorised_value_categories2 => \@auth_cats_loop2); - my $budget_perm_dropbox = - GetBudgetPermDropbox($budget->{'budget_permission'}); - + if($budget->{'budget_permission'}){ + my $budget_permission = "budget_perm_".$budget->{'budget_permission'}; + $template->param($budget_permission => 1); + } + # if no buget_id is passed then its an add $template->param( add_validate => 1, dateformat => C4::Dates->new()->visual(), budget_parent_id => $budget_parent->{'budget_id'}, budget_parent_name => $budget_parent->{'budget_name'}, - budget_perm_dropbox => $budget_perm_dropbox, branchloop_select => \@branchloop_select, %$period, %$budget, @@ -239,8 +240,6 @@ if ($op eq 'add_form') { my $period_total = 0; my ( $period_alloc_total, $base_spent_total ); - use YAML; - $debug && warn Dump(@budgets); #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ? foreach my $budget (@budgets) { @@ -295,11 +294,11 @@ if ($op eq 'add_form') { $budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; $budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ - $$budget{$_} = $num->format_price( $$budget{$_} ) if defined($$budget{$_}) + $budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) } # Value of budget_spent equals 0 instead of undefined value - $$budget{"budget_spent"} = $num->format_price(0) unless defined($$budget{"budget_spent"}); + $budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); $budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; @@ -324,7 +323,11 @@ if ($op eq 'add_form') { ); } - my $budget_period_total = $num->format_price($$period{budget_period_total}) if $$period{budget_period_total}; + my $budget_period_total; + if ( $period->{budget_period_total} ) { + $budget_period_total = + $num->format_price( $period->{budget_period_total} ); + } $template->param( else => 1, budget => \@loop,