=cut
sub set_parameters {
- my ($template) = @_;
- my $userbranch = C4::Context->userenv->{'branch'};
- $template->param( branchloop => GetBranchesLoop($userbranch) );
- return $template;
+ my ($template) = @_;
+ my $userbranch = '';
+ if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
+ $userbranch = C4::Context->userenv->{'branch'};
+ }
+ $template->param( branchloop => GetBranchesLoop($userbranch) );
+ return $template;
}
sub calculate {