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
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/members.js"></script>
5
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/members.js"></script>
6
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
6
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
Lines 70-76 Link Here
70
	<div id="yui-main">
70
	<div id="yui-main">
71
	<div class="yui-b">
71
	<div class="yui-b">
72
72
73
	<!-- TMPL_IF NAME="no_add" --><div class="dialog alert"><h3>Cannot add patron</h3>
74
		<!-- 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 -->
75
		<!-- 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 -->
73
76
77
	<!-- TMPL_UNLESS NAME="no_add" -->
74
	<!-- TMPL_IF NAME="opadd" -->
78
	<!-- TMPL_IF NAME="opadd" -->
75
	<h1>
79
	<h1>
76
		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" --> 
80
		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 728-734 Link Here
728
	  <!-- TMPL_IF NAME="mandatorybranchcode" --><span class="required">Required</span><!-- /TMPL_IF -->
732
	  <!-- TMPL_IF NAME="mandatorybranchcode" --><span class="required">Required</span><!-- /TMPL_IF -->
729
    </li>
733
    </li>
730
    <li>
734
    <li>
731
    <!-- TMPL_IF NAME="typeloop" -->
732
        <label for="categorycode">Category: </label>
735
        <label for="categorycode">Category: </label>
733
        <select id="categorycode" name="categorycode">
736
        <select id="categorycode" name="categorycode">
734
        <!-- TMPL_LOOP NAME="typeloop" -->
737
        <!-- TMPL_LOOP NAME="typeloop" -->
Lines 748-757 Link Here
748
        </optgroup>
751
        </optgroup>
749
        <!-- /TMPL_LOOP -->
752
        <!-- /TMPL_LOOP -->
750
		</select>
753
		</select>
751
    <!-- TMPL_ELSE -->
752
        <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 professionnal<!--/TMPL_IF--><!--TMPL_IF Name="S"-->a Staff Member<!--/TMPL_IF-->.</span>
753
              <a href="/cgi-bin/koha/admin/categorie.pl">Please create one</a>
754
    <!-- /TMPL_IF -->
755
    </li>
754
    </li>
756
    <li>
755
    <li>
757
      <!-- TMPL_IF NAME="mandatorysort1" -->
756
      <!-- TMPL_IF NAME="mandatorysort1" -->
Lines 1063-1067 Link Here
1063
<!-- TMPL_UNLESS NAME="opadd" --><div class="yui-b">
1062
<!-- TMPL_UNLESS NAME="opadd" --><div class="yui-b">
1064
<!-- TMPL_INCLUDE NAME="members-menu.inc" -->
1063
<!-- TMPL_INCLUDE NAME="members-menu.inc" -->
1065
</div><!-- /TMPL_UNLESS -->
1064
</div><!-- /TMPL_UNLESS -->
1065
<!-- /TMPL_UNLESS -->
1066
</div>
1066
</div>
1067
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
1067
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
(-)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 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
(-)a/members/members-home.pl (-6 / +21 lines)
Lines 51-63 if($quicksearch){ Link Here
51
                 debug => 1,
51
                 debug => 1,
52
                 });
52
                 });
53
}
53
}
54
my @categories=C4::Category->all;
54
my @categories;
55
$template->param(
55
my $no_categories;
56
    branchloop=>(defined $branch?GetBranchesLoop($branch):GetBranchesLoop()),
56
my $no_add = 0;
57
	categories=>\@categories,
57
my $branchloop = (defined $branch?GetBranchesLoop($branch):GetBranchesLoop());
58
);
58
if(scalar(@$branchloop) < 1){
59
    $no_add = 1;
60
    $template->param(no_branches => 1);
61
} else {
62
    $template->param(branchloop=>\@$branchloop);
63
}
64
65
@categories=C4::Category->all;
66
if(scalar(@categories) < 1){ $no_categories = 1; }
67
if($no_categories && C4::Context->preference("AddPatronLists")=~/code/){
68
    $no_add = 1;
69
    $template->param(no_categories => 1);
70
} else {
71
    $template->param(categories=>\@categories);
72
}
73
59
$template->param( 
74
$template->param( 
60
        "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
75
        "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
76
        no_add => $no_add,
61
            );
77
            );
62
my @letters = map { {letter => $_} } ( 'A' .. 'Z');
78
my @letters = map { {letter => $_} } ( 'A' .. 'Z');
63
$template->param( letters => \@letters );
79
$template->param( letters => \@letters );
64
- 

Return to bug 3319