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

(-)a/Koha/Schema/Result/BorrowerAttributeType.pm (+10 lines)
Lines 137-142 defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 Link Here
137
137
138
defines if the attribute is mandatory or not
138
defines if the attribute is mandatory or not
139
139
140
=head2 number
141
142
  data_type: 'int'
143
  default_value: NULL
144
  is_nullable: 1
145
146
  the order in which this attribute type appears in patron form
147
140
=cut
148
=cut
141
149
142
__PACKAGE__->add_columns(
150
__PACKAGE__->add_columns(
Lines 168-173 __PACKAGE__->add_columns( Link Here
168
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
176
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
169
  "mandatory",
177
  "mandatory",
170
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
178
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
179
  "number",
180
  { data_type => "int", is_nullable => 1 },
171
);
181
);
172
182
173
=head1 PRIMARY KEY
183
=head1 PRIMARY KEY
(-)a/admin/patron-attr-types.pl (+2 lines)
Lines 124-129 sub add_update_attribute_type { Link Here
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;
125
    my $category_code             = $input->param('category_code') || undef;
126
    my $class                     = $input->param('class');
126
    my $class                     = $input->param('class');
127
    my $number                    = $input->param('number') || undef;
127
128
128
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
129
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
129
    if ( $op eq 'edit' ) {
130
    if ( $op eq 'edit' ) {
Lines 160-165 sub add_update_attribute_type { Link Here
160
            display_checkout          => $display_checkout,
161
            display_checkout          => $display_checkout,
161
            category_code             => $category_code,
162
            category_code             => $category_code,
162
            class                     => $class,
163
            class                     => $class,
164
            number                    => $number,
163
        }
165
        }
164
    )->store;
166
    )->store;
165
167
(-)a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl (+20 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "35145",
5
    description => "Add number column to borrower_attribute_types table",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Do you stuffs here
11
        $dbh->do(q{
12
            ALTER TABLE borrower_attribute_types
13
            ADD number int(11);
14
        });
15
16
        # Print useful stuff here
17
        # tables
18
        say $out "Added column 'borrower_attribute_types.number'";
19
    },
20
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1241-1246 CREATE TABLE `borrower_attribute_types` ( Link Here
1241
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1241
  `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)',
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)',
1243
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1243
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1244
  `number` int(11) DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form',
1244
  PRIMARY KEY (`code`),
1245
  PRIMARY KEY (`code`),
1245
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1246
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1246
  KEY `category_code` (`category_code`),
1247
  KEY `category_code` (`category_code`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (+11 lines)
Lines 103-108 Link Here
103
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
103
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
104
           <span class="required">Required</span>
104
           <span class="required">Required</span>
105
       </li>
105
       </li>
106
       <li>
107
            <label for="number">Appear in position: </label>
108
            [% IF ( attribute_type.number ) %]
109
                <input id="number" size="3" name="number" type="text" value="[% attribute_type.number | html %]" />
110
            [% ELSE %]
111
                <input id="number" size="3" name="number" type="text" />
112
            [% END %]
113
       </li>
106
114
107
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
115
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
108
            <li aria-disabled="true">
116
            <li aria-disabled="true">
Lines 316-321 Link Here
316
              <th>Authorized value category</th>
324
              <th>Authorized value category</th>
317
              <th>Mandatory</th>
325
              <th>Mandatory</th>
318
              <th>Searching</th>
326
              <th>Searching</th>
327
              <th>Number</th>
319
              <th class="NoSort noExport">Actions</th>
328
              <th class="NoSort noExport">Actions</th>
320
            </tr>
329
            </tr>
321
          </thead>
330
          </thead>
Lines 366-371 Link Here
366
                        <span>Not searchable</span>
375
                        <span>Not searchable</span>
367
                    [% END %]
376
                    [% END %]
368
                </td>
377
                </td>
378
                <td>[% item.number | html %]</td>
369
                <td class="actions">
379
                <td class="actions">
370
                  <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
380
                  <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
371
                  <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
381
                  <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
Lines 431-436 Link Here
431
            $(".patron_attributes_types").each(function(){
441
            $(".patron_attributes_types").each(function(){
432
                var tableid = $(this).attr("id");
442
                var tableid = $(this).attr("id");
433
                KohaTable( tableid, {
443
                KohaTable( tableid, {
444
                    "sorting": [[ 6, "asc" ]],
434
                    "bPaginate": false,
445
                    "bPaginate": false,
435
                    'autoWidth': false,
446
                    'autoWidth': false,
436
                }, null );
447
                }, null );
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 866-872 sub patron_attributes_form { Link Here
866
    my $op = shift;
866
    my $op = shift;
867
867
868
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
868
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
869
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
869
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, { order_by => 'number' }, $library_id);
870
    if ( $attribute_types->count == 0 ) {
870
    if ( $attribute_types->count == 0 ) {
871
        $template->param(no_patron_attribute_types => 1);
871
        $template->param(no_patron_attribute_types => 1);
872
        return;
872
        return;
(-)a/opac/opac-memberentry.pl (-2 / +1 lines)
Lines 670-676 sub GeneratePatronAttributesForm { Link Here
670
670
671
    # Get all attribute types and the values for this patron (if applicable)
671
    # Get all attribute types and the values for this patron (if applicable)
672
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
672
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
673
        Koha::Patron::Attribute::Types->search()->as_list();
673
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'number' } )->as_list();
674
    if ( scalar(@types) == 0 ) {
674
    if ( scalar(@types) == 0 ) {
675
        return [];
675
        return [];
676
    }
676
    }
677
- 

Return to bug 35145