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

(-)a/admin/patron-attr-types.pl (+2 lines)
Lines 121-126 sub add_update_attribute_type { Link Here
121
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
121
    my $display_checkout          = $input->param('display_checkout') ? 1 : 0;
122
    my $category_code             = $input->param('category_code') || undef;
122
    my $category_code             = $input->param('category_code') || undef;
123
    my $class                     = $input->param('class');
123
    my $class                     = $input->param('class');
124
    my $display_order             = $input->param('display_order') || undef;
124
125
125
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
126
    my $attr_type = Koha::Patron::Attribute::Types->find($code);
126
    if ( $op eq 'edit' ) {
127
    if ( $op eq 'edit' ) {
Lines 158-163 sub add_update_attribute_type { Link Here
158
            display_checkout          => $display_checkout,
159
            display_checkout          => $display_checkout,
159
            category_code             => $category_code,
160
            category_code             => $category_code,
160
            class                     => $class,
161
            class                     => $class,
162
            display_order             => $display_order,
161
        }
163
        }
162
    )->store;
164
    )->store;
163
165
(-)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
                    <li [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]aria-disabled="true"[% END %]>
117
                    <li [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]aria-disabled="true"[% END %]>
110
                        <label for="repeatable">Repeatable: </label>
118
                        <label for="repeatable">Repeatable: </label>
Lines 330-335 Link Here
330
                                <th>Mandatory in staff interface</th>
338
                                <th>Mandatory in staff interface</th>
331
                                <th>Mandatory in OPAC</th>
339
                                <th>Mandatory in OPAC</th>
332
                                <th>Searching</th>
340
                                <th>Searching</th>
341
                                <th>Display order</th>
333
                                <th class="no-sort no-export">Actions</th>
342
                                <th class="no-sort no-export">Actions</th>
334
                            </tr>
343
                            </tr>
335
                        </thead>
344
                        </thead>
Lines 388-393 Link Here
388
                                            <span>Not searchable</span>
397
                                            <span>Not searchable</span>
389
                                        [% END %]
398
                                        [% END %]
390
                                    </td>
399
                                    </td>
400
                                    <td>[% item.display_order | html %]</td>
391
                                    <td class="actions">
401
                                    <td class="actions">
392
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/patron-attr-types.pl?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
402
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/patron-attr-types.pl?op=edit_attribute_type&amp;code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
393
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/patron-attr-types.pl?op=delete_attribute_type&amp;code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
403
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/patron-attr-types.pl?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 926-932 sub patron_attributes_form { Link Here
926
    my $op         = shift;
926
    my $op         = shift;
927
927
928
    my $library_id      = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
928
    my $library_id      = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
929
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits( {}, {}, $library_id );
929
    my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits( {}, { order_by => 'display_order' }, $library_id);
930
    if ( $attribute_types->count == 0 ) {
930
    if ( $attribute_types->count == 0 ) {
931
        $template->param( no_patron_attribute_types => 1 );
931
        $template->param( no_patron_attribute_types => 1 );
932
        return;
932
        return;
(-)a/members/moremember.pl (-2 / +5 lines)
Lines 139-152 unless ( Koha::Patron::Categories->search_with_library_limits( { 'me.categorycod Link Here
139
139
140
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
140
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
141
    my @attributes = $patron->extended_attributes->as_list;         # FIXME Must be improved!
141
    my @attributes = $patron->extended_attributes->as_list;         # FIXME Must be improved!
142
    my $attribute_types = Koha::Patron::Attribute::Types->search({}, { order_by => 'display_order' });
142
    my @classes    = uniq( map { $_->type->class } @attributes );
143
    my @classes    = uniq( map { $_->type->class } @attributes );
143
    @classes = sort @classes;
144
    @classes = sort @classes;
144
145
145
    my @attributes_loop;
146
    my @attributes_loop;
146
    for my $class (@classes) {
147
    for my $class (@classes) {
147
        my @items;
148
        my @items;
148
        for my $attr (@attributes) {
149
        while ( my ( $attr_type ) = $attribute_types->next ) {
149
            push @items, $attr if $attr->type->class eq $class;
150
            for my $attr (@attributes) {
151
                push @items, $attr if ($attr->type->class eq $class && $attr_type->code() eq $attr->type->code)
152
            }
150
        }
153
        }
151
        my $av  = Koha::AuthorisedValues->search( { category => 'PA_CLASS', authorised_value => $class } );
154
        my $av  = Koha::AuthorisedValues->search( { category => 'PA_CLASS', authorised_value => $class } );
152
        my $lib = $av->count ? $av->next->lib : $class;
155
        my $lib = $av->count ? $av->next->lib : $class;
(-)a/opac/opac-memberentry.pl (-2 / +1 lines)
Lines 688-694 sub GeneratePatronAttributesForm { Link Here
688
688
689
    # Get all attribute types and the values for this patron (if applicable)
689
    # Get all attribute types and the values for this patron (if applicable)
690
    my @types = grep { $_->opac_editable() or $_->opac_display }    # FIXME filter using DBIC
690
    my @types = grep { $_->opac_editable() or $_->opac_display }    # FIXME filter using DBIC
691
        Koha::Patron::Attribute::Types->search()->as_list();
691
        Koha::Patron::Attribute::Types->search( {}, { order_by => 'display_order' } )->as_list();
692
    if ( scalar(@types) == 0 ) {
692
    if ( scalar(@types) == 0 ) {
693
        return [];
693
        return [];
694
    }
694
    }
695
- 

Return to bug 35145