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/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/members/moremember.pl (-2 / +5 lines)
Lines 140-153 unless ( Koha::Patron::Categories->search_with_library_limits( { 'me.categorycod Link Here
140
140
141
if (C4::Context->preference('ExtendedPatronAttributes')) {
141
if (C4::Context->preference('ExtendedPatronAttributes')) {
142
    my @attributes = $patron->extended_attributes->as_list; # FIXME Must be improved!
142
    my @attributes = $patron->extended_attributes->as_list; # FIXME Must be improved!
143
    my $attribute_types = Koha::Patron::Attribute::Types->search({}, { order_by => 'display_order' });
143
    my @classes = uniq( map {$_->type->class} @attributes );
144
    my @classes = uniq( map {$_->type->class} @attributes );
144
    @classes = sort @classes;
145
    @classes = sort @classes;
145
146
146
    my @attributes_loop;
147
    my @attributes_loop;
147
    for my $class (@classes) {
148
    for my $class (@classes) {
148
        my @items;
149
        my @items;
149
        for my $attr (@attributes) {
150
        while ( my ( $attr_type ) = $attribute_types->next ) {
150
            push @items, $attr if $attr->type->class eq $class
151
            for my $attr (@attributes) {
152
                push @items, $attr if ($attr->type->class eq $class && $attr_type->code() eq $attr->type->code)
153
            }
151
        }
154
        }
152
        my $av = Koha::AuthorisedValues->search({ category => 'PA_CLASS', authorised_value => $class });
155
        my $av = Koha::AuthorisedValues->search({ category => 'PA_CLASS', authorised_value => $class });
153
        my $lib = $av->count ? $av->next->lib : $class;
156
        my $lib = $av->count ? $av->next->lib : $class;
(-)a/opac/opac-memberentry.pl (-2 / +1 lines)
Lines 651-657 sub GeneratePatronAttributesForm { Link Here
651
651
652
    # Get all attribute types and the values for this patron (if applicable)
652
    # Get all attribute types and the values for this patron (if applicable)
653
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
653
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
654
        Koha::Patron::Attribute::Types->search()->as_list();
654
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'display_order' } )->as_list();
655
    if ( scalar(@types) == 0 ) {
655
    if ( scalar(@types) == 0 ) {
656
        return [];
656
        return [];
657
    }
657
    }
658
- 

Return to bug 35145