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

(-)a/Koha/Patron/Attribute/Type.pm (+22 lines)
Lines 60-65 sub attributes { Link Here
60
    Koha::Patron::Attributes->_new_from_dbic($attributes_rs);
60
    Koha::Patron::Attributes->_new_from_dbic($attributes_rs);
61
}
61
}
62
62
63
=head3 categories
64
65
Get or set attribute type's categories
66
67
    my @categories = $attribute_type->categories->as_list;
68
    $attribute_type->categories(\@categories);
69
70
=cut
71
72
sub categories {
73
    my ($self, $categories) = @_;
74
75
    if ($categories) {
76
        my @categorycodes = map { $_->_result } @$categories;
77
        $self->_result->set_categorycodes(\@categorycodes);
78
        return $self;
79
    }
80
81
    my $rs = $self->_result->categorycodes;
82
    return Koha::Patron::Categories->_new_from_dbic($rs);
83
}
84
63
=head2 Internal Methods
85
=head2 Internal Methods
64
86
65
=cut
87
=cut
(-)a/admin/patron-attr-types.pl (-2 / +6 lines)
Lines 121-127 sub add_update_attribute_type { Link Here
121
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
121
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
122
    my $authorised_value_category = $input->param('authorised_value_category');
122
    my $authorised_value_category = $input->param('authorised_value_category');
123
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
123
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
124
    my $category_code             = $input->param('category_code') || undef;
125
    my $class                     = $input->param('class');
124
    my $class                     = $input->param('class');
126
125
127
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
126
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
Lines 156-162 sub add_update_attribute_type { Link Here
156
            mandatory                 => $mandatory,
155
            mandatory                 => $mandatory,
157
            authorised_value_category => $authorised_value_category,
156
            authorised_value_category => $authorised_value_category,
158
            display_checkout          => $display_checkout,
157
            display_checkout          => $display_checkout,
159
            category_code             => $category_code,
160
            class                     => $class,
158
            class                     => $class,
161
        }
159
        }
162
    )->store;
160
    )->store;
Lines 164-169 sub add_update_attribute_type { Link Here
164
    my @branches = grep { ! /^\s*$/ } $input->multi_param('branches');
162
    my @branches = grep { ! /^\s*$/ } $input->multi_param('branches');
165
    $attr_type->library_limits( \@branches );
163
    $attr_type->library_limits( \@branches );
166
164
165
    my @categories = grep { ! /^\s*$/ } $input->multi_param('category_code');
166
    $attr_type->categories([
167
        Koha::Patron::Categories->search({ categorycode => \@categories })->as_list
168
    ]);
169
167
    if ( $op eq 'edit' ) {
170
    if ( $op eq 'edit' ) {
168
        $template->param( edited_attribute_type => $attr_type->code() );
171
        $template->param( edited_attribute_type => $attr_type->code() );
169
    }
172
    }
Lines 236-241 sub edit_attribute_type_form { Link Here
236
        $can_be_set_to_unique = 0 if $@;
239
        $can_be_set_to_unique = 0 if $@;
237
        $attr_type->unique_id(0);
240
        $attr_type->unique_id(0);
238
    }
241
    }
