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

(-)a/Koha/Patron/Attribute/Type.pm (+12 lines)
Lines 115-120 sub check_unique_ids { Link Here
115
}
115
}
116
116
117
117
118
=head3 get_model
119
    Return the name of the model of this attribute type
120
121
=cut
122
123
sub get_model {
124
    my ($self) = @_;
125
126
    return 'date' if $self->is_date;
127
    return 'avc' if $self->authorised_value_category;
128
    return 'text';
129
}
118
130
119
=head3 _type
131
=head3 _type
120
132
(-)a/admin/patron-attr-types.pl (+2 lines)
Lines 84-94 exit 0; Link Here
84
sub add_attribute_type_form {
84
sub add_attribute_type_form {
85
    my $template = shift;
85
    my $template = shift;
86
86
87
    my $model             = $input->param('model');
87
    my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
88
    my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
88
    $template->param(
89
    $template->param(
89
        attribute_type_form => 1,
90
        attribute_type_form => 1,
90
        confirm_op => 'cud-add_attribute_type_confirmed',
91
        confirm_op => 'cud-add_attribute_type_confirmed',
91
        categories => $patron_categories,
92
        categories => $patron_categories,
93
        model      => $model
92
    );
94
    );
93
}
95
}
94
96
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-18 / +47 lines)
Lines 76-84 Link Here
76
76
77
[% IF ( attribute_type_form ) %]
77
[% IF ( attribute_type_form ) %]
78
  [% IF ( edit_attribute_type ) %]
78
  [% IF ( edit_attribute_type ) %]
79
<h1>[% tx("Modify patron attribute type '{code}'", { code = attribute_type.code }) | html %]</h1>
79
<h1>[% tx("Modify patron attribute type '{code}'", { code = attribute_type.code }) | html %]: [% PROCESS model_label_block model_code = attribute_type.get_model %]</h1>
80
  [% ELSE %]
80
  [% ELSE %]
81
<h1>New patron attribute type</h1>
81
<h1>[% t('New patron attribute type') %]: [% PROCESS model_label_block model_code = attribute_type.get_model %]</h1>
82
  [% END %]
82
  [% END %]
83
[% IF ( duplicate_code_error ) %]
83
[% IF ( duplicate_code_error ) %]
84
<div class="dialog message">Could not add patron attribute type &quot;[% duplicate_code_error | html %]&quot; 
84
<div class="dialog message">Could not add patron attribute type &quot;[% duplicate_code_error | html %]&quot; 
Lines 106-111 Link Here
106
           <span class="required">Required</span>
106
           <span class="required">Required</span>
107
       </li>
107
       </li>
108
108
109
        [% IF attribute_type AND attribute_type.authorised_value_category OR model == "avc" %]
110
        <li>
111
            <label for="authorised_value_category">Authorized value category: </label>
112
            <select name="authorised_value_category" id="authorised_value_category">
113
                <option value=""></option>
114
                [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => attribute_type.authorised_value_category ) %]
115
            </select>
116
        </li>
117
        [% END %]
118
109
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
119
        [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %]
110
            <li aria-disabled="true">
120
            <li aria-disabled="true">
111
        [% ELSE %]
121
        [% ELSE %]
Lines 148-160 Link Here
148
            <span class="hint">If checked, attribute will be a unique identifier. If a value is given to a patron record, the same value
158
            <span class="hint">If checked, attribute will be a unique identifier. If a value is given to a patron record, the same value
149
                  cannot be given to a different record.</span>
159
                  cannot be given to a different record.</span>
150
        </li>
160
        </li>
151
        <li><label for="is_date">Is a date: </label>
161
        <li>
152
            [% IF attribute_type AND attribute_type.is_date %]
162
            [% IF attribute_type AND attribute_type.is_date OR model == 'date' %]
153
                <input type="checkbox" id="is_date" name="is_date" checked="checked" />
163
                <input hidden type="checkbox" id="is_date" name="is_date" checked="checked" />
154
            [% ELSE %]
164
            [% ELSE %]
155
                <input type="checkbox" id="is_date" name="is_date" />
165
                <input hidden type="checkbox" id="is_date" name="is_date" />
156
            [% END %]
166
            [% END %]
157
            <span class="hint">If checked, attribute will be a date. Date attributes cannot be repeatable or linked to an authorised value category.</span>
158
        </li>
167
        </li>
159
       <li><label for="opac_display">Display in OPAC: </label>
168
       <li><label for="opac_display">Display in OPAC: </label>
160
          [% IF attribute_type AND attribute_type.opac_display %]
