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

(-)a/admin/patron-attr-types.pl (+2 lines)
Lines 125-130 sub add_update_attribute_type { Link Here
125
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
125
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
126
    my $category_code             = $input->param('category_code') || undef;
126
    my $category_code             = $input->param('category_code') || undef;
127
    my $class                     = $input->param('class');
127
    my $class                     = $input->param('class');
128
    my $display_order             = $input->param('display_order') || undef;
128
129
129
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
130
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
130
    if ( $op eq 'edit' ) {
131
    if ( $op eq 'edit' ) {
Lines 162-167 sub add_update_attribute_type { Link Here
162
            display_checkout          => $display_checkout,
163
            display_checkout          => $display_checkout,
163
            category_code             => $category_code,
164
            category_code             => $category_code,
164
            class                     => $class,
165
            class                     => $class,
166
            display_order             => $display_order,
165
        }
167
        }
166
    )->store;
168
    )->store;
167
169
(-)a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl (+22 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "35145",
5
    description => "Add display_order 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(
12
            q{
13
            ALTER TABLE borrower_attribute_types
14
            ADD display_order int(11);
15
        }
16
        );
17
18
        # Print useful stuff here
19
        # tables
20
        say $out "Added column 'borrower_attribute_types.number'";
21
    },
22
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1262-1267 CREATE TABLE `borrower_attribute_types` ( Link Here
1262
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1262
  `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type',
1263
  `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)',
1263
  `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)',
1264
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1264
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1265
  `display_order` int(11) DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form',
1265
  PRIMARY KEY (`code`),
1266
  PRIMARY KEY (`code`),
1266
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1267
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1267
  KEY `category_code` (`category_code`),
1268
  KEY `category_code` (`category_code`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (+10 lines)
Lines 105-110 Link Here
105
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
105
           <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
106
           <span class="required">Required</span>
106
           <span class="required">Required</span>
107
       </li>
107
       </li>
108
       <li>
109
            <label for="display_order">Appear in position: </label>
110
            [% IF ( attribute_type.display_order ) %]
111
                <input id="display_order" size="3" name="display_order" type="text" value="[% attribute_type.display_order | html %]" />
112
            [% ELSE %]
113
                <input id="display_order" size="3" name="display_order" type="text" />
114
            [% END %]
115
       </li>
108
116
109
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
117
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
110
            <li aria-disabled="true">
118
            <li aria-disabled="true">
Lines 326-331 Link Here
326
              <th>Authorized value category</th>
334
              <th>Authorized value category</th>
327
              <th>Mandatory</th>
335
              <th>Mandatory</th>
328
              <th>Searching</th>
336
              <th>Searching</th>
337
              <th>Display order</th>
329
              <th class="NoSort noExport">Actions</th>
338
              <th class="NoSort noExport">Actions</th>
330
            </tr>
339
            </tr>
331
          </thead>
340
          </thead>
Lines 376-381 Link Here
376
                        <span>Not searchable</span>
385
                        <span>Not searchable</span>
377
                    [% END %]
386
                    [% END %]
378
                </td>
387
                </td>
388
                <td>[% item.display_order | html %]</td>
379
                <td class="actions">
389
                <td class="actions">
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>
390
                  <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=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
391
                  <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 856-862 sub patron_attributes_form { Link Here
856
    my $op = shift;
856
    my $op = shift;
857
857
858
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
858
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
859
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
859
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, { order_by => 'display_order' }, $library_id);
860
    if ( $attribute_types->count == 0 ) {
860
    if ( $attribute_types->count == 0 ) {
861
        $template->param(no_patron_attribute_types => 1);
861
        $template->param(no_patron_attribute_types => 1);
862
        return;
862
        return;
(-)a/opac/opac-memberentry.pl (-2 / +1 lines)
Lines 657-663 sub GeneratePatronAttributesForm { Link Here
657
657
658
    # Get all attribute types and the values for this patron (if applicable)
658
    # Get all attribute types and the values for this patron (if applicable)
659
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
659
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
660
        Koha::Patron::Attribute::Types->search()->as_list();
660
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'display_order' } )->as_list();
661
    if ( scalar(@types) == 0 ) {
661
    if ( scalar(@types) == 0 ) {
662
        return [];
662
        return [];
663
    }
663
    }
664
- 

Return to bug 35145