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 122-128 sub add_update_attribute_type { Link Here
122
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
122
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
123
    my $authorised_value_category = $input->param('authorised_value_category');
123
    my $authorised_value_category = $input->param('authorised_value_category');
124
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
124
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
125
    my $category_code             = $input->param('category_code') || undef;
126
    my $class                     = $input->param('class');
125
    my $class                     = $input->param('class');
127
126
128
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
127
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
Lines 158-164 sub add_update_attribute_type { Link Here
158
            mandatory                 => $mandatory,
157
            mandatory                 => $mandatory,
159
            authorised_value_category => $authorised_value_category,
158
            authorised_value_category => $authorised_value_category,
160
            display_checkout          => $display_checkout,
159
            display_checkout          => $display_checkout,
161
            category_code             => $category_code,
162
            class                     => $class,
160
            class                     => $class,
163
        }
161
        }
164
    )->store;
162
    )->store;
Lines 166-171 sub add_update_attribute_type { Link Here
166
    my @branches = grep { ! /^\s*$/ } $input->multi_param('branches');
164
    my @branches = grep { ! /^\s*$/ } $input->multi_param('branches');
167
    $attr_type->library_limits( \@branches );
165
    $attr_type->library_limits( \@branches );
168
166
167
    my @categories = grep { ! /^\s*$/ } $input->multi_param('category_code');
168
    $attr_type->categories([
169
        Koha::Patron::Categories->search({ categorycode => \@categories })->as_list
170
    ]);
171
169
    if ( $op eq 'edit' ) {
172
    if ( $op eq 'edit' ) {
170
        $template->param( edited_attribute_type => $attr_type->code() );
173
        $template->param( edited_attribute_type => $attr_type->code() );
171
    }
174
    }
Lines 238-243 sub edit_attribute_type_form { Link Here
238
        $can_be_set_to_unique = 0 if $@;
241
        $can_be_set_to_unique = 0 if $@;
239
        $attr_type->unique_id(0);
242
        $attr_type->unique_id(0);
240
    }
243
    }
