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

(-)a/C4/Members/AttributeTypes.pm (-1 / +22 lines)
Lines 39-44 C4::Members::AttributeTypes - mananage extended patron attribute types Link Here
39
  $attr_type->opac_display($opac_display);
39
  $attr_type->opac_display($opac_display);
40
  $attr_type->opac_editable($opac_editable);
40
  $attr_type->opac_editable($opac_editable);
41
  $attr_type->staff_searchable($staff_searchable);
41
  $attr_type->staff_searchable($staff_searchable);
42
  $attr_type->mandatory($mandatory);
42
  $attr_type->authorised_value_category($authorised_value_category);
43
  $attr_type->authorised_value_category($authorised_value_category);
43
  $attr_type->store();
44
  $attr_type->store();
44
  $attr_type->delete();
45
  $attr_type->delete();
Lines 109-114 sub new { Link Here
109
    $self->{'opac_display'} = 0;
110
    $self->{'opac_display'} = 0;
110
    $self->{'opac_editable'} = 0;
111
    $self->{'opac_editable'} = 0;
111
    $self->{'staff_searchable'} = 0;
112
    $self->{'staff_searchable'} = 0;
113
    $self->{'mandatory'} = 0;
112
    $self->{'display_checkout'} = 0;
114
    $self->{'display_checkout'} = 0;
113
    $self->{'authorised_value_category'} = '';
115
    $self->{'authorised_value_category'} = '';
114
    $self->{'category_code'} = '';
116
    $self->{'category_code'} = '';
Lines 151-156 sub fetch { Link Here
151
    $self->{'opac_display'}              = $row->{'opac_display'};
153
    $self->{'opac_display'}              = $row->{'opac_display'};
152
    $self->{'opac_editable'}             = $row->{'opac_editable'};
154
    $self->{'opac_editable'}             = $row->{'opac_editable'};
153
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
155
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
156
    $self->{'mandatory'}          = $row->{'mandatory'};
154
    $self->{'display_checkout'}          = $row->{'display_checkout'};
157
    $self->{'display_checkout'}          = $row->{'display_checkout'};
155
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
158
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
156
    $self->{'category_code'}             = $row->{'category_code'};
159
    $self->{'category_code'}             = $row->{'category_code'};
Lines 192-197 sub store { Link Here
192
                                         opac_display = ?,
195
                                         opac_display = ?,
193
                                         opac_editable = ?,
196
                                         opac_editable = ?,
194
                                         staff_searchable = ?,
197
                                         staff_searchable = ?,
198
                                         mandatory = ?,
195
                                         authorised_value_category = ?,
199
                                         authorised_value_category = ?,
196
                                         display_checkout = ?,
200
                                         display_checkout = ?,
197
                                         category_code = ?,
201
                                         category_code = ?,
Lines 205-217 sub store { Link Here
205
                                          opac_display,
209
                                          opac_display,
206
                                          opac_editable,
210
                                          opac_editable,
207
                                          staff_searchable,
211
                                          staff_searchable,
212
                                          mandatory,
208
                                          authorised_value_category,
213
                                          authorised_value_category,
209
                                          display_checkout,
214
                                          display_checkout,
210
                                          category_code,
215
                                          category_code,
211
                                          class,
216
                                          class,
212
                                          code
217
                                          code
213
                                        )
218
                                        )
214
                                        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
219
                                        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
215
    }
220
    }
