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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt (-1 / +20 lines)
Lines 139-144 Link Here
139
            map[l.branchcode] = l;
139
            map[l.branchcode] = l;
140
            return map;
140
            return map;
141
        }, {});
141
        }, {});
142
143
        [% IF Koha.Preference('ExtendedPatronAttributes') %]
144
            let extended_attribute_types = [% To.json(attribute_type_codes) | $raw %];
145
        [% END %]
142
    </script>
146
    </script>
143
    [% INCLUDE 'datatables.inc' %]
147
    [% INCLUDE 'datatables.inc' %]
144
    [% INCLUDE 'js-date-format.inc' %]
148
    [% INCLUDE 'js-date-format.inc' %]
Lines 160-166 Link Here
160
                    let start_with = $("#firstletter_filter").val()
164
                    let start_with = $("#firstletter_filter").val()
161
                    if (!start_with) return "";
165
                    if (!start_with) return "";
162
                    return { "like": start_with + "%" }
166
                    return { "like": start_with + "%" }
163
                }
167
                },
168
                [% IF Koha.Preference('ExtendedPatronAttributes') %]
169
                "-or": function(){
170
                    let filter = $("#searchmember_filter").val();
171
                    if (!filter) return "";
172
                    return [
173
                        {
174
                            "extended_attributes.value": { "like": "%" + filter + "%" }
175
                        },
176
                        {
177
                            "extended_attributes.code": extended_attribute_types
178
                        }
179
                    ];
180
                },
181
                [% END %]
164
            };
182
            };
165
            patrons_table = $("#memberresultst").kohaTable({
183
            patrons_table = $("#memberresultst").kohaTable({
166
                "ajax": {
184
                "ajax": {
Lines 177-182 Link Here
177
                        "url": '/api/v1/patrons'
195
                        "url": '/api/v1/patrons'
178
                    [% END %]
196
                    [% END %]
179
                },
197
                },
198
                embed: ['extended_attributes'],
180
                "order": [[ 1, "asc" ]],
199
                "order": [[ 1, "asc" ]],
181
                "iDeferLoading": 0,
200
                "iDeferLoading": 0,
182
                "columns": [
201
                "columns": [
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-2 / +11 lines)
Lines 604-616 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
604
                                if ( default_filters ) {
604
                                if ( default_filters ) {
605
                                    let additional_filters = {};
605
                                    let additional_filters = {};
606
                                    for ( f in default_filters ) {
606
                                    for ( f in default_filters ) {
607
                                        let k; let v;
607
                                        if ( typeof(default_filters[f]) === 'function' ) {
608
                                        if ( typeof(default_filters[f]) === 'function' ) {
608
                                            let val = default_filters[f]();
609
                                            let val = default_filters[f]();
609
                                            if ( val != undefined && val != "" ) {
610
                                            if ( val != undefined && val != "" ) {
610
                                                additional_filters[f] = val;
611
                                                k = f; v = val;
611
                                            }
612
                                            }
612
                                        } else {
613
                                        } else {
613
                                            additional_filters[f] = default_filters[f];
614
                                            k = f; v = default_filters[f];
615
                                        }
616
617
                                        // Pass to -or if you want a separate OR clause
618
                                        // It's not the usual DBIC notation!
619
                                        if ( f == '-or' ) {
620
                                            if (v) or_query_parameters.push(v)
621
                                        } else if ( v ) {
622
                                            additional_filters[k] = v;
614
                                        }
623
                                        }
615
                                    }
624
                                    }
616
                                    if ( Object.keys(additional_filters).length ) {
625
                                    if ( Object.keys(additional_filters).length ) {
(-)a/members/search.pl (-1 / +5 lines)
Lines 18-25 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use C4::Context;
21
use C4::Auth qw( get_template_and_user );
22
use C4::Auth qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
23
use C4::Output qw( output_html_with_http_headers );
24
use Koha::Patron::Attribute::Types;
23
25
24
my $input = CGI->new;
26
my $input = CGI->new;
25
27
Lines 45-49 $template->param( Link Here
45
    filter         => $filter,
47
    filter         => $filter,
46
    selection_type => $selection_type,
48
    selection_type => $selection_type,
47
    alphabet       => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
49
    alphabet       => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
50
    attribute_type_codes => ( C4::Context->preference('ExtendedPatronAttributes')
51
        ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ]
52
        : [] ),
48
);
53
);
49
output_html_with_http_headers( $input, $cookie, $template->output );
54
output_html_with_http_headers( $input, $cookie, $template->output );
50
- 

Return to bug 30055