244
241
    $template->param(
245
    $template->param(
242
        attribute_type => $attr_type,
246
        attribute_type => $attr_type,
243
        attribute_type_form => 1,
247
        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 (-4 / +19 lines)
Lines 1237-1250 CREATE TABLE `borrower_attribute_types` ( Link Here
1237
  `searched_by_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is included in "Standard" patron searches in the staff interface (1 for yes, 0 for no)',
1237
  `searched_by_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is included in "Standard" patron searches in the staff interface (1 for yes, 0 for no)',
1238
  `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1238
  `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category',
1239
  `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1239
  `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens',
1240
  `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type',
1241
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1240
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1242
  `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)',
1241
  `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)',
1243
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1242
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1244
  PRIMARY KEY (`code`),
1243
  PRIMARY KEY (`code`),
1245
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1244
  KEY `auth_val_cat_idx` (`authorised_value_category`)
1246
  KEY `category_code` (`category_code`),
1247
  CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1248
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1245
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1249
/*!40101 SET character_set_client = @saved_cs_client */;
1246
/*!40101 SET character_set_client = @saved_cs_client */;
1250
1247
Lines 1265-1270 CREATE TABLE `borrower_attribute_types_branches` ( Link Here
1265
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1262
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1266
/*!40101 SET character_set_client = @saved_cs_client */;
1263
/*!40101 SET character_set_client = @saved_cs_client */;
1267
1264
1265
--
1266
-- Table structure for table `borrower_attribute_types_categories`
1267
--
1268
1269
DROP TABLE IF EXISTS `borrower_attribute_types_categories`;
1270
/*!40101 SET @saved_cs_client     = @@character_set_client */;
1271
/*!40101 SET character_set_client = utf8 */;
1272
CREATE TABLE `borrower_attribute_types_categories` (
1273
  `borrower_attribute_type_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1274
  `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
1275
  KEY `borrower_attribute_type_code` (`borrower_attribute_type_code`),
1276
  KEY `categorycode` (`categorycode`),
1277
  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,
1278
  CONSTRAINT `borrower_attribute_types_categories_categorycode` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
1279
  PRIMARY KEY (`borrower_attribute_type_code`, `categorycode`)
1280
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1281
/*!40101 SET character_set_client = @saved_cs_client */;
1282
1268
--
1283
--
1269
-- Table structure for table `borrower_attributes`
1284
-- Table structure for table `borrower_attributes`
1270
--
1285
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-5 / +20 lines)
Lines 231-243 Link Here
231
        </li>
231
        </li>
232
        <li>
232
        <li>
233
            <label for="category">Category: </label>
233
            <label for="category">Category: </label>
234
            <select name="category_code" id="category">
234
            <select name="category_code" id="category" multiple size="10">
235
                <option value=""></option>
235
                <option value="">All categories</option>
236
                [% FOREACH cat IN categories %]
236
                [% FOREACH category IN categories %]
237
                    [% 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 %]
237
                    [% SET selected = 0 %]
238
                    [% IF attribute_type %]
239
                        [% FOREACH cat IN attribute_type.categories %]
240
                            [% IF cat.categorycode == category.categorycode %]
241
                                [% SET selected = 1 %]
242
                            [% END %]
243
                        [% END %]
244
                    [% END %]
245
                    [% IF selected %]
246
                        <option value="[% category.categorycode | html %]" selected>[% category.description |html %]</option>
247
                    [% ELSE %]
248
                        <option value="[% category.categorycode | html %]">[% category.description |html %]</option>
249
                    [% END %]
238
                [% END %]
250
                [% END %]
239
            </select>
251
            </select>
240
            <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>
252
            <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>
241
        </li>
253
        </li>
242
        <li>
254
        <li>
243
            <label for="class">Class: </label>
255
            <label for="class">Class: </label>
Lines 419-424 Link Here
419
            if ( $("#branches option:selected").length < 1 ) {
431
            if ( $("#branches option:selected").length < 1 ) {
420
                $("#branches option:first").attr("selected", "selected");
432
                $("#branches option:first").attr("selected", "selected");
421
            }
433
            }
434
            if ( $("#category option:selected").length < 1 ) {
435
                $("#category option:first").attr("selected", "selected");
436
            }
422
437
423
            $("#opac_display").change( function() {
438
            $("#opac_display").change( function() {
424
                if ( this.checked ) {
439
                if ( this.checked ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 1567-1573 legend:hover { Link Here
1567
                                                        <h3 id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</h3>
1567
                                                        <h3 id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</h3>
1568
                                                    [% END %]
1568
                                                    [% END %]
1569
                                                    [% FOREACH patron_attribute IN pa_loo.items %]
1569
                                                    [% FOREACH patron_attribute IN pa_loo.items %]
1570
                                                        <li data-category_code="[% patron_attribute.category_code | html %]" data-pa_code="[% patron_attribute.code | replace('[^a-zA-Z0-9_-]', '') %]">
1570
                                                        <li data-category_code="[% patron_attribute.categorycodes.join(' ') | html %]" data-pa_code="[% patron_attribute.code | replace('[^a-zA-Z0-9_-]', '') %]">
1571
                                                            [% IF patron_attribute.mandatory %]
1571
                                                            [% IF patron_attribute.mandatory %]
1572
                                                                <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1572
                                                                <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1573
                                                            [% ELSE %]
1573
                                                            [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-1 / +1 lines)
Lines 248-254 Link Here
248
                    </tr>
248
                    </tr>
249
                [% END %]
249
                [% END %]
250
            [% FOREACH patron_attribute IN pa_loo.items %]
250
            [% FOREACH patron_attribute IN pa_loo.items %]
251
                <tr data-category_code="[% patron_attribute.category_code | html %]">
251
                <tr>
252
                    <td>
252
                    <td>
253
                        [% patron_attribute.code | html %]
253
                        [% patron_attribute.code | html %]
254
                        ([% patron_attribute.description | html %])
254
                        ([% patron_attribute.description | html %])
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt (-1 / +1 lines)
Lines 543-549 Link Here
543
            information_category_node.html("");
543
            information_category_node.html("");
544
544
545
            if ( category && category.length > 0 ) {
545
            if ( category && category.length > 0 ) {
546
                information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
546
                information_category_node.html(_("This attribute will be only applied to the following patron categories: %s").format(category));
547
            }
547
            }
548
            var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
548
            var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
549
            if ( type == 'select' ) {
549
            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 980-986 Link Here
980
                                                [% FOREACH pa_value IN pa.values %]
980
                                                [% FOREACH pa_value IN pa.values %]
981
                                                    [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
981
                                                    [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
982
                                                    [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
982
                                                    [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
983
                                                    <li data-category_code="[% pa.type.category_code | html %]">
983
                                                    <li>
984
                                                        [% IF pa.type.mandatory && pa.type.opac_editable %]
984
                                                        [% IF pa.type.mandatory && pa.type.opac_editable %]
985
                                                            <label for="[% form_id | html %]" class="required">[% pa.type.description | html %]: </label>
985
                                                            <label for="[% form_id | html %]" class="required">[% pa.type.description | html %]: </label>
986
                                                        [% ELSE %]
986
                                                        [% ELSE %]
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 888-894 sub patron_attributes_form { Link Here
888
            description       => $attr_type->description(),
888
            description       => $attr_type->description(),
889
            repeatable        => $attr_type->repeatable(),
889
            repeatable        => $attr_type->repeatable(),
890
            category          => $attr_type->authorised_value_category(),
890
            category          => $attr_type->authorised_value_category(),
891
            category_code     => $attr_type->category_code(),
891
            categorycodes     => [ map { $_->categorycode } $attr_type->categories->as_list ],
892
            mandatory         => $attr_type->mandatory(),
892
            mandatory         => $attr_type->mandatory(),
893
        };
893
        };
894
        if (exists $attr_hash{$attr_type->code()}) {
894
        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 89-105 my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; Link Here
89
my $attr_type    = $builder->build(
89
my $attr_type    = $builder->build(
90
    {
90
    {
91
        source => 'BorrowerAttributeType',
91
        source => 'BorrowerAttributeType',
92
        value  => {
93
            category_code => $categorycode
94
        }
95
    }
92
    }
96
);
93
);
97
my $attr_type2    = $builder->build(
94
my $attr_type2    = $builder->build(
98
    {
95
    {
99
        source => 'BorrowerAttributeType',
96
        source => 'BorrowerAttributeType',
100
        value  => {
101
            category_code => $categorycode
102
        }
103
    }
97
    }
104
);
98
);
105
99
(-)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 541-547 subtest 'add() tests' => sub { Link Here
541
                        mandatory     => 0,
541
                        mandatory     => 0,
542
                        repeatable    => 1,
542
                        repeatable    => 1,
543
                        unique_id     => 0,
543
                        unique_id     => 0,
544
                        category_code => 'ST'
545
                    }
544
                    }
546
                }
545
                }
547
            );
546
            );
Lines 552-558 subtest 'add() tests' => sub { Link Here
552
                        mandatory     => 0,
551
                        mandatory     => 0,
553
                        repeatable    => 1,
552
                        repeatable    => 1,
554
                        unique_id     => 0,
553
                        unique_id     => 0,
555
                        category_code => 'ST'
556
                    }
554
                    }
557
                }
555
                }
558
            );
556
            );
(-)a/t/db_dependent/api/v1/patrons_extended_attributes.t (-9 lines)
Lines 116-122 subtest 'add() tests' => sub { Link Here
116
                mandatory     => 1,
116
                mandatory     => 1,
117
                repeatable    => 0,
117
                repeatable    => 0,
118
                unique_id     => 0,
118
                unique_id     => 0,
119
                category_code => undef
120
            }
119
            }
121
        }
120
        }
122
    );
121
    );
Lines 127-133 subtest 'add() tests' => sub { Link Here
127
                mandatory     => 0,
126
                mandatory     => 0,
128
                repeatable    => 1,
127
                repeatable    => 1,
129
                unique_id     => 0,
128
                unique_id     => 0,
130
                category_code => undef
131
            }
129
            }
132
        }
130
        }
133
    );
131
    );
Lines 138-144 subtest 'add() tests' => sub { Link Here
138
                mandatory     => 0,
136
                mandatory     => 0,
139
                repeatable    => 0,
137
                repeatable    => 0,
140
                unique_id     => 1,
138
                unique_id     => 1,
141
                category_code => undef
142
            }
139
            }
143
        }
140
        }
144
    );
141
    );
Lines 245-251 subtest 'overwrite() tests' => sub { Link Here
245
                mandatory     => 1,
242
                mandatory     => 1,
246
                repeatable    => 0,
243
                repeatable    => 0,
247
                unique_id     => 0,
244
                unique_id     => 0,
248
                category_code => undef
249
            }
245
            }
250
        }
246
        }
251
    );
247
    );
Lines 256-262 subtest 'overwrite() tests' => sub { Link Here
256
                mandatory     => 0,
252
                mandatory     => 0,
257
                repeatable    => 1,
253
                repeatable    => 1,
258
                unique_id     => 0,
254
                unique_id     => 0,
259
                category_code => undef
260
            }
255
            }
261
        }
256
        }
262
    );
257
    );
Lines 267-273 subtest 'overwrite() tests' => sub { Link Here
267
                mandatory     => 0,
262
                mandatory     => 0,
268
                repeatable    => 0,
263
                repeatable    => 0,
269
                unique_id     => 1,
264
                unique_id     => 1,
270
                category_code => undef
271
            }
265
            }
272
        }
266
        }
273
    );
267
    );
Lines 393-399 subtest 'delete() tests' => sub { Link Here
393
                mandatory     => 0,
387
                mandatory     => 0,
394
                repeatable    => 1,
388
                repeatable    => 1,
395
                unique_id     => 0,
389
                unique_id     => 0,
396
                category_code => undef
397
            }
390
            }
398
        }
391
        }
399
    );
392
    );
Lines 442-448 subtest 'update() tests' => sub { Link Here
442
                mandatory     => 0,
435
                mandatory     => 0,
443
                repeatable    => 1,
436
                repeatable    => 1,
444
                unique_id     => 0,
437
                unique_id     => 0,
445
                category_code => undef
446
            }
438
            }
447
        }
439
        }
448
    );
440
    );
Lines 453-459 subtest 'update() tests' => sub { Link Here
453
                mandatory     => 0,
445
                mandatory     => 0,
454
                repeatable    => 0,
446
                repeatable    => 0,
455
                unique_id     => 1,
447
                unique_id     => 1,
456
                category_code => undef
457
            }
448
            }
458
        }
449
        }
459
    );
450
    );
(-)a/tools/modborrowers.pl (-5 / +2 lines)
Lines 146-155 if ( $op eq 'show' ) { Link Here
146
                options        => $options,
146
                options        => $options,
147
            };
147
            };
148
148
149
        my $category_code = $attr_type->category_code;
149
        my @categories = $attr_type->categories->as_list;
150
        my ( $category_lib ) = map {
150
        my ( $category_lib ) = join(', ',  map { $_->description } @categories);
151
            ( defined $category_code and $attr_type->category_code eq $category_code ) ? $attr_type->description : ()
152
        } @patron_categories;
153
        push @patron_attributes_codes,
151
        push @patron_attributes_codes,
154
            {
152
            {
155
                attribute_code => $attr_type->code,
153
                attribute_code => $attr_type->code,
156
- 

Return to bug 26573