use Modern::Perl;
use CGI qw ( -utf8 );
-use List::Util qw/min/;
use Koha::Database;
-use C4::Auth qw/get_user_subpermissions/;
-use C4::Auth;
-use C4::Acquisition;
-use C4::Budgets;
+use C4::Auth qw( get_template_and_user );
+use C4::Budgets qw(
+ AddBudget
+ BudgetHasChildren
+ CanUserModifyBudget
+ CanUserUseBudget
+ DelBudget
+ GetBudget
+ GetBudgetAuthCats
+ GetBudgetHierarchy
+ GetBudgetPeriod
+ GetBudgetPeriods
+ GetBudgetUsers
+ ModBudget
+ ModBudgetUsers
+);
use C4::Context;
-use C4::Output;
-use C4::Koha;
-use C4::Debug;
+use C4::Output qw( output_html_with_http_headers output_and_exit );
use Koha::Acquisition::Currencies;
use Koha::Patrons;
-my $input = new CGI;
+my $input = CGI->new;
my $dbh = C4::Context->dbh;
my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user(
{ template_name => "admin/aqbudgets.tt",
query => $input,
type => "intranet",
- authnotrequired => 0,
flagsrequired => { acquisition => 'budget_manage' },
- debug => 0,
}
);
my $active_currency = Koha::Acquisition::Currencies->get_active;
-$template->param( symbol => $active_currency->symbol,
- currency => $active_currency->currency
- );
+if ( $active_currency ) {
+ $template->param( symbol => $active_currency->symbol,
+ currency => $active_currency->currency
+ );
+}
my $op = $input->param('op') || 'list';
# ------- get periods stuff ------------------
-# USED FOR PERMISSION COMPARISON LATER
-my $borrower_id = $template->{VARS}->{'USER_INFO'}->{'borrowernumber'};
-
$template->param(
show_mine => $show_mine,
op => $op,
exit;
}
$dropbox_disabled = BudgetHasChildren($budget_id);
- my $patron = Koha::Patrons->find( $budget->{budget_owner_id} );
- $budget->{budget_owner_name} = ( $patron ? $patron->firstname . ' ' . $patron->surname : '' );
+ $budget->{budget_owner} = Koha::Patrons->find( $budget->{budget_owner_id} );
+ } elsif ( $period->{budget_period_locked} ) {
+ output_and_exit( $input, $cookie, $template, 'budget_is_locked' );
}
# build budget hierarchy
);
my @budgets = @{
- GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrower_id : 0 ))
+ GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrowernumber : 0 ))
};
my $period_total = 0;