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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-18 / +24 lines)
Lines 929-954 legend:hover { Link Here
929
                                        <li>
929
                                        <li>
930
                                            <label for="categorycode_entry" class="required">Category: </label>
930
                                            <label for="categorycode_entry" class="required">Category: </label>
931
                                            <select id="categorycode_entry" name="categorycode">
931
                                            <select id="categorycode_entry" name="categorycode">
932
                                                [% FOREACH typeloo IN typeloop %]
932
                                                [% FOREACH category_type IN patron_categories.keys %]
933
                                                    [% FOREACH categoryloo IN typeloo.categoryloop %]
933
                                                    [% SWITCH category_type %]
934
                                                        [% IF ( loop.first ) %]
934
                                                    [% CASE 'C' %]
935
                                                            [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
935
                                                        <optgroup label="Child">
936
                                                            [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
936
                                                    [% CASE 'A' %]
937
                                                            [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
937
                                                        <optgroup label="Adult">
938
                                                            [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
938
                                                    [% CASE 'S' %]
939
                                                            [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
939
                                                        <optgroup label="Staff">
940
                                                            [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
940
                                                    [% CASE 'I' %]
941
                                                        [% END %]
941
                                                        <optgroup label="Organization">
942
                                                        [% IF ( categoryloo.categorycodeselected ) %]
942
                                                    [% CASE 'P' %]
943
                                                            <option value="[% categoryloo.categorycode | html %]" selected="selected" data-pwd-length="[% categoryloo.effective_min_password_length | html %]" data-pwd-strong="[% categoryloo.effective_require_strong_password | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
943
                                                        <optgroup label="Professional">
944
                                                    [% CASE 'X' %]
945
                                                        <optgroup label="Statistical">
946
                                                    [% CASE %]
947
                                                        <optgroup label="Unknown">
948
                                                    [% END %]
949
                                                    [% FOREACH category IN patron_categories.$category_type %]
950
                                                        [% IF category.categorycode == patron_category.categorycode %]
951
                                                            <option value="[% category.categorycode | html %]" selected="selected" data-pwd-length="[% category.effective_min_password_length | html %]" data-pwd-strong="[% category.effective_require_strong_password | html %]" data-typename="[% category_type | html %]">[% category.description | html %]</option>
944
                                                        [% ELSE %]
952
                                                        [% ELSE %]
945
                                                            <option value="[% categoryloo.categorycode | html %]" data-pwd-length="[% categoryloo.effective_min_password_length | html %]" data-pwd-strong="[% categoryloo.effective_require_strong_password | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
953
                                                            <option value="[% category.categorycode | html %]" data-pwd-length="[% category.effective_min_password_length | html %]" data-pwd-strong="[% category.effective_require_strong_password | html %]" data-typename="[% category_type | html %]">[% category.description | html %]</option>
946
                                                        [% END %]
947
                                                        [% IF ( loop.last ) %]
948
                                                            </optgroup>
949
                                                        [% END %]
954
                                                        [% END %]
950
                                                    [% END # /FOREACH categoryloo %]
955
                                                    [% END %]
951
                                                [% END # /FOREACH typeloo %]
956
                                                        </optgroup>
957
                                                [% END %]
952
                                            </select>
958
                                            </select>
953
                                            <span class="required">Required</span>
959
                                            <span class="required">Required</span>
954
                                        </li>
960
                                        </li>
(-)a/members/memberentry.pl (-32 / +14 lines)
Lines 667-705 if(!defined($data{'sex'})){ Link Here
667
667
668
##Now all the data to modify a member.
668
##Now all the data to modify a member.
669
669
670
my @typeloop;
670
my $patron_categories = Koha::Patron::Categories->search_with_library_limits(
671
my $no_categories = 1;
671
    {
672
my $no_add;
672
        category_type => [qw(C A S P I X)],
673
foreach my $category_type (qw(C A S P I X)) {
673
        ( $guarantor_id ? ( can_be_guarantee => 1 ) : () )
674
    my $categories_limits = { category_type => $category_type };
674
    },
675
    $categories_limits->{can_be_guarantee} = 1 if ($guarantor_id);
675
    { order_by => ['categorycode'] }
676
    my $patron_categories = Koha::Patron::Categories->search_with_library_limits( $categories_limits, {order_by => ['categorycode']} );
676
);
677
    $no_categories = 0 if $patron_categories->count > 0;
677
my $no_categories = ! $patron_categories->count;
678
678
my $categories = {};
679
    my @categoryloop;
679
foreach my $patron_category ($patron_categories->as_list ) {
680
    while ( my $patron_category = $patron_categories->next ) {
680
    push @{ $categories->{ $patron_category->category_type } }, $patron_category;
681
        $categorycode = $patron_category->categorycode unless defined($categorycode); #If none passed in, select the first
682
        push @categoryloop,
683
          { 'categorycode' => $patron_category->categorycode,
684
            'categoryname' => $patron_category->description,
685
            'effective_min_password_length' => $patron_category->effective_min_password_length,
686
            'effective_require_strong_password' => $patron_category->effective_require_strong_password,
687
            'categorycodeselected' =>
688
              ( $patron_category->categorycode eq $categorycode ),
689
          };
690
    }
691
    my %typehash;
692
    $typehash{'typename'} = $category_type;
693
    my $typedescription = "typename_" . $typehash{'typename'};
694
    $typehash{'categoryloop'} = \@categoryloop;
695
    push @typeloop,
696
      { 'typename'       => $category_type,
697
        $typedescription => 1,
698
        'categoryloop'   => \@categoryloop
699
      };
700
}
681
}
682
701
$template->param(
683
$template->param(
702
    typeloop      => \@typeloop,
684
    patron_categories => $categories,
703
    no_categories => $no_categories,
685
    no_categories => $no_categories,
704
);
686
);
705
687
Lines 761-766 if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || Link Here
761
}
743
}
762
$template->param( userbranch => $userbranch );
744
$template->param( userbranch => $userbranch );
763
745
746
my $no_add;
764
if ( Koha::Libraries->search->count < 1 ){
747
if ( Koha::Libraries->search->count < 1 ){
765
    $no_add = 1;
748
    $no_add = 1;
766
    $template->param(no_branches => 1);
749
    $template->param(no_branches => 1);
767
- 

Return to bug 30874