X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Faqbudgets.pl;h=39fffdb7c1ff396c874f4aad56d525ed26549fda;hb=67942f7432e8706c460e7f8e36178c0cd60333f7;hp=34a4021be1a756c724e128bedf6ce2ebcae4974e;hpb=c190d93a12c2741b8d4539b7bee175257da815c8;p=srvgit diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index 34a4021be1..39fffdb7c1 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,21 +64,20 @@ 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"; 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'); -#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'); +#filtering non budget keys +delete $$budget_hash{$_} foreach grep {/filter|^op$|show/} keys %$budget_hash; + $template->param( notree => ($filter_budgetbranch or $show_mine) ); @@ -90,7 +91,7 @@ $template->param( # ------- get periods stuff ------------------ # USED FOR PERMISSION COMPARISON LATER -my $borrower_id = $template->{param_map}->{'USER_INFO'}[0]->{'borrowernumber'}; +my $borrower_id = $template->{VARS}->{'USER_INFO'}[0]->{'borrowernumber'}; my $user = GetMemberDetails($borrower_id); my $user_branchcode = $user->{'branchcode'}; @@ -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; @@ -225,9 +225,7 @@ if ($op eq 'add_form') { } } my $branches = GetBranches(); - my $budget_period_dropbox = GetBudgetPeriodsDropbox($$period{budget_period_id} ); $template->param( - budget_period_dropbox => $budget_period_dropbox, budget_id => $budget_id, %$period, ); @@ -249,7 +247,7 @@ if ($op eq 'add_form') { # PERMISSIONS unless($staffflags->{'superlibrarian'} % 2 == 1 ) { #IF NO PERMS, THEN DISABLE EDIT/DELETE - unless ( $template->{param_map}->{'CAN_user_acquisition_budget_modify'} ) { + unless ( $template->{VARS}->{'CAN_user_acquisition_budget_modify'} ) { $budget->{'budget_lock'} = 1; } # check budget permission @@ -274,9 +272,10 @@ if ($op eq 'add_form') { } # ...SUPER_LIB END # if a budget search doesnt match, next - if ($filter_budgetname ) { - next unless $budget->{budget_code} =~ m/$filter_budgetname/ || - $budget->{name} =~ m/$filter_budgetname/ ; + if ($filter_budgetname) { + next + unless $budget->{budget_code} =~ m/$filter_budgetname/i + || $budget->{budget_name} =~ m/$filter_budgetname/i; } if ($filter_budgetbranch ) { next unless $budget->{budget_branchcode} =~ m/$filter_budgetbranch/; @@ -323,13 +322,26 @@ 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} ); + } + + if ($period_alloc_total) { + $period_alloc_total = $num->format_price($period_alloc_total); + } + + if ($base_spent_total) { + $base_spent_total = $num->format_price($base_spent_total); + } + $template->param( else => 1, budget => \@loop, budget_period_total => $budget_period_total, - period_alloc_total => $num->format_price($period_alloc_total), - base_spent_total => $num->format_price($base_spent_total), + period_alloc_total => $period_alloc_total, + base_spent_total => $base_spent_total, branchloop => \@branchloop2, );