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 118-123 sub error_add_attribute_type_form { Link Here
118
    if ($input->param('opac_display')) {
118
    if ($input->param('opac_display')) {
119
        $template->param(opac_display_checked => 1);
119
        $template->param(opac_display_checked => 1);
120
    }
120
    }
121
    if ($input->param('opac_editable')) {
122
        $template->param(opac_editable_checked => 1);
123
    }
121
    if ($input->param('staff_searchable')) {
124
    if ($input->param('staff_searchable')) {
122
        $template->param(staff_searchable_checked => 1);
125
        $template->param(staff_searchable_checked => 1);
123
    }
126
    }
Lines 162-167 sub add_update_attribute_type { Link Here
162
165
163
    my $opac_display = $input->param('opac_display');
166
    my $opac_display = $input->param('opac_display');
164
    $attr_type->opac_display($opac_display);
167
    $attr_type->opac_display($opac_display);
168
    my $opac_editable = $input->param('opac_editable');
169
    $attr_type->opac_editable($opac_editable);
165
    my $staff_searchable = $input->param('staff_searchable');
170
    my $staff_searchable = $input->param('staff_searchable');
166
    $attr_type->staff_searchable($staff_searchable);
171
    $attr_type->staff_searchable($staff_searchable);
167
    my $authorised_value_category = $input->param('authorised_value_category');
172
    my $authorised_value_category = $input->param('authorised_value_category');
Lines 242-247 sub edit_attribute_type_form { Link Here
242
    if ($attr_type->opac_display()) {
247
    if ($attr_type->opac_display()) {
243
        $template->param(opac_display_checked => 1);
248
        $template->param(opac_display_checked => 1);
244
    }
249
    }
250
    if ($attr_type->opac_editable()) {
251
        $template->param(opac_editable_checked => 1);
252
    }
245
    if ($attr_type->staff_searchable()) {
253
    if ($attr_type->staff_searchable()) {
246
        $template->param(staff_searchable_checked => 1);
254
        $template->param(staff_searchable_checked => 1);
247
    }
255
    }
(-)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 20-25 $(document).ready(function() { Link Here
20
    if ( $("#branches option:selected").length < 1 ) {
20
    if ( $("#branches option:selected").length < 1 ) {
21
        $("#branches option:first").attr("selected", "selected");
21
        $("#branches option:first").attr("selected", "selected");
22
    }
22
    }
23
24
    $("#opac_display").change( function() {
25
        if ( this.checked ) {
26
            $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
27
        } else {
28
            $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
29
        }
30
    } ).change();
23
} );
31
} );
24
//]]>
32
//]]>
25
</script>
33
</script>
Lines 123-128 $(document).ready(function() { Link Here
123
          [% END %]
131
          [% END %]
124
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
132
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
125
       </li>
133
       </li>
134
       <li><label for="opac_editable">Editable in OPAC: </label>
135
          [% IF ( opac_editable_checked ) %]
136
            <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
137
          [% ELSE %]
138
            <input type="checkbox" id="opac_editable" name="opac_editable" />
139
          [% END %]
140
            <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above.)</span>
141
       </li>
126
       <li><label for="staff_searchable">Searchable: </label>
142
       <li><label for="staff_searchable">Searchable: </label>
127
          [% IF ( staff_searchable_checked ) %]
143
          [% IF ( staff_searchable_checked ) %]
128
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
144
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
129
- 

Return to bug 13757