242
239
    $template->param(
243
    $template->param(
240
        attribute_type => $attr_type,
244
        attribute_type => $attr_type,
241
        attribute_type_form => 1,
245
        attribute_type_form => 1,
(-)a/installer/data/mysql/atomicupdate/bug-26573.pl (+45 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => '26573',
5
    description => 'Add table borrower_attribute_types_categories',
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{
11
            CREATE TABLE IF NOT EXISTS `borrower_attribute_types_categories` (
12
                `borrower_attribute_type_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
13
                `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
14
                KEY `borrower_attribute_type_code` (`borrower_attribute_type_code`),
15
                KEY `categorycode` (`categorycode`),
16
                CONSTRAINT `borrower_attribute_types_categories_borrower_attribute_type_code` FOREIGN KEY (`borrower_attribute_type_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
17
                CONSTRAINT `borrower_attribute_types_categories_categorycode` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
18
                PRIMARY KEY (`borrower_attribute_type_code`, `categorycode`)
19
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
20
        });
21
22
        say $out "Table 'borrower_attribute_types_categories' created";
23
24
        if (column_exists('borrower_attribute_types', 'category_code')) {
25
            $dbh->do(q{
26
                INSERT IGNORE INTO borrower_attribute_types_categories (borrower_attribute_type_code, categorycode)
27
                SELECT `code`, `category_code` FROM `borrower_attribute_types`
28
                WHERE `category_code` IS NOT NULL
29
            });
30
31
            say $out "Data migrated from 'borrower_attribute_types.category_code' to 'borrower_attribute_types_categories'";
32
33
            $dbh->do(q{
34
                ALTER TABLE `borrower_attribute_types`
35
                DROP FOREIGN KEY `borrower_attribute_types_ibfk_1`
36
            });
37
            $dbh->do(q{
38
                ALTER TABLE `borrower_attribute_types`
39
                DROP COLUMN `category_code`
40
            });
41
42
            say $out "Column 'borrower_attribute_types.category_code' deleted";
43
        }
44
    },
45
};
(-)a/installer/data/mysql/kohastructure.sql (-3 / +18 lines)
Lines 1128-1141 CREATE TABLE `borrower_attribute_types` ( Link Here
1128
  `staff_searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is searchable via the patron search in the staff interface (1 for yes, 0 for no)',
1128
  `staff_searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is searchable via the patron search in the staff interface (1 for yes, 0 for no)',
1129
  `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1129
  `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1130
  `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1130
  `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1131
  `category_code` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1132
  `class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1131
  `class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1133
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1132
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1134
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1133
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1135
  PRIMARY KEY (`code`),
1134
  PRIMARY KEY (`code`),
1136
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1135
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1137
  KEY `category_code` (`category_code`),
1138
  CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1139
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1136
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1140
/*!40101 SET character_set_client = @saved_cs_client */;
1137
/*!40101 SET character_set_client = @saved_cs_client */;
1141
1138
Lines 1156-1161 CREATE TABLE `borrower_attribute_types_branches` ( Link Here
1156
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1153
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1157
/*!40101 SET character_set_client = @saved_cs_client */;
1154
/*!40101 SET character_set_client = @saved_cs_client */;
1158
1155
1156
--
1157
-- Table structure for table `borrower_attribute_types_categories`
1158
--
1159
1160
DROP TABLE IF EXISTS `borrower_attribute_types_categories`;
1161
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1162
/*!40101 SET character_set_client = utf8 */;
1163
CREATE TABLE `borrower_attribute_types_categories` (
1164
  `borrower_attribute_type_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1165
  `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1166
  KEY `borrower_attribute_type_code` (`borrower_attribute_type_code`),
1167
  KEY `categorycode` (`categorycode`),
1168
  CONSTRAINT `borrower_attribute_types_categories_borrower_attribute_type_code` FOREIGN KEY (`borrower_attribute_type_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
1169
  CONSTRAINT `borrower_attribute_types_categories_categorycode` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1170
  PRIMARY KEY (`borrower_attribute_type_code`, `categorycode`)
1171
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1172
/*!40101 SET character_set_client = @saved_cs_client */;
1173
1159
--
1174
--
1160
-- Table structure for table `borrower_attributes`
1175
-- Table structure for table `borrower_attributes`
1161
--
1176
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-5 / +20 lines)
Lines 221-233 Patron attribute types › Administration › Koha Link Here
221
        </li>
221
        </li>
222
        <li>
222
        <li>
223
            <label for="category">Category: </label>
223
            <label for="category">Category: </label>
224
            <select name="category_code" id="category">
224
            <select name="category_code" id="category" multiple size="10">
225
                <option value=""></option>
225
                <option value="">All categories</option>
226
                [% FOREACH cat IN categories %]
226
                [% FOREACH category IN categories %]
227
                    [% IF ( cat.categorycode == attribute_type.category_code ) %]<option value="[% cat.categorycode | html %]" selected="selected">[% cat.description |html %]</option>[% ELSE %]<option value="[% cat.categorycode | html %]">[% cat.description |html %]</option>[% END %]
227
                    [% SET selected = 0 %]
228
                    [% IF attribute_type %]
229
                        [% FOREACH cat IN attribute_type.categories %]
230
                            [% IF cat.categorycode == category.categorycode %]
231
                                [% SET selected = 1 %]
232
                            [% END %]
233
                        [% END %]
234
                    [% END %]
235
                    [% IF selected %]
236
                        <option value="[% category.categorycode | html %]" selected>[% category.description |html %]</option>
237
                    [% ELSE %]
238
                        <option value="[% category.categorycode | html %]">[% category.description |html %]</option>
239
                    [% END %]
228
                [% END %]
240
                [% END %]
229
            </select>
241
            </select>
230
            <div class="hint">Choose one to limit this attribute to one patron type. Please leave blank if you want these attributes to be available for all types of patrons.</div>
242
            <div class="hint">Select "All categories" if this attribute type should always be displayed. Otherwise select categories you want to associate with this value.</div>
231
        </li>
243
        </li>
232
        <li>
244
        <li>
233
            <label for="class">Class: </label>
245
            <label for="class">Class: </label>
Lines 375-380 Patron attribute types &rsaquo; Administration &rsaquo; Koha Link Here
375
            if ( $("#branches option:selected").length < 1 ) {
387
            if ( $("#branches option:selected").length < 1 ) {
376
                $("#branches option:first").attr("selected", "selected");
388
                $("#branches option:first").attr("selected", "selected");
377
            }
389
            }
390
            if ( $("#category option:selected").length < 1 ) {
391
                $("#category option:first").attr("selected", "selected");
392
            }
378
393
379
            $("#opac_display").change( function() {
394
            $("#opac_display").change( function() {
380
                if ( this.checked ) {
395
                if ( this.checked ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 1486-1492 legend:hover { Link Here
1486
                                                        <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1486
                                                        <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1487
                                                    [% END %]
1487
                                                    [% END %]
1488
                                                    [% FOREACH patron_attribute IN pa_loo.items %]
1488
                                                    [% FOREACH patron_attribute IN pa_loo.items %]
1489
                                                        <li data-category_code="[% patron_attribute.category_code | html %]">
1489
                                                        <li data-category_code="[% patron_attribute.categorycodes.join(' ') | html %]">
1490
                                                            [% IF patron_attribute.mandatory %]
1490
                                                            [% IF patron_attribute.mandatory %]
1491
                                                                <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1491
                                                                <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1492
                                                            [% ELSE %]
1492
                                                            [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-1 / +1 lines)
Lines 245-251 Link Here
245
                    </tr>
245
                    </tr>
246
                [% END %]
246
                [% END %]
247
            [% FOREACH patron_attribute IN pa_loo.items %]
247
            [% FOREACH patron_attribute IN pa_loo.items %]
248
                <tr data-category_code="[% patron_attribute.category_code | html %]">
248
                <tr>
249
                    <td>
249
                    <td>
250
                        [% patron_attribute.code | html %]
250
                        [% patron_attribute.code | html %]
251
                        ([% patron_attribute.description | html %])
251
                        ([% patron_attribute.description | html %])
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt (-1 / +1 lines)
Lines 515-521 Link Here
515
            information_category_node.html("");
515
            information_category_node.html("");
516
516
517
            if ( category && category.length > 0 ) {
517
            if ( category && category.length > 0 ) {
518
                information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
518
                information_category_node.html(_("This attribute will be only applied to the following patron categories: %s").format(category));
519
            }
519
            }
520
            var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
520
            var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
521
            if ( type == 'select' ) {
521
            if ( type == 'select' ) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (-1 / +1 lines)
Lines 66-72 function update_category_code(category_code) { Link Here
66
    }
66
    }
67
    var mytables = $(".attributes_table");
67
    var mytables = $(".attributes_table");
68
    $(mytables).find("li").hide();
68
    $(mytables).find("li").hide();
69
    $(mytables).find(" li[data-category_code='"+category_code+"']").show();
69
    $(mytables).find(" li[data-category_code~='"+category_code+"']").show();
70
    $(mytables).find(" li[data-category_code='']").show();
70
    $(mytables).find(" li[data-category_code='']").show();
71
71
72
    //Change password length hint
72
    //Change password length hint
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-1 / +1 lines)
Lines 911-917 Link Here
911
                                                [% FOREACH pa_value IN pa.values %]
911
                                                [% FOREACH pa_value IN pa.values %]
912
                                                    [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
912
                                                    [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
913
                                                    [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
913
                                                    [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
914
                                                    <li data-category_code="[% pa.type.category_code | html %]">
914
                                                    <li>
915
                                                        [% IF pa.type.mandatory && pa.type.opac_editable %]
915
                                                        [% IF pa.type.mandatory && pa.type.opac_editable %]
916
                                                            <label for="[% form_id | html %]" class="required">[% pa.type.description | html %]: </label>
916
                                                            <label for="[% form_id | html %]" class="required">[% pa.type.description | html %]: </label>
917
                                                        [% ELSE %]
917
                                                        [% ELSE %]
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 881-887 sub patron_attributes_form { Link Here
881
            description       => $attr_type->description(),
881
            description       => $attr_type->description(),
882
            repeatable        => $attr_type->repeatable(),
882
            repeatable        => $attr_type->repeatable(),
883
            category          => $attr_type->authorised_value_category(),
883
            category          => $attr_type->authorised_value_category(),
884
            category_code     => $attr_type->category_code(),
884
            categorycodes     => [ map { $_->categorycode } $attr_type->categories->as_list ],
885
            mandatory         => $attr_type->mandatory(),
885
            mandatory         => $attr_type->mandatory(),
886
        };
886
        };
887
        if (exists $attr_hash{$attr_type->code()}) {
887
        if (exists $attr_hash{$attr_type->code()}) {
(-)a/reports/borrowers_stats.pl (-1 lines)
Lines 486-492 sub patron_attributes_form { Link Here
486
            description       => $attr_type->description(),
486
            description       => $attr_type->description(),
487
            repeatable        => $attr_type->repeatable(),
487
            repeatable        => $attr_type->repeatable(),
488
            category          => $attr_type->authorised_value_category(),
488
            category          => $attr_type->authorised_value_category(),
489
            category_code     => $attr_type->category_code(),
490
        };
489
        };
491
490
492
        my $newentry = { %$entry };
491
        my $newentry = { %$entry };
(-)a/t/db_dependent/Auth_with_ldap.t (-6 lines)
Lines 79-95 my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; Link Here
79
my $attr_type    = $builder->build(
79
my $attr_type    = $builder->build(
80
    {
80
    {
81
        source => 'BorrowerAttributeType',
81
        source => 'BorrowerAttributeType',
82
        value  => {
83
            category_code => $categorycode
84
        }
85
    }
82
    }
86
);
83
);
87
my $attr_type2    = $builder->build(
84
my $attr_type2    = $builder->build(
88
    {
85
    {
89
        source => 'BorrowerAttributeType',
86
        source => 'BorrowerAttributeType',
90
        value  => {
91
            category_code => $categorycode
92
        }
93
    }
87
    }
94
);
88
);
95
89
(-)a/t/db_dependent/Koha/Patron/Attribute.t (-1 lines)
Lines 230-236 subtest 'store() tests' => sub { Link Here
230
                    mandatory     => 0,
230
                    mandatory     => 0,
231
                    repeatable    => 0,
231
                    repeatable    => 0,
232
                    unique_id     => 1,
232
                    unique_id     => 1,
233
                    category_code => undef
234
                }
233
                }
235
            }
234
            }
236
        );
235
        );
(-)a/t/db_dependent/Koha/Patron/Attribute/Type.t (+35 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
5
use Test::More;
6
use Koha::Database;
7
use t::lib::TestBuilder;
8
9
plan tests => 2;
10
11
my $schema  = Koha::Database->new->schema;
12
my $builder = t::lib::TestBuilder->new;
13
14
use_ok('Koha::Patron::Attribute::Type');
15
16
subtest 'categories' => sub {
17
    plan tests => 1;
18
19
    $schema->storage->txn_begin;
20
21
    my $category1 = $builder->build_object( { class => 'Koha::Patron::Categories' } );
22
    my $category2 = $builder->build_object( { class => 'Koha::Patron::Categories' } );
23
    Koha::Patron::Attribute::Types->delete();
24
    my $attribute_type = Koha::Patron::Attribute::Type->new({
25
        code => 'TEST',
26
        description => 'Test attribute type',
27
    });
28
    $attribute_type->store();
29
    $attribute_type->categories([ $category1, $category2 ]);
30
    $attribute_type->store();
31
    my @categories = $attribute_type->categories->as_list;
32
    is (scalar @categories, 2);
33
34
    $schema->storage->txn_rollback;
35
};
(-)a/t/db_dependent/Koha/Patron/Attribute/Types.t (-5 / +1 lines)
Lines 52-64 subtest 'new() tests' => sub { Link Here
52
    is( Koha::Patron::Attribute::Types->search()->count,
52
    is( Koha::Patron::Attribute::Types->search()->count,
53
        1, 'Only one object created' );
53
        1, 'Only one object created' );
54
54
55
    my $cateogory_code
55
    my $attribute_type_2 = Koha::Patron::Attribute::Type->new(
56
        = $builder->build( { source => 'Category' } )->{categorycode};
57
58
    my $attribute_type_with_category = Koha::Patron::Attribute::Type->new(
59
        {   code          => 'code_2',
56
        {   code          => 'code_2',
60
            description   => 'description',
57
            description   => 'description',
61
            category_code => $cateogory_code,
62
            repeatable    => 0
58
            repeatable    => 0
63
        }
59
        }
64
    )->store();
60
    )->store();
(-)a/t/db_dependent/api/v1/patrons.t (-2 lines)
Lines 503-509 subtest 'add() tests' => sub { Link Here
503
                        mandatory     => 0,
503
                        mandatory     => 0,
504
                        repeatable    => 1,
504
                        repeatable    => 1,
505
                        unique        => 0,
505
                        unique        => 0,
506
                        category_code => 'ST'
507
                    }
506
                    }
508
                }
507
                }
509
            );
508
            );
Lines 514-520 subtest 'add() tests' => sub { Link Here
514
                        mandatory     => 0,
513
                        mandatory     => 0,
515
                        repeatable    => 1,
514
                        repeatable    => 1,
516
                        unique        => 0,
515
                        unique        => 0,
517
                        category_code => 'ST'
518
                    }
516
                    }
519
                }
517
                }
520
            );
518
            );
(-)a/t/db_dependent/api/v1/patrons_extended_attributes.t (-9 lines)
Lines 92-98 subtest 'add() tests' => sub { Link Here
92
                mandatory     => 1,
92
                mandatory     => 1,
93
                repeatable    => 0,
93
                repeatable    => 0,
94
                unique_id     => 0,
94
                unique_id     => 0,
95
                category_code => undef
96
            }
95
            }
97
        }