169
          [% IF attribute_type AND attribute_type.opac_display %]
Lines 222-235 Link Here
222
                <span class="hint">Check to make this attribute copied to the patron's pseudonymized attributes.</span>
231
                <span class="hint">Check to make this attribute copied to the patron's pseudonymized attributes.</span>
223
            </li>
232
            </li>
224
        [% END %]
233
        [% END %]
225
226
        <li><label for="authorised_value_category">Authorized value category: </label>
227
            <select name="authorised_value_category" id="authorised_value_category">
228
                <option value=""></option>
229
                [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => attribute_type.authorised_value_category ) %]
230
            </select>
231
            <div class="hint">If one is selected, the patron record input page will only allow values to be chosen from the authorized value list.  However, an authorized value list is not enforced during batch patron import.</div>
232
        </li>
233
        <li><label for="branches">Library limitation: </label>
234
        <li><label for="branches">Library limitation: </label>
234
            <select id="branches" name="branches" multiple size="10">
235
            <select id="branches" name="branches" multiple size="10">
235
                <option value="">All libraries</option>
236
                <option value="">All libraries</option>
Lines 288-294 Link Here
288
[% IF ( display_list ) %]
289
[% IF ( display_list ) %]
289
290
290
<div id="toolbar" class="btn-toolbar">
291
<div id="toolbar" class="btn-toolbar">
291
    <a class="btn btn-default" id="newrule" href="[% script_name | url %]?op=add_attribute_type"><i class="fa fa-plus"></i> New patron attribute type</a>
292
    <div class="dropdown btn-group">
293
        <button class="btn btn-default dropdown-toggle" type="button" id="new-patron-attr" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
294
            <i class="fa fa-plus"></i> New patron attribute type <span class="caret"></span>
295
        </button>
296
        <ul class="dropdown-menu" aria-labelledby="new-patron-attr">
297
            <li>
298
                <a href="[% script_name | url %]?op=add_attribute_type&model=avc">Authorised value category</a>
299
            </li>
300
            <li>
301
                <a href="[% script_name | url %]?op=add_attribute_type&model=date">Date</a>
302
            </li>
303
            <li>
304
                <a href="[% script_name | url %]?op=add_attribute_type&model=text">Text</a>
305
            </li>
306
        </ul>
307
    </div>
292
</div>
308
</div>
293
309
294
<h1>Patron attribute types</h1>
310
<h1>Patron attribute types</h1>
Lines 322-327 Link Here
322
            <tr>
338
            <tr>
323
              <th>Code</th>
339
              <th>Code</th>
324
              <th>Description</th>
340
              <th>Description</th>
341
              <th>Model</th>
325
              <th>Library limitation</th>
342
              <th>Library limitation</th>
326
              <th>Authorized value category</th>
343
              <th>Authorized value category</th>
327
              <th>Mandatory</th>
344
              <th>Mandatory</th>
Lines 334-339 Link Here
334
              <tr>
351
              <tr>
335
                <td>[% item.code | html %]</td>
352
                <td>[% item.code | html %]</td>
336
                <td>[% item.description | html %]</td>
353
                <td>[% item.description | html %]</td>
354
                <td>[% PROCESS model_label_block model_code = item.get_model %]</td>
337
                <td>
355
                <td>
338
                    [% SET libraries = item.library_limits %]
356
                    [% SET libraries = item.library_limits %]
339
                    [% IF ( libraries && libraries.count > 0 ) %]
357
                    [% IF ( libraries && libraries.count > 0 ) %]
Lines 377-383 Link Here
377
                    [% END %]
395
                    [% END %]
378
                </td>
396
                </td>
379
                <td class="actions">
397
                <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>
398
                  <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&amp;code=[% item.code | uri %]&amp;model=[% item.get_model | 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>
399
                  <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>
382
                </td>
400
                </td>
383
              </tr>
401
              </tr>
Lines 464-467 Link Here
464
        });
482
        });
465
    </script>
483
    </script>
466
[% END %]
484
[% END %]
485
486
[% BLOCK model_label_block %]
487
    [% SET switch_model = model_code or model %]
488
    [% SWITCH switch_model %]
489
    [% CASE 'avc' %]
490
        [% t('Authorised value category') %]
491
    [% CASE 'date' %]
492
        [% t('Date') %]
493
    [% CASE 'text' %]
494
        [% t('Text') %]
495
    [% END %]
496
[% END %]
467
[% INCLUDE 'intranet-bottom.inc' %]
497
[% INCLUDE 'intranet-bottom.inc' %]
468
- 

Return to bug 36751