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 432-440
foreach (qw(C A S P I X)) {
Link Here
|
432 |
$typehash{'categoryloop'}=\@categoryloop; |
435 |
$typehash{'categoryloop'}=\@categoryloop; |
433 |
push @typeloop,{'typename' => $_, |
436 |
push @typeloop,{'typename' => $_, |
434 |
'categoryloop' => \@categoryloop}; |
437 |
'categoryloop' => \@categoryloop}; |
435 |
} |
438 |
} |
436 |
$template->param('typeloop' => \@typeloop); |
439 |
$template->param('typeloop' => \@typeloop, |
437 |
|
440 |
no_categories => $no_categories); |
|
|
441 |
if($no_categories){ $no_add = 1; } |
438 |
# test in city |
442 |
# test in city |
439 |
$select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid ne '0'); |
443 |
$select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid ne '0'); |
440 |
($default_city=$select_city) if ($step eq 0); |
444 |
($default_city=$select_city) if ($step eq 0); |
Lines 525-541
my $onlymine=(C4::Context->preference('IndependantBranches') &&
Link Here
|
525 |
|
529 |
|
526 |
my $branches=GetBranches($onlymine); |
530 |
my $branches=GetBranches($onlymine); |
527 |
my $default; |
531 |
my $default; |
528 |
|
532 |
my $CGIbranch; |
529 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
533 |
for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { |
530 |
push @select_branch,$branch; |
534 |
push @select_branch,$branch; |
531 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
535 |
$select_branches{$branch} = $branches->{$branch}->{'branchname'}; |
532 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
536 |
$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'}); |
533 |
} |
537 |
} |
|
|
538 |
if(scalar(@select_branch) > 0){ |
534 |
# -------------------------------------------------------------------------------------------------------- |
539 |
# -------------------------------------------------------------------------------------------------------- |
535 |
#in modify mod :default value from $CGIbranch comes from borrowers table |
540 |
#in modify mod :default value from $CGIbranch comes from borrowers table |
536 |
#in add mod: default value come from branches table (ip correspendence) |
541 |
#in add mod: default value come from branches table (ip correspendence) |
537 |
$default=$data{'branchcode'} if ($op eq 'modify' || ($op eq 'add' && $category_type eq 'C')); |
542 |
$default=$data{'branchcode'} if ($op eq 'modify' || ($op eq 'add' && $category_type eq 'C')); |
538 |
my $CGIbranch = CGI::scrolling_list(-id => 'branchcode', |
543 |
$CGIbranch = CGI::scrolling_list(-id => 'branchcode', |
539 |
-name => 'branchcode', |
544 |
-name => 'branchcode', |
540 |
-values => \@select_branch, |
545 |
-values => \@select_branch, |
541 |
-labels => \%select_branches, |
546 |
-labels => \%select_branches, |
Lines 544-549
my $CGIbranch = CGI::scrolling_list(-id => 'branchcode',
Link Here
|
544 |
-multiple =>0, |
549 |
-multiple =>0, |
545 |
-default => $default, |
550 |
-default => $default, |
546 |
); |
551 |
); |
|
|
552 |
} |
553 |
|
554 |
if(!$CGIbranch){ |
555 |
$no_add = 1; |
556 |
$template->param(no_branches => 1); |
557 |
} |
558 |
if($no_categories){ |
559 |
$no_add = 1; |
560 |
$template->param(no_categories => 1); |
561 |
} |
562 |
$template->param(no_add => $no_add); |
547 |
my $CGIorganisations; |
563 |
my $CGIorganisations; |
548 |
my $member_of_institution; |
564 |
my $member_of_institution; |
549 |
if (C4::Context->preference("memberofinstitution")){ |
565 |
if (C4::Context->preference("memberofinstitution")){ |
Lines 634-639
$template->param(
Link Here
|
634 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
650 |
check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) |
635 |
"op$op" => 1); |
651 |
"op$op" => 1); |
636 |
|
652 |
|
|
|
653 |
$template->param(CGIbranch=>$CGIbranch) if ($CGIbranch); |
637 |
$template->param( |
654 |
$template->param( |
638 |
nodouble => $nodouble, |
655 |
nodouble => $nodouble, |
639 |
borrowernumber => $borrowernumber, #register number |
656 |
borrowernumber => $borrowernumber, #register number |
Lines 650-656
$template->param(
Link Here
|
650 |
check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function |
667 |
check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function |
651 |
modify => $modify, |
668 |
modify => $modify, |
652 |
nok => $nok,#flag to konw if an error |
669 |
nok => $nok,#flag to konw if an error |
653 |
CGIbranch => $CGIbranch, |
|
|
654 |
memberofinstution => $member_of_institution, |
670 |
memberofinstution => $member_of_institution, |
655 |
CGIorganisations => $CGIorganisations, |
671 |
CGIorganisations => $CGIorganisations, |
656 |
NoUpdateLogin => $NoUpdateLogin |
672 |
NoUpdateLogin => $NoUpdateLogin |