96
        }
98
    );
97
    );
Lines 103-109 subtest 'add() tests' => sub { Link Here
103
                mandatory     => 0,
102
                mandatory     => 0,
104
                repeatable    => 1,
103
                repeatable    => 1,
105
                unique_id     => 0,
104
                unique_id     => 0,
106
                category_code => undef
107
            }
105
            }
108
        }
106
        }
109
    );
107
    );
Lines 114-120 subtest 'add() tests' => sub { Link Here
114
                mandatory     => 0,
112
                mandatory     => 0,
115
                repeatable    => 0,
113
                repeatable    => 0,
116
                unique_id     => 1,
114
                unique_id     => 1,
117
                category_code => undef
118
            }
115
            }
119
        }
116
        }
120
    );
117
    );
Lines 221-227 subtest 'overwrite() tests' => sub { Link Here
221
                mandatory     => 1,
218
                mandatory     => 1,
222
                repeatable    => 0,
219
                repeatable    => 0,
223
                unique_id     => 0,
220
                unique_id     => 0,
224
                category_code => undef
225
            }
221
            }
226
        }
222
        }
227
    );
223
    );
Lines 232-238 subtest 'overwrite() tests' => sub { Link Here
232
                mandatory     => 0,
228
                mandatory     => 0,
233
                repeatable    => 1,
229
                repeatable    => 1,
234
                unique_id     => 0,
230
                unique_id     => 0,
235
                category_code => undef
236
            }
