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

(-)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 1242-1247 CREATE TABLE `borrower_attribute_types` ( Link Here
1242
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1242
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1243
  `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
  `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)',
1244
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1244
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1245
  `number` int(11) DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form',
1245
  PRIMARY KEY (`code`),
1246
  PRIMARY KEY (`code`),
1246
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1247
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1247
  KEY `category_code` (`category_code`),
1248
  KEY `category_code` (`category_code`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +12 lines)
Lines 104-109 Link Here
104
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
104
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
105
           <span class="required">Required</span>
105
           <span class="required">Required</span>
106
       </li>
106
       </li>
107
       <li>
108
            <label for="number">Appear in position: </label>
109
            [% IF ( attribute_type.number ) %]
110
                <input id="number" size="3" name="number" type="text" value="[% attribute_type.number | html %]" />
111
            [% ELSE %]
112
                <input id="number" size="3" name="number" type="text" />
113
            [% END %]
114
       </li>
107
115
108
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
116
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
109
            <li aria-disabled="true">
117
            <li aria-disabled="true">
Lines 317-322 Link Here
317
              <th>Authorized value category</th>
325
              <th>Authorized value category</th>
318
              <th>Mandatory</th>
326
              <th>Mandatory</th>
319
              <th>Searching</th>
327
              <th>Searching</th>
328
              <th>Number</th>
320
              <th class="NoSort noExport">Actions</th>
329
              <th class="NoSort noExport">Actions</th>
321
            </tr>
330
            </tr>
322
          </thead>
331
          </thead>
Lines 367-372 Link Here
367
                        <span>Not searchable</span>
376
                        <span>Not searchable</span>
368
                    [% END %]
377
                    [% END %]
369
                </td>
378
                </td>
379
                <td>[% item.number | html %]</td>
370
                <td class="actions">
380
                <td class="actions">
371
                  <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>
381
                  <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>
372
                  <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>
382
                  <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 432-438 Link Here
432
            $(".patron_attributes_types").each(function(){
442
            $(".patron_attributes_types").each(function(){
433
                var tableid = $(this).attr("id");
443
                var tableid = $(this).attr("id");
434
                KohaTable( tableid, {
444
                KohaTable( tableid, {
435
                    "paginate": false,
445
                    "sorting": [[ 6, "asc" ]],
446
                    "bPaginate": false,
436
                    'autoWidth': false,
447
                    'autoWidth': false,
437
                }, null );
448
                }, null );
438
            });
449
            });
(-)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 672-678 sub GeneratePatronAttributesForm { Link Here
672
672
673
    # Get all attribute types and the values for this patron (if applicable)
673
    # Get all attribute types and the values for this patron (if applicable)
674
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
674
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
675
        Koha::Patron::Attribute::Types->search()->as_list();
675
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'number' } )->as_list();
676
    if ( scalar(@types) == 0 ) {
676
    if ( scalar(@types) == 0 ) {
677
        return [];
677
        return [];
678
    }
678
    }
679
- 

Return to bug 35145