View | Details | Raw Unified | Return to bug 3319
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc (+2 lines)
Lines 1-3 Link Here
1
<!-- TMPL_UNLESS NAME="no_add" -->
1
<div id="toolbar">
2
<div id="toolbar">
2
	<script type="text/javascript">
3
	<script type="text/javascript">
3
	//<![CDATA[
4
	//<![CDATA[
Lines 69-71 Link Here
69
	</li>
70
	</li>
70
</ul>
71
</ul>
71
</div>
72
</div>
73
<!-- /TMPL_UNLESS -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl (+5 lines)
Lines 17-22 Link Here
17
17
18
				<!-- TMPL_INCLUDE NAME="patron-toolbar.inc" -->
18
				<!-- TMPL_INCLUDE NAME="patron-toolbar.inc" -->
19
19
20
	<!-- TMPL_IF NAME="no_add" --><div class="dialog alert"><h3>Cannot add patron</h3>
21
		<!-- TMPL_IF NAME="no_branches" --><p>There are <strong>no libraries defined</strong>. <!-- TMPL_IF NAME="CAN_user_parameters" -->Please <a href="/cgi-bin/koha/admin/branches.pl">add a library</a>.<!-- TMPL_ELSE -->An administrator must define at least one library.<!-- /TMPL_IF --></p><!-- /TMPL_IF -->
22
		<!-- TMPL_IF NAME="no_categories" --><p>There are <strong>no patron categories defined</strong>. <!-- TMPL_IF NAME="CAN_user_parameters" -->Please <a href="/cgi-bin/koha/admin/categorie.pl">add a patron category</a>.<!-- TMPL_ELSE -->An administrator must define at least one patron category.<!-- /TMPL_IF --></p><!-- /TMPL_IF --></div>
23
	<!-- /TMPL_IF -->
24
20
						<div class="browse">
25
						<div class="browse">
21
							Browse by last name:
26
							Browse by last name:
22
							<!-- TMPL_LOOP name="letters" -->
27
							<!-- TMPL_LOOP name="letters" -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl (-6 / +6 lines)
Lines 1-6 Link Here
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
<title>Koha &rsaquo; Patrons &rsaquo; 
2
<title>Koha &rsaquo; Patrons &rsaquo; 
3
<!-- TMPL_IF NAME="opadd" -->	Add<!-- TMPL_ELSE --> Modify<!--/TMPL_IF--> <!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --><!--TMPL_UNLESS Name="opadd"--> <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --><!--/TMPL_UNLESS--></title>
3
<!-- TMPL_IF NAME="opadd" -->Add<!-- TMPL_ELSE --> Modify<!--/TMPL_IF--> <!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --><!--TMPL_UNLESS Name="opadd"--> <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --><!--/TMPL_UNLESS--></title>
4
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
5
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
5
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
6
<script type="text/JavaScript" language="JavaScript">
6
<script type="text/JavaScript" language="JavaScript">
Lines 80-86 Link Here
80
	<div id="yui-main">
80
	<div id="yui-main">
81
	<div class="yui-b">
81
	<div class="yui-b">
82
82
83
	<!-- TMPL_IF NAME="no_add" --><div class="dialog alert"><h3>Cannot add patron</h3>
84
		<!-- TMPL_IF NAME="no_branches" --><p>There are <strong>no libraries defined</strong>. <!-- TMPL_IF NAME="CAN_user_parameters" -->Please <a href="/cgi-bin/koha/admin/branches.pl">add a library</a>.<!-- TMPL_ELSE -->An administrator must define at least one library.<!-- /TMPL_IF --></p><!-- /TMPL_IF -->
85
		<!-- TMPL_IF NAME="no_categories" --><p>There are <strong>no patron categories defined</strong>. <!-- TMPL_IF NAME="CAN_user_parameters" -->Please <a href="/cgi-bin/koha/admin/categorie.pl">add a patron category</a>.<!-- TMPL_ELSE -->An administrator must define at least one patron category.</p><!-- /TMPL_IF --><!-- /TMPL_IF --></div><!-- /TMPL_IF -->
83
86
87
	<!-- TMPL_UNLESS NAME="no_add" -->
84
	<!-- TMPL_IF NAME="opadd" -->
88
	<!-- TMPL_IF NAME="opadd" -->
