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

(-)a/C4/Members/AttributeTypes.pm (-8 / +27 lines)
Lines 42-47 C4::Members::AttributeTypes - mananage extended patron attribute types Link Here
42
  $attr_type->repeatable($repeatable);
42
  $attr_type->repeatable($repeatable);
43
  $attr_type->unique_id($unique_id);
43
  $attr_type->unique_id($unique_id);
44
  $attr_type->opac_display($opac_display);
44
  $attr_type->opac_display($opac_display);
45
  $attr_type->opac_editable($opac_editable);
45
  $attr_type->password_allowed($password_allowed);
46
  $attr_type->password_allowed($password_allowed);
46
  $attr_type->staff_searchable($staff_searchable);
47
  $attr_type->staff_searchable($staff_searchable);
47
  $attr_type->authorised_value_category($authorised_value_category);
48
  $attr_type->authorised_value_category($authorised_value_category);
Lines 128-133 sub new { Link Here
128
    $self->{'repeatable'} = 0;
129
    $self->{'repeatable'} = 0;
129
    $self->{'unique_id'} = 0;
130
    $self->{'unique_id'} = 0;
130
    $self->{'opac_display'} = 0;
131
    $self->{'opac_display'} = 0;
132
    $self->{'opac_editable'} = 0;
131
    $self->{'password_allowed'} = 0;
133
    $self->{'password_allowed'} = 0;
132
    $self->{'staff_searchable'} = 0;
134
    $self->{'staff_searchable'} = 0;
133
    $self->{'display_checkout'} = 0;
135
    $self->{'display_checkout'} = 0;
Lines 170-175 sub fetch { Link Here
170
    $self->{'repeatable'}                = $row->{'repeatable'};
172
    $self->{'repeatable'}                = $row->{'repeatable'};
171
    $self->{'unique_id'}                 = $row->{'unique_id'};
173
    $self->{'unique_id'}                 = $row->{'unique_id'};
172
    $self->{'opac_display'}              = $row->{'opac_display'};
174
    $self->{'opac_display'}              = $row->{'opac_display'};
175
    $self->{'opac_editable'}             = $row->{'opac_editable'};
173
    $self->{'password_allowed'}          = $row->{'password_allowed'};
176
    $self->{'password_allowed'}          = $row->{'password_allowed'};
174
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
177
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
175
    $self->{'display_checkout'}          = $row->{'display_checkout'};
178
    $self->{'display_checkout'}          = $row->{'display_checkout'};
Lines 211-216 sub store { Link Here
211
                                         repeatable = ?,
214
                                         repeatable = ?,
212
                                         unique_id = ?,
215
                                         unique_id = ?,
213
                                         opac_display = ?,
216
                                         opac_display = ?,
217
                                         opac_editable = ?,
214
                                         password_allowed = ?,
218
                                         password_allowed = ?,
215
                                         staff_searchable = ?,
219
                                         staff_searchable = ?,
216
                                         authorised_value_category = ?,
220
                                         authorised_value_category = ?,
Lines 220-226 sub store { Link Here
220
                                     WHERE code = ?");
224
                                     WHERE code = ?");
221
    } else {
225
    } else {
222
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
226
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
223
                                        (description, repeatable, unique_id, opac_display, password_allowed,
227
                                        (description, repeatable, unique_id, opac_display, opac_editable, password_allowed,
224
                                         staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
228
                                         staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
225
                                        VALUES (?, ?, ?, ?, ?,
229
                                        VALUES (?, ?, ?, ?, ?,
226
                                                ?, ?, ?, ?, ?, ?)");
230
                                                ?, ?, ?, ?, ?, ?)");
Lines 229-241 sub store { Link Here
229
    $sth->bind_param(2, $self->{'repeatable'});
233
    $sth->bind_param(2, $self->{'repeatable'});
230
    $sth->bind_param(3, $self->{'unique_id'});
234
    $sth->bind_param(3, $self->{'unique_id'});
231
    $sth->bind_param(4, $self->{'opac_display'});
235
    $sth->bind_param(4, $self->{'opac_display'});
232
    $sth->bind_param(5, $self->{'password_allowed'});
236
    $sth->bind_param(5, $self->{'opac_editable'});
233
    $sth->bind_param(6, $self->{'staff_searchable'});
237
    $sth->bind_param(6, $self->{'password_allowed'});
234
    $sth->bind_param(7, $self->{'authorised_value_category'});
238
    $sth->bind_param(7, $self->{'staff_searchable'});
235
    $sth->bind_param(8, $self->{'display_checkout'});
239
    $sth->bind_param(8, $self->{'authorised_value_category'});
236
    $sth->bind_param(9, $self->{'category_code'} || undef);
240
    $sth->bind_param(9, $self->{'display_checkout'});
237
    $sth->bind_param(10, $self->{'class'});
241
    $sth->bind_param(10, $self->{'category_code'} || undef);
238
    $sth->bind_param(11, $self->{'code'});
242
    $sth->bind_param(11, $self->{'class'});
243
    $sth->bind_param(12, $self->{'code'});
239
    $sth->execute;
244
    $sth->execute;
240
245
241
    if ( defined $$self{branches} ) {
246
    if ( defined $$self{branches} ) {
Lines 342-347 sub opac_display { Link Here
342
    my $self = shift;
347
    my $self = shift;
343
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
348
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
344
}
349
}
350
=head2 opac_editable
351
352
  my $opac_editable = $attr_type->opac_editable();
353
  $attr_type->opac_editable($opac_editable);
354
355
Accessor.  The C<$opac_editable> argument
356
is interpreted as a Perl boolean.
357
358
=cut
359
360
sub opac_editable {
361
    my $self = shift;
362
    @_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
363
}
345
=head2 password_allowed
364
=head2 password_allowed
346
365
347
  my $password_allowed = $attr_type->password_allowed();
366
  my $password_allowed = $attr_type->password_allowed();
(-)a/admin/patron-attr-types.pl (+8 lines)
Lines 119-124 sub error_add_attribute_type_form { Link Here
119
    if ($input->param('opac_display')) {
119
    if ($input->param('opac_display')) {
120
        $template->param(opac_display_checked => 1);
120
        $template->param(opac_display_checked => 1);
121
    }
121
    }
122
    if ($input->param('opac_editable')) {
123
        $template->param(opac_editable_checked => 1);
124
    }
122
    if ($input->param('staff_searchable')) {
125
    if ($input->param('staff_searchable')) {
123
        $template->param(staff_searchable_checked => 1);
126
        $template->param(staff_searchable_checked => 1);
124
    }
127
    }
Lines 163-168 sub add_update_attribute_type { Link Here
163
166
164
    my $opac_display = $input->param('opac_display');
167
    my $opac_display = $input->param('opac_display');
165
    $attr_type->opac_display($opac_display);
168
    $attr_type->opac_display($opac_display);
169
    my $opac_editable = $input->param('opac_editable');
170
    $attr_type->opac_editable($opac_editable);
166
    my $staff_searchable = $input->param('staff_searchable');
171
    my $staff_searchable = $input->param('staff_searchable');
167
    $attr_type->staff_searchable($staff_searchable);
172
    $attr_type->staff_searchable($staff_searchable);
168
    my $authorised_value_category = $input->param('authorised_value_category');
173
    my $authorised_value_category = $input->param('authorised_value_category');
Lines 248-253 sub edit_attribute_type_form { Link Here
248
    if ($attr_type->opac_display()) {
253
    if ($attr_type->opac_display()) {
249
        $template->param(opac_display_checked => 1);
254
        $template->param(opac_display_checked => 1);
250
    }
255
    }
256
    if ($attr_type->opac_editable()) {
257
        $template->param(opac_editable_checked => 1);
258
    }
251
    if ($attr_type->staff_searchable()) {
259
    if ($attr_type->staff_searchable()) {
252
        $template->param(staff_searchable_checked => 1);
260
        $template->param(staff_searchable_checked => 1);
253
    }
261
    }
(-)a/installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE borrower_attribute_types ADD COLUMN `opac_editable` tinyint(1) NOT NULL default 0 AFTER `opac_display`;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 289-294 CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field Link Here
289
  `repeatable` tinyint(1) NOT NULL default 0, -- defines whether one patron/borrower can have multiple values for this custom field  (1 for yes, 0 for no)
289
  `repeatable` tinyint(1) NOT NULL default 0, -- defines whether one patron/borrower can have multiple values for this custom field  (1 for yes, 0 for no)
290
  `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
290
  `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
291
  `opac_display` tinyint(1) NOT NULL default 0, -- defines if this field is visible to patrons on their account in the OPAC (1 for yes, 0 for no)
291
  `opac_display` tinyint(1) NOT NULL default 0, -- defines if this field is visible to patrons on their account in the OPAC (1 for yes, 0 for no)
292
  `opac_editable` tinyint(1) NOT NULL default 0, -- defines if this field is editable by patrons on their account in the OPAC (1 for yes, 0 for no)
292
  `password_allowed` tinyint(1) NOT NULL default 0, -- defines if it is possible to associate a password with this custom field (1 for yes, 0 for no)
293
  `password_allowed` tinyint(1) NOT NULL default 0, -- defines if it is possible to associate a password with this custom field (1 for yes, 0 for no)
293
  `staff_searchable` tinyint(1) NOT NULL default 0, -- defines if this field is searchable via the patron search in the staff client (1 for yes, 0 for no)
294
  `staff_searchable` tinyint(1) NOT NULL default 0, -- defines if this field is searchable via the patron search in the staff client (1 for yes, 0 for no)
294
  `authorised_value_category` varchar(32) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
295
  `authorised_value_category` varchar(32) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+4 lines)
Lines 711-716 fieldset.action, div.action { Link Here
711
  width: auto;
711
  width: auto;
712
}
712
}
713
713
714
fieldset.rows li[aria-disabled="true"] {
715
    color: #999;
716
}
717
714
div.rows+div.rows {
718
div.rows+div.rows {
715
    margin-top : .6em;
719
    margin-top : .6em;
716
}
720
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +16 lines)
Lines 19-24 $(document).ready(function() { Link Here
19
    if ( $("#branches option:selected").length < 1 ) {
19
    if ( $("#branches option:selected").length < 1 ) {
20
        $("#branches option:first").attr("selected", "selected");
20
        $("#branches option:first").attr("selected", "selected");
21
    }
21
    }
22
23
    $("#opac_display").change( function() {
24
        if ( this.checked ) {
25
            $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
26
        } else {
27
            $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
28
        }
29
    } ).change();
22
} );
30
} );
23
31
24
function DoCancel(f) {
32
function DoCancel(f) {
Lines 155-160 function CheckAttributeTypeForm(f) { Link Here
155
          [% END %]
163
          [% END %]
156
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
164
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
157
       </li>
165
       </li>
166
       <li><label for="opac_editable">Editable in OPAC: </label>
167
          [% IF ( opac_editable_checked ) %]
168
            <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
169
          [% ELSE %]
170
            <input type="checkbox" id="opac_editable" name="opac_editable" />
171
          [% END %]
172
            <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above.)</span>
173
       </li>
158
       <li><label for="staff_searchable">Searchable: </label>
174
       <li><label for="staff_searchable">Searchable: </label>
159
          [% IF ( staff_searchable_checked ) %]
175
          [% IF ( staff_searchable_checked ) %]
160
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
176
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
161
- 

Return to bug 13757