231
            }
237
        }
232
        }
238
    );
233
    );
Lines 243-249 subtest 'overwrite() tests' => sub { Link Here
243
                mandatory     => 0,
238
                mandatory     => 0,
244
                repeatable    => 0,
239
                repeatable    => 0,
245
                unique_id     => 1,
240
                unique_id     => 1,
246
                category_code => undef
247
            }
241
            }
248
        }
242
        }
249
    );
243
    );
Lines 369-375 subtest 'delete() tests' => sub { Link Here
369
                mandatory     => 0,
363
                mandatory     => 0,
370
                repeatable    => 1,
364
                repeatable    => 1,
371
                unique_id     => 0,
365
                unique_id     => 0,
372
                category_code => undef
373
            }
366
            }
374
        }
367
        }
375
    );
368
    );
Lines 418-424 subtest 'update() tests' => sub { Link Here
418
                mandatory     => 0,
411
                mandatory     => 0,
419
                repeatable    => 1,
412
                repeatable    => 1,
420
                unique_id     => 0,
413
                unique_id     => 0,
421
                category_code => undef
422
            }
414
            }
423
        }
415
        }
424
    );
416
    );
Lines 429-435 subtest 'update() tests' => sub { Link Here
429
                mandatory     => 0,
421
                mandatory     => 0,
430
                repeatable    => 0,
422
                repeatable    => 0,
431
                unique_id     => 1,
423
                unique_id     => 1,
432
                category_code => undef
433
            }
424
            }
434
        }
425
        }
435
    );
426
    );
(-)a/tools/modborrowers.pl (-5 / +2 lines)
Lines 149-158 if ( $op eq 'show' ) { Link Here
149
                options        => $options,
149
                options        => $options,
150
            };
150
            };
151
151
152
        my $category_code = $attr_type->category_code;
152
        my @categories = $attr_type->categories->as_list;
153
        my ( $category_lib ) = map {
153
        my ( $category_lib ) = join(', ',  map { $_->description } @categories);
154
            ( defined $category_code and $attr_type->category_code eq $category_code ) ? $attr_type->description : ()
155
        } @patron_categories;
156
        push @patron_attributes_codes,
154
        push @patron_attributes_codes,
157
            {
155
            {
158
                attribute_code => $attr_type->code,
156
                attribute_code => $attr_type->code,
159
- 

Return to bug 26573