Lines 568-610
foreach (keys(%flags)) {
Link Here
|
568 |
push @flagdata,\%row; |
568 |
push @flagdata,\%row; |
569 |
} |
569 |
} |
570 |
|
570 |
|
571 |
#get Branches |
571 |
# get Branch Loop |
572 |
my @branches; |
572 |
# in modify mod: userbranch value for GetBranchesLoop() comes from borrowers table |
573 |
my @select_branch; |
573 |
# in add mod: userbranch value come from branches table (ip correspondence) |
574 |
my %select_branches; |
574 |
|
575 |
|
575 |
my $userbranch = C4::Context->userenv->{'branch'}; |
576 |
my $onlymine=(C4::Context->preference('IndependantBranches') && |
|
|
577 |
C4::Context->userenv && |
578 |
C4::Context->userenv->{flags} % 2 !=1 && |
579 |
C4::Context->userenv->{branch}?1:0); |
580 |
|
581 |
my $branches=GetBranches($onlymine); |
582 |
my $default; |
583 |
my $CGIbranch; |
584 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
585 |
push @select_branch,$branch; |
586 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
587 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
588 |
} |
589 |
if(scalar(@select_branch) > 0){ |
590 |
# -------------------------------------------------------------------------------------------------------- |
591 |
#in modify mod :default value from $CGIbranch comes from borrowers table |
592 |
#in add mod: default value come from branches table (ip correspendence) |
593 |
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || ( $op eq 'add' && $category_type eq 'C' ) )) { |
576 |
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || ( $op eq 'add' && $category_type eq 'C' ) )) { |
594 |
$default = $data{'branchcode'}; |
577 |
$userbranch = $data{'branchcode'}; |
595 |
} |
|
|
596 |
$CGIbranch = CGI::scrolling_list(-id => 'branchcode', |
597 |
-name => 'branchcode', |
598 |
-values => \@select_branch, |
599 |
-labels => \%select_branches, |
600 |
-size => 1, |
601 |
-override => 1, |
602 |
-multiple =>0, |
603 |
-default => $default, |
604 |
); |
605 |
} |
578 |
} |
606 |
|
579 |
|
607 |
if(!$CGIbranch){ |
580 |
my $branchloop = GetBranchesLoop( $userbranch ); |
|
|
581 |
|
582 |
if( !$branchloop ){ |
608 |
$no_add = 1; |
583 |
$no_add = 1; |
609 |
$template->param(no_branches => 1); |
584 |
$template->param(no_branches => 1); |
610 |
} |
585 |
} |
Lines 710-716
$template->param(
Link Here
|
710 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
685 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
711 |
"op$op" => 1); |
686 |
"op$op" => 1); |
712 |
|
687 |
|
713 |
$template->param(CGIbranch=>$CGIbranch) if ($CGIbranch); |
688 |
$template->param( branchloop => $branchloop ) if ( $branchloop ); |
714 |
$template->param( |
689 |
$template->param( |
715 |
nodouble => $nodouble, |
690 |
nodouble => $nodouble, |
716 |
borrowernumber => $borrowernumber, #register number |
691 |
borrowernumber => $borrowernumber, #register number |