First step of independacy branch management.
authorhdl <hdl>
Thu, 28 Jul 2005 17:38:29 +0000 (17:38 +0000)
committerhdl <hdl>
Thu, 28 Jul 2005 17:38:29 +0000 (17:38 +0000)
Displaying only librarian branch if librarian is not superlibrarian and IndependantBranches is set.

members/memberentry.pl

index c13142a..15a6a25 100755 (executable)
@@ -223,10 +223,22 @@ if ($delete){
        my @select_branch;
        my %select_branches;
        my $branches=getbranches();
+       my $default;
        foreach my $branch (keys %$branches) {
-               push @select_branch, $branch;
-               $select_branches{$branch} = $branches->{$branch}->{'branchname'};
+               if (C4::Context->preference("IndependantBranches")) {
+                       my $userenv = C4::Context->userenv;
+                       unless ($userenv->{flags} == 1){
+                               push @select_branch, $branch if ($branch eq $userenv->{branch});
+                               $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq $userenv->{branch});
+                               $default = $userenv->{branch};
+                       }
+               } else {
+                       push @select_branch, $branch;
+                       $select_branches{$branch} = $branches->{$branch}->{'branchname'};
+                       $default = $data->{'branchcode'};
+               }
        }
+       
        my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
                                -id => 'branchcode',
                                -values   => \@select_branch,