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

(-)a/admin/patron-attr-types.pl (-2 / +2 lines)
Lines 124-130 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
    my $display_order             = $input->param('display_order') || undef;
128
128
129
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
129
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
130
    if ( $op eq 'edit' ) {
130
    if ( $op eq 'edit' ) {
Lines 161-167 sub add_update_attribute_type { Link Here
161
            display_checkout          => $display_checkout,
161
            display_checkout          => $display_checkout,
162
            category_code             => $category_code,
162
            category_code             => $category_code,
163
            class                     => $class,
163
            class                     => $class,
164
            number                    => $number,
164
            display_order             => $display_order,
165
        }
165
        }
166
    )->store;
166
    )->store;
167
167
(-)a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl (-2 / +2 lines)
Lines 2-8 use Modern::Perl; Link Here
2
2
3
return {
3
return {
4
    bug_number  => "35145",
4
    bug_number  => "35145",
5
    description => "Add number column to borrower_attribute_types table",
5
    description => "Add display_order column to borrower_attribute_types table",
6
    up          => sub {
6
    up          => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 11-17 return { Link Here
11
        $dbh->do(
11
        $dbh->do(
12
            q{
12
            q{
13
            ALTER TABLE borrower_attribute_types
13
            ALTER TABLE borrower_attribute_types
14
            ADD number int(11);
14
            ADD display_order int(11);
15
        }
15
        }
16
        );
16
        );
17
17
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1242-1248 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
  `display_order` int(11) DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form',
1246
  PRIMARY KEY (`code`),
1246
  PRIMARY KEY (`code`),
1247
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1247
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1248
  KEY `category_code` (`category_code`),
1248
  KEY `category_code` (`category_code`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-6 / +6 lines)
Lines 105-115 Link Here
105
           <span class="required">Required</span>
105
           <span class="required">Required</span>
106
       </li>
106
       </li>
107
       <li>
107
       <li>
108
            <label for="number">Appear in position: </label>
108
            <label for="display_order">Appear in position: </label>
109
            [% IF ( attribute_type.number ) %]
109
            [% IF ( attribute_type.display_order ) %]
110
                <input id="number" size="3" name="number" type="text" value="[% attribute_type.number | html %]" />
110
                <input id="display_order" size="3" name="display_order" type="text" value="[% attribute_type.display_order | html %]" />
111
            [% ELSE %]
111
            [% ELSE %]
112
                <input id="number" size="3" name="number" type="text" />
112
                <input id="display_order" size="3" name="display_order" type="text" />
113
            [% END %]
113
            [% END %]
114
       </li>
114
       </li>
115
115
Lines 325-331 Link Here
325
              <th>Authorized value category</th>
325
              <th>Authorized value category</th>
326
              <th>Mandatory</th>
326
              <th>Mandatory</th>
327
              <th>Searching</th>
327
              <th>Searching</th>
328
              <th>Number</th>
328
              <th>Display order</th>
329
              <th class="NoSort noExport">Actions</th>
329
              <th class="NoSort noExport">Actions</th>
330
            </tr>
330
            </tr>
331
          </thead>
331
          </thead>
Lines 376-382 Link Here
376
                        <span>Not searchable</span>
376
                        <span>Not searchable</span>
377
                    [% END %]
377
                    [% END %]
378
                </td>
378
                </td>
379
                <td>[% item.number | html %]</td>
379
                <td>[% item.display_order | html %]</td>
380
                <td class="actions">
380
                <td class="actions">
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>
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>
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>
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>
(-)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({}, { order_by => 'number' }, $library_id);
869
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, { order_by => 'display_order' }, $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( {}, { order_by => 'number' } )->as_list();
675
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'display_order' } )->as_list();
676
    if ( scalar(@types) == 0 ) {
676
    if ( scalar(@types) == 0 ) {
677
        return [];
677
        return [];
678
    }
678
    }
679
- 

Return to bug 35145