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

(-)a/C4/Members/AttributeTypes.pm (-13 / +32 lines)
Lines 37-42 C4::Members::AttributeTypes - mananage extended patron attribute types Link Here
37
  $attr_type->repeatable($repeatable);
37
  $attr_type->repeatable($repeatable);
38
  $attr_type->unique_id($unique_id);
38
  $attr_type->unique_id($unique_id);
39
  $attr_type->opac_display($opac_display);
39
  $attr_type->opac_display($opac_display);
40
  $attr_type->opac_editable($opac_editable);
40
  $attr_type->staff_searchable($staff_searchable);
41
  $attr_type->staff_searchable($staff_searchable);
41
  $attr_type->authorised_value_category($authorised_value_category);
42
  $attr_type->authorised_value_category($authorised_value_category);
42
  $attr_type->store();
43
  $attr_type->store();
Lines 122-127 sub new { Link Here
122
    $self->{'repeatable'} = 0;
123
    $self->{'repeatable'} = 0;
123
    $self->{'unique_id'} = 0;
124
    $self->{'unique_id'} = 0;
124
    $self->{'opac_display'} = 0;
125
    $self->{'opac_display'} = 0;
126
    $self->{'opac_editable'} = 0;
125
    $self->{'staff_searchable'} = 0;
127
    $self->{'staff_searchable'} = 0;
126
    $self->{'display_checkout'} = 0;
128
    $self->{'display_checkout'} = 0;
127
    $self->{'authorised_value_category'} = '';
129
    $self->{'authorised_value_category'} = '';
Lines 163-168 sub fetch { Link Here
163
    $self->{'repeatable'}                = $row->{'repeatable'};
165
    $self->{'repeatable'}                = $row->{'repeatable'};
164
    $self->{'unique_id'}                 = $row->{'unique_id'};
166
    $self->{'unique_id'}                 = $row->{'unique_id'};
165
    $self->{'opac_display'}              = $row->{'opac_display'};
167
    $self->{'opac_display'}              = $row->{'opac_display'};
168
    $self->{'opac_editable'}             = $row->{'opac_editable'};
166
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
169
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
167
    $self->{'display_checkout'}          = $row->{'display_checkout'};
170
    $self->{'display_checkout'}          = $row->{'display_checkout'};
168
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
171
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
Lines 203-208 sub store { Link Here
203
                                         repeatable = ?,
206
                                         repeatable = ?,
204
                                         unique_id = ?,
207
                                         unique_id = ?,
205
                                         opac_display = ?,
208
                                         opac_display = ?,
209
                                         opac_editable = ?,
206
                                         staff_searchable = ?,
210
                                         staff_searchable = ?,
207
                                         authorised_value_category = ?,
211
                                         authorised_value_category = ?,
208
                                         display_checkout = ?,
212
                                         display_checkout = ?,
Lines 211-233 sub store { Link Here
211
                                     WHERE code = ?");
215
                                     WHERE code = ?");
212
    } else {
216
    } else {
213
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
217
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
214
                                        (description, repeatable, unique_id, opac_display,
218
                                        (description, repeatable, unique_id, opac_display, opac_editable,
215
                                         staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
219
                                         staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
216
                                        VALUES (?, ?, ?, ?,
220
                                        VALUES (?, ?, ?, ?,
217
                                                ?, ?, ?, ?, ?, ?)");
221
                                                ?, ?, ?, ?, ?, ?)");
218
    }
222
    }
219
    $sth->execute(
223
    $sth->bind_param(1, $self->{'description'});
220
        $self->{description},
224
    $sth->bind_param(2, $self->{'repeatable'});
221
        $self->{repeatable},
225
    $sth->bind_param(3, $self->{'unique_id'});
222
        $self->{unique_id},
226
    $sth->bind_param(4, $self->{'opac_display'});
223
        $self->{opac_display},
227
    $sth->bind_param(5, $self->{'opac_editable'});
224
        $self->{staff_searchable},
228
    $sth->bind_param(7, $self->{'staff_searchable'});
225
        $self->{authorised_value_category},
229
    $sth->bind_param(8, $self->{'authorised_value_category'});
226
        $self->{display_checkout},
230
    $sth->bind_param(9, $self->{'display_checkout'});
227
        $self->{category_code} || undef,
231
    $sth->bind_param(10, $self->{'category_code'} || undef);
228
        $self->{class},
232
    $sth->bind_param(11, $self->{'class'});
229
        $self->{code},
233
    $sth->bind_param(12, $self->{'code'});
230
    );
234
    $sth->execute;
231
235
232
    if ( defined $$self{branches} ) {
236
    if ( defined $$self{branches} ) {
233
        $sth = $dbh->prepare("DELETE FROM borrower_attribute_types_branches WHERE bat_code = ?");
237
        $sth = $dbh->prepare("DELETE FROM borrower_attribute_types_branches WHERE bat_code = ?");
Lines 335-340 sub opac_display { Link Here
335
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
339
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
336
}
340
}
337
341
342
=head2 opac_editable
343
344
  my $opac_editable = $attr_type->opac_editable();
345
  $attr_type->opac_editable($opac_editable);
346
347
Accessor.  The C<$opac_editable> argument
348
is interpreted as a Perl boolean.
349
350
=cut
351
352
sub opac_editable {
353
    my $self = shift;
354
    @_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
355
}
356
338
=head2 staff_searchable
357
=head2 staff_searchable
339
358
340
  my $staff_searchable = $attr_type->staff_searchable();
359
  my $staff_searchable = $attr_type->staff_searchable();
(-)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 243-248 sub edit_attribute_type_form { Link Here
243
    if ($attr_type->opac_display()) {
248
    if ($attr_type->opac_display()) {
244
        $template->param(opac_display_checked => 1);
249
        $template->param(opac_display_checked => 1);
245
    }
250
    }
251
    if ($attr_type->opac_editable()) {
252
        $template->param(opac_editable_checked => 1);
253
    }
246
    if ($attr_type->staff_searchable()) {
254
    if ($attr_type->staff_searchable()) {
247
        $template->param(staff_searchable_checked => 1);
255
        $template->param(staff_searchable_checked => 1);
248
    }
256
    }
(-)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 215-220 CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field Link Here
215
  `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)
215
  `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)
216
  `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
216
  `unique_id` tinyint(1) NOT NULL default 0, -- defines if this value needs to be unique (1 for yes, 0 for no)
217
  `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)
217
  `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)
218
  `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)
218
  `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)
219
  `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)
219
  `authorised_value_category` varchar(32) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
220
  `authorised_value_category` varchar(32) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
220
  `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
221
  `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
(-)a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css (+4 lines)
Lines 701-706 fieldset.action, div.action { Link Here
701
  width: auto;
701
  width: auto;
702
}
702
}
703
703
704
fieldset.rows li[aria-disabled="true"] {
705
    color: #999;
706
}
707
704
div.rows+div.rows {
708
div.rows+div.rows {
705
    margin-top : .6em;
709
    margin-top : .6em;
706
}
710
}
(-)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
</script>
32
</script>
Lines 122-127 $(document).ready(function() { Link Here
122
          [% END %]
130
          [% END %]
123
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
131
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
124
       </li>
132
       </li>
133
       <li><label for="opac_editable">Editable in OPAC: </label>
134
          [% IF ( opac_editable_checked ) %]
135
            <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
136
          [% ELSE %]
137
            <input type="checkbox" id="opac_editable" name="opac_editable" />
138
          [% END %]
139
            <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above.)</span>
140
       </li>
125
       <li><label for="staff_searchable">Searchable: </label>
141
       <li><label for="staff_searchable">Searchable: </label>
126
          [% IF ( staff_searchable_checked ) %]
142
          [% IF ( staff_searchable_checked ) %]
127
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
143
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
128
- 

Return to bug 13757