216
221
217
    $sth->execute(
222
    $sth->execute(
Lines 221-226 sub store { Link Here
221
        $self->{'opac_display'},
226
        $self->{'opac_display'},
222
        $self->{'opac_editable'},
227
        $self->{'opac_editable'},
223
        $self->{'staff_searchable'} || 0,
228
        $self->{'staff_searchable'} || 0,
229
        $self->{'mandatory'} || 0,
224
        $self->{'authorised_value_category'},
230
        $self->{'authorised_value_category'},
225
        $self->{'display_checkout'},
231
        $self->{'display_checkout'},
226
        $self->{'category_code'} || undef,
232
        $self->{'category_code'} || undef,
Lines 364-369 sub staff_searchable { Link Here
364
    @_ ? $self->{'staff_searchable'} = ((shift) ? 1 : 0) : $self->{'staff_searchable'};
370
    @_ ? $self->{'staff_searchable'} = ((shift) ? 1 : 0) : $self->{'staff_searchable'};
365
}
371
}
366
372
373
=head2 mandatory
374
375
  my $mandatory = $attr_type->mandatory();
376
  $attr_type->mandatory($mandatory);
377
378
Accessor.  The C<$mandatory> argument
379
is interpreted as a Perl boolean.
380
381
=cut
382
383
sub mandatory {
384
    my $self = shift;
385
    @_ ? $self->{'mandatory'} = ((shift) ? 1 : 0) : $self->{'mandatory'};
386
}
387
367
=head2 display_checkout
388
=head2 display_checkout
368
389
369
my $display_checkout = $attr_type->display_checkout();
390
my $display_checkout = $attr_type->display_checkout();
(-)a/admin/patron-attr-types.pl (+8 lines)
Lines 125-130 sub error_add_attribute_type_form { Link Here
125
    if ($input->param('staff_searchable')) {
125
    if ($input->param('staff_searchable')) {
126
        $template->param(staff_searchable_checked => 1);
126
        $template->param(staff_searchable_checked => 1);
127
    }
127
    }
128
    if ($input->param('mandatory')) {
129
        $template->param(mandatory_checked => 1);
130
    }
128
    if ($input->param('display_checkout')) {
131
    if ($input->param('display_checkout')) {
129
        $template->param(display_checkout_checked => 'checked="checked"');
132
        $template->param(display_checkout_checked => 'checked="checked"');
130
    }
133
    }
Lines 170-175 sub add_update_attribute_type { Link Here
170
    $attr_type->opac_editable($opac_editable);
173
    $attr_type->opac_editable($opac_editable);
171
    my $staff_searchable = $input->param('staff_searchable');
174
    my $staff_searchable = $input->param('staff_searchable');
172
    $attr_type->staff_searchable($staff_searchable);
175
    $attr_type->staff_searchable($staff_searchable);
176
    my $mandatory = $input->param('mandatory');
177
    $attr_type->mandatory($mandatory);
173
    my $authorised_value_category = $input->param('authorised_value_category');
178
    my $authorised_value_category = $input->param('authorised_value_category');
174
    $attr_type->authorised_value_category($authorised_value_category);
179
    $attr_type->authorised_value_category($authorised_value_category);
175
    my $display_checkout = $input->param('display_checkout');
180
    my $display_checkout = $input->param('display_checkout');
Lines 254-259 sub edit_attribute_type_form { Link Here
254
    if ($attr_type->staff_searchable()) {
259
    if ($attr_type->staff_searchable()) {
255
        $template->param(staff_searchable_checked => 1);
260
        $template->param(staff_searchable_checked => 1);
256
    }
261
    }
262
    if ($attr_type->mandatory()) {
263
        $template->param(mandatory_checked => 1);
264
    }
257
    if ($attr_type->display_checkout()) {
265
    if ($attr_type->display_checkout()) {
258
        $template->param(display_checkout_checked => 'checked="checked"');
266
        $template->param(display_checkout_checked => 'checked="checked"');
259
    }
267
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +8 lines)
Lines 132-137 Link Here
132
          [% END %]
132
          [% END %]
133
            <span>Check to make this attribute staff_searchable in the staff patron search.</span>
133
            <span>Check to make this attribute staff_searchable in the staff patron search.</span>
134
       </li>
134
       </li>
135
       <li><label for="mandatory">Mandatory: </label>
136
          [% IF ( mandatory_checked ) %]
137
            <input type="checkbox" id="mandatory" name="mandatory" checked="checked" />
138
          [% ELSE %]
139
            <input type="checkbox" id="mandatory" name="mandatory" />
140
          [% END %]
141
            <span>Check to make this attribute mandatory when creating or editing a patron.</span>
142
       </li>
135
       <li><label for="display_checkout">Display in check-out: </label>
143
       <li><label for="display_checkout">Display in check-out: </label>
136
            [% IF display_checkout_checked %]
144
            [% IF display_checkout_checked %]
137
                <input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
145
                <input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
138
- 

Return to bug 22844