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 301-306 Link Here
301
              <th>Library limitation</th>
315
              <th>Library limitation</th>
302
              <th>Authorized value category</th>
316
              <th>Authorized value category</th>
303
              <th>Mandatory</th>
317
              <th>Mandatory</th>
318
              <th>Searching</th>
304
              <th class="NoSort noExport">Actions</th>
319
              <th class="NoSort noExport">Actions</th>
305
            </tr>
320
            </tr>
306
          </thead>
321
          </thead>
Lines 340-345 Link Here
340
                       <span>No</span>
355
                       <span>No</span>
341
                    [% END %]
356
                    [% END %]
342
                </td>
357
                </td>
358
                <td>
359
                    [% IF ( item.staff_searchable ) %]
360
                        [% IF( item.searched_by_default ) %]
361
                            <span>Searched by default</span>
362
                        [% ELSE %]
363
                            <span>Searchable</span>
364
                        [% END %]
365
                    [% ELSE %]
366
                        <span>Not searchable</span>
367
                    [% END %]
368
                </td>
343
                <td class="actions">
369
                <td class="actions">
344
                  <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>
370
                  <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>
345
                  <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>
371
                  <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 374-379 Link Here
374
    [% INCLUDE 'columns_settings.inc' %]
400
    [% INCLUDE 'columns_settings.inc' %]
375
    <script>
401
    <script>
376
        $(document).ready(function() {
402
        $(document).ready(function() {
403
404
            function toggle_search_default(){
405
                if( $("#staff_searchable").is(":checked") ){
406
                    $("#searched_by_default").prop('disabled', false);
407
                } else {
408
409
                    $("#searched_by_default").prop('disabled', true).prop('checked',false);
410
                }
411
            }
412
            $("#staff_searchable").on('change',function(){
413
                toggle_search_default();
414
            });
415
416
            toggle_search_default();
417
418
377
            if ( $("#branches option:selected").length < 1 ) {
419
            if ( $("#branches option:selected").length < 1 ) {
378
                $("#branches option:first").attr("selected", "selected");
420
                $("#branches option:first").attr("selected", "selected");
379
            }
421
            }
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-2 / +1 lines)
Lines 640-646 function buildPatronSearchQuery(term, options) { Link Here
640
    q.push({ "-or": term_subquery_or });
640
    q.push({ "-or": term_subquery_or });
641
641
642
    // Add each pattern for each extended patron attributes
642
    // Add each pattern for each extended patron attributes
643
    if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types) || searched_attribute_fields ) && extendedPatronAttributes) {
643
    if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types) || ( searched_attribute_fields.length > 0 ) ) && extendedPatronAttributes) {
644
        extended_attribute_codes_to_search = (searched_attribute_fields.length > 0) ? searched_attribute_fields : options.extended_attribute_types;
644
        extended_attribute_codes_to_search = (searched_attribute_fields.length > 0) ? searched_attribute_fields : options.extended_attribute_types;
645
        extended_attribute_subquery_and = [];
645
        extended_attribute_subquery_and = [];
646
        patterns.forEach(function (pattern, i) {
646
        patterns.forEach(function (pattern, i) {
647
- 

Return to bug 34517