85
	<h1>
89
	<h1>
86
		Add<!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR NAME="surname" --> 
90
		Add<!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR NAME="surname" --> 
Lines 731-737 Link Here
731
	  <!-- TMPL_IF NAME="mandatorybranchcode" --><span class="required">Required</span><!-- /TMPL_IF -->
735
	  <!-- TMPL_IF NAME="mandatorybranchcode" --><span class="required">Required</span><!-- /TMPL_IF -->
732
    </li>
736
    </li>
733
    <li>
737
    <li>
734
    <!-- TMPL_IF NAME="typeloop" -->
735
        <label for="categorycode">Category: </label>
738
        <label for="categorycode">Category: </label>
736
        <select id="categorycode" name="categorycode">
739
        <select id="categorycode" name="categorycode">
737
        <!-- TMPL_LOOP NAME="typeloop" -->
740
        <!-- TMPL_LOOP NAME="typeloop" -->
Lines 755-764 Link Here
755
            <!-- /TMPL_LOOP -->
758
            <!-- /TMPL_LOOP -->
756
       <!-- /TMPL_LOOP -->
759
       <!-- /TMPL_LOOP -->
757
       </select>
760
       </select>
758
    <!-- TMPL_ELSE -->
759
        <span class="problem">There is no category type to add <!--TMPL_IF Name="A"-->an Adult<!--/TMPL_IF--><!--TMPL_IF Name="C"-->a Child<!--/TMPL_IF--><!--TMPL_IF Name="I"-->an Institution<!--/TMPL_IF--><!--TMPL_IF Name="P"-->a Professional<!--/TMPL_IF--><!--TMPL_IF Name="S"-->a Staff Member<!--/TMPL_IF-->.</span>
760
              <a href="/cgi-bin/koha/admin/categorie.pl">Please create one</a>
761
    <!-- /TMPL_IF -->
762
    </li>
761
    </li>
763
    <li>
762
    <li>
764
      <!-- TMPL_IF NAME="mandatorysort1" -->
763
      <!-- TMPL_IF NAME="mandatorysort1" -->
Lines 1070-1075 Link Here
1070
<!-- TMPL_UNLESS NAME="opadd" --><div class="yui-b">
1069
<!-- TMPL_UNLESS NAME="opadd" --><div class="yui-b">
1071
<!-- TMPL_INCLUDE NAME="members-menu.inc" -->
1070
<!-- TMPL_INCLUDE NAME="members-menu.inc" -->
1072
</div><!-- /TMPL_UNLESS -->
1071
</div><!-- /TMPL_UNLESS -->
1072
<!-- /TMPL_UNLESS -->
1073
</div>
1073
</div>
1074
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
1074
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
1075
1075
(-)a/members/memberentry.pl (-6 / +22 lines)
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
(-)a/members/members-home.pl (-6 / +22 lines)
Lines 63-75 foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} Link Here
63
  push @branchloop, \%row;
63
  push @branchloop, \%row;
64
}
64
}
65
65
66
my @categories=C4::Category->all;
66
my @categories;
67
$template->param(
67
my $no_categories;
68
    branchloop=>\@branchloop,
68
my $no_add = 0;
69
	categories=>\@categories,
69
my $branchloop = (defined $branch?GetBranchesLoop($branch):GetBranchesLoop());
70
);
70
if(scalar(@$branchloop) < 1){
71
    $no_add = 1;
72
    $template->param(no_branches => 1);
73
} else {
74
    $template->param(branchloop=>\@$branchloop);
75
}
76
77
@categories=C4::Category->all;
78
if(scalar(@categories) < 1){ $no_categories = 1; }
79
if($no_categories && C4::Context->preference("AddPatronLists")=~/code/){
80
    $no_add = 1;
81
    $template->param(no_categories => 1);
82
} else {
83
    $template->param(categories=>\@categories);
84
}
85
86
71
$template->param( 
87
$template->param( 
72
        "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
88
        "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
89
        no_add => $no_add,
73
            );
90
            );
74
my @letters = map { {letter => $_} } ( 'A' .. 'Z');
91
my @letters = map { {letter => $_} } ( 'A' .. 'Z');
75
$template->param( letters => \@letters );
92
$template->param( letters => \@letters );
76
- 

Return to bug 3319