Lines 415-423
if ($ethnicitycategoriescount>=0) {
Link Here
|
415 |
} |
415 |
} |
416 |
|
416 |
|
417 |
my @typeloop; |
417 |
my @typeloop; |
|
|
418 |
my $no_categories = 1; |
419 |
my $no_add; |
418 |
foreach (qw(C A S P I X)) { |
420 |
foreach (qw(C A S P I X)) { |
419 |
my $action="WHERE category_type=?"; |
421 |
my $action="WHERE category_type=?"; |
420 |
($categories,$labels)=GetborCatFromCatType($_,$action); |
422 |
($categories,$labels)=GetborCatFromCatType($_,$action); |
|
|
423 |
if(scalar(@$categories) > 0){ $no_categories = 0; } |
421 |
my @categoryloop; |
424 |
my @categoryloop; |
422 |
foreach my $cat (@$categories){ |
425 |
foreach my $cat (@$categories){ |
423 |
push @categoryloop,{'categorycode' => $cat, |
426 |
push @categoryloop,{'categorycode' => $cat, |
Lines 434-442
foreach (qw(C A S P I X)) {
Link Here
|
434 |
push @typeloop,{'typename' => $_, |
437 |
push @typeloop,{'typename' => $_, |
435 |
$typedescription => 1, |
438 |
$typedescription => 1, |
436 |
'categoryloop' => \@categoryloop}; |
439 |
'categoryloop' => \@categoryloop}; |
437 |
} |
440 |
} |
438 |
$template->param('typeloop' => \@typeloop); |
441 |
$template->param('typeloop' => \@typeloop, |
439 |
|
442 |
no_categories => $no_categories); |
|
|
443 |
if($no_categories){ $no_add = 1; } |
440 |
# test in city |
444 |
# test in city |
441 |
$select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid ne '0'); |
445 |
$select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid ne '0'); |
442 |
($default_city=$select_city) if ($step eq 0); |
446 |
($default_city=$select_city) if ($step eq 0); |
Lines 527-543
my $onlymine=(C4::Context->preference('IndependantBranches') &&
Link Here
|
527 |
|
531 |
|
528 |
my $branches=GetBranches($onlymine); |
532 |
my $branches=GetBranches($onlymine); |
529 |
my $default; |
533 |
my $default; |
530 |
|
534 |
my $CGIbranch; |
531 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
535 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
532 |
push @select_branch,$branch; |
536 |
push @select_branch,$branch; |
533 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
537 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
534 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
538 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
535 |
} |
539 |
} |
|
|
540 |
if(scalar(@select_branch) > 0){ |
536 |
# -------------------------------------------------------------------------------------------------------- |
541 |
# -------------------------------------------------------------------------------------------------------- |
537 |
#in modify mod :default value from $CGIbranch comes from borrowers table |
542 |
#in modify mod :default value from $CGIbranch comes from borrowers table |
538 |
#in add mod: default value come from branches table (ip correspendence) |
543 |
#in add mod: default value come from branches table (ip correspendence) |
539 |
$default=$data{'branchcode'} if ($op eq 'modify' || ($op eq 'add' && $category_type eq 'C')); |
544 |
$default=$data{'branchcode'} if ($op eq 'modify' || ($op eq 'add' && $category_type eq 'C')); |
540 |
my $CGIbranch = CGI::scrolling_list(-id => 'branchcode', |
545 |
$CGIbranch = CGI::scrolling_list(-id => 'branchcode', |
541 |
-name => 'branchcode', |
546 |
-name => 'branchcode', |
542 |
-values => \@select_branch, |
547 |
-values => \@select_branch, |
543 |
-labels => \%select_branches, |
548 |
-labels => \%select_branches, |
Lines 546-551
my $CGIbranch = CGI::scrolling_list(-id => 'branchcode',
Link Here
|
546 |
-multiple =>0, |
551 |
-multiple =>0, |
547 |
-default => $default, |
552 |
-default => $default, |
548 |
); |
553 |
); |
|
|
554 |
} |
555 |
|
556 |
if(!$CGIbranch){ |
557 |
$no_add = 1; |
558 |
$template->param(no_branches => 1); |
559 |
} |
560 |
if($no_categories){ |
561 |
$no_add = 1; |
562 |
$template->param(no_categories => 1); |
563 |
} |
564 |
$template->param(no_add => $no_add); |
549 |
my $CGIorganisations; |
565 |
my $CGIorganisations; |
550 |
my $member_of_institution; |
566 |
my $member_of_institution; |
551 |
if (C4::Context->preference("memberofinstitution")){ |
567 |
if (C4::Context->preference("memberofinstitution")){ |
Lines 636-641
$template->param(
Link Here
|
636 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
652 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
637 |
"op$op" => 1); |
653 |
"op$op" => 1); |
638 |
|
654 |
|
|
|
655 |
$template->param(CGIbranch=>$CGIbranch) if ($CGIbranch); |
639 |
$template->param( |
656 |
$template->param( |
640 |
nodouble => $nodouble, |
657 |
nodouble => $nodouble, |
641 |
borrowernumber => $borrowernumber, #register number |
658 |
borrowernumber => $borrowernumber, #register number |
Lines 653-659
$template->param(
Link Here
|
653 |
category_type =>$category_type, |
670 |
category_type =>$category_type, |
654 |
modify => $modify, |
671 |
modify => $modify, |
655 |
nok => $nok,#flag to konw if an error |
672 |
nok => $nok,#flag to konw if an error |
656 |
CGIbranch => $CGIbranch, |
|
|
657 |
memberofinstution => $member_of_institution, |
673 |
memberofinstution => $member_of_institution, |
658 |
CGIorganisations => $CGIorganisations, |
674 |
CGIorganisations => $CGIorganisations, |
659 |
NoUpdateLogin => $NoUpdateLogin |
675 |
NoUpdateLogin => $NoUpdateLogin |