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

(-)a/admin/patron-attr-types.pl (+2 lines)
Lines 117-122 sub add_update_attribute_type { Link Here
117
    my $opac_display              = $input->param('opac_display') ? 1 : 0;
117
    my $opac_display              = $input->param('opac_display') ? 1 : 0;
118
    my $opac_editable             = $input->param('opac_editable') ? 1 : 0;
118
    my $opac_editable             = $input->param('opac_editable') ? 1 : 0;
119
    my $staff_searchable          = $input->param('staff_searchable') ? 1 : 0;
119
    my $staff_searchable          = $input->param('staff_searchable') ? 1 : 0;
120
    my $searched_by_default       = $input->param('searched_by_default') ? 1 : 0;
120
    my $keep_for_pseudonymization = $input->param('keep_for_pseudonymization') ? 1 : 0;
121
    my $keep_for_pseudonymization = $input->param('keep_for_pseudonymization') ? 1 : 0;
121
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
122
    my $mandatory                 = $input->param('mandatory') ? 1 : 0;
122
    my $authorised_value_category = $input->param('authorised_value_category');
123
    my $authorised_value_category = $input->param('authorised_value_category');
Lines 152-157 sub add_update_attribute_type { Link Here
152
            opac_display              => $opac_display,
153
            opac_display              => $opac_display,
153
            opac_editable             => $opac_editable,
154
            opac_editable             => $opac_editable,
154
            staff_searchable          => $staff_searchable,
155
            staff_searchable          => $staff_searchable,
156
            searched_by_default       => $searched_by_default,
155
            keep_for_pseudonymization => $keep_for_pseudonymization,
157
            keep_for_pseudonymization => $keep_for_pseudonymization,
156
            mandatory                 => $mandatory,
158
            mandatory                 => $mandatory,
157
            authorised_value_category => $authorised_value_category,
159
            authorised_value_category => $authorised_value_category,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-1 / +1 lines)
Lines 233-239 Link Here
233
        }, {});
233
        }, {});
234
234
235
        [% IF Koha.Preference('ExtendedPatronAttributes') %]
235
        [% IF Koha.Preference('ExtendedPatronAttributes') %]
236
            [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1 ) ] %]
236
            [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %]
237
            let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %];
237
            let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %];
238
        [% END %]
238
        [% END %]
239
239
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +43 lines)
Lines 169-175 Link Here
169
          [% ELSE %]
169
          [% ELSE %]
170
            <input type="checkbox" id="staff_searchable" name="staff_searchable" />
170
            <input type="checkbox" id="staff_searchable" name="staff_searchable" />
171
          [% END %]
171
          [% END %]
172
            <span class="hint">Check to make this attribute staff_searchable in the staff patron search.</span>
172
            <span class="hint">
173
                Check to make this attribute searchable in staff patron searches. If
174
                checked, this attribute will appear in patron search dropdowns.
175
            </span>
176
       </li>
177
       <li><label for="searched_by_default">Search by default: </label>
178
          [% IF attribute_type AND attribute_type.searched_by_default %]
179
            <input type="checkbox" id="searched_by_default" name="searched_by_default" checked="checked" />
180
          [% ELSE %]
181
            <input type="checkbox" id="searched_by_default" name="searched_by_default" />
182
          [% END %]
183
            <span class="hint">
184
                If checked, this field will be included in 'Standard' patron searches. Requires
185
                field to be marked as searchable above
186
            </span>
173
       </li>
187
       </li>
174
       <li><label for="mandatory">Mandatory: </label>
188
       <li><label for="mandatory">Mandatory: </label>
175
          [% IF attribute_type AND attribute_type.mandatory %]
189
          [% IF attribute_type AND attribute_type.mandatory %]
Lines 299-304 Link Here
299
              <th>Library limitation</th>
313
              <th>Library limitation</th>
300
              <th>Authorized value category</th>
314
              <th>Authorized value category</th>
301
              <th>Mandatory</th>
315
              <th>Mandatory</th>
316
              <th>Searching</th>
302
              <th class="NoSort noExport">Actions</th>
317
              <th class="NoSort noExport">Actions</th>
303
            </tr>
318
            </tr>
304
          </thead>
319
          </thead>
Lines 338-343 Link Here
338
                       <span>No</span>
353
                       <span>No</span>
339
                    [% END %]
354
                    [% END %]
340
                </td>
355
                </td>
356
                <td>
357
                    [% IF ( item.staff_searchable ) %]
358
                        [% IF( item.searched_by_default ) %]
359
                            <span>Searched by default</span>
360
                        [% ELSE %]
361
                            <span>Searchable</span>
362
                        [% END %]
363
                    [% ELSE %]
364
                        <span>Not searchable</span>
365
                    [% END %]
366
                </td>
341
                <td class="actions">
367
                <td class="actions">
342
                  <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>
368
                  <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>
343
                  <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>
369
                  <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>
Lines 372-377 Link Here
372
    [% INCLUDE 'columns_settings.inc' %]
398
    [% INCLUDE 'columns_settings.inc' %]
373
    <script>
399
    <script>
374
        $(document).ready(function() {
400
        $(document).ready(function() {
401
402
            function toggle_search_default(){
403
                if( $("#staff_searchable").is(":checked") ){
404
                    $("#searched_by_default").prop('disabled', false);
405
                } else {
406
407
                    $("#searched_by_default").prop('disabled', true).prop('checked',false);
408
                }
409
            }
410
            $("#staff_searchable").on('change',function(){
411
                toggle_search_default();
412
            });
413
414
            toggle_search_default();
415
416
375
            if ( $("#branches option:selected").length < 1 ) {
417
            if ( $("#branches option:selected").length < 1 ) {
376
                $("#branches option:first").attr("selected", "selected");
418
                $("#branches option:first").attr("selected", "selected");
377
            }
419
            }
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-2 / +1 lines)
Lines 613-619 function buildPatronSearchQuery(term, options) { Link Here
613
    q.push({ "-or": term_subquery_or });
613
    q.push({ "-or": term_subquery_or });
614
614
615
    // Add each pattern for each extended patron attributes
615
    // Add each pattern for each extended patron attributes
616
    if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types) || searched_attribute_fields ) && extendedPatronAttributes) {
616
    if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types) || ( searched_attribute_fields.length > 0 ) ) && extendedPatronAttributes) {
617
        extended_attribute_codes_to_search = (searched_attribute_fields.length > 0) ? searched_attribute_fields : options.extended_attribute_types;
617
        extended_attribute_codes_to_search = (searched_attribute_fields.length > 0) ? searched_attribute_fields : options.extended_attribute_types;
618
        extended_attribute_subquery_and = [];
618
        extended_attribute_subquery_and = [];
619
        patterns.forEach(function (pattern, i) {
619
        patterns.forEach(function (pattern, i) {
620
- 

Return to bug 34517