X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=serials%2Fsubscription-add.pl;h=e31b8f27da588c0237ca32f2cff24fe1aade9818;hb=507944e41bec4987c9ef8c75c436332bdb727df2;hp=fd338b0e3d0460d4fdaad846af52b05adee69afa;hpb=dc9ff3c53d4a659ec278cff4bff07cf18100b884;p=koha_fer diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index fd338b0e3d..e31b8f27da 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -69,7 +69,8 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { my $subscriptionid = $query->param('subscriptionid'); $subs = GetSubscription($subscriptionid); -## FIXME : Check rights to edit if mod. Could/Should display an error message. + + ## FIXME : Check rights to edit if mod. Could/Should display an error message. if ($subs->{'cannotedit'} && $op eq 'modify'){ carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed"; print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); @@ -124,10 +125,14 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { } } -my $onlymine=C4::Context->preference('IndependantBranches') && - C4::Context->userenv && - C4::Context->userenv->{flags} % 2 !=1 && - C4::Context->userenv->{branch}; +my $onlymine = + C4::Context->preference('IndependentBranches') + && C4::Context->userenv + && !C4::Context->IsSuperLibrarian + && ( + not C4::Auth::haspermission( C4::Context->userenv->{id}, { serials => 'superserials' } ) + ) + && C4::Context->userenv->{branch}; my $branches = GetBranches($onlymine); my $branchloop; for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) { @@ -208,15 +213,14 @@ if ($op eq 'addsubscription') { } $template->param(numberpatterns => \@numberpatternloop); - # Get installed locales - # FIXME this will not work with all environments. - # If call to locale fails, @locales will be an empty array, which is fine. - my @locales = map { - chomp; - # we don't want POSIX and C locales - /^C|^POSIX$/ ? () : $_ - } `locale -a`; - $template->param(locales => \@locales); + my $languages = [ map { + { + language => $_->{iso639_2_code}, + description => $_->{language_description} || $_->{language} + } + } @{ C4::Languages::getAllLanguages() } ]; + + $template->param( locales => $languages ); output_html_with_http_headers $query, $cookie, $template->output; }