$attr_type->repeatable($repeatable);
$attr_type->unique_id($unique_id);
$attr_type->opac_display($opac_display);
+ $attr_type->opac_editable($opac_editable);
$attr_type->staff_searchable($staff_searchable);
$attr_type->authorised_value_category($authorised_value_category);
$attr_type->store();
$self->{'repeatable'} = 0;
$self->{'unique_id'} = 0;
$self->{'opac_display'} = 0;
+ $self->{'opac_editable'} = 0;
$self->{'staff_searchable'} = 0;
$self->{'display_checkout'} = 0;
$self->{'authorised_value_category'} = '';
$self->{'repeatable'} = $row->{'repeatable'};
$self->{'unique_id'} = $row->{'unique_id'};
$self->{'opac_display'} = $row->{'opac_display'};
+ $self->{'opac_editable'} = $row->{'opac_editable'};
$self->{'staff_searchable'} = $row->{'staff_searchable'};
$self->{'display_checkout'} = $row->{'display_checkout'};
$self->{'authorised_value_category'} = $row->{'authorised_value_category'};
repeatable = ?,
unique_id = ?,
opac_display = ?,
+ opac_editable = ?,
staff_searchable = ?,
authorised_value_category = ?,
display_checkout = ?,
WHERE code = ?");
} else {
$sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types
- (description, repeatable, unique_id, opac_display,
- staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
- VALUES (?, ?, ?, ?,
- ?, ?, ?, ?, ?, ?)");
+ ( description,
+ repeatable,
+ unique_id,
+ opac_display,
+ opac_editable,
+ staff_searchable,
+ authorised_value_category,
+ display_checkout,
+ category_code,
+ class,
+ code
+ )
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
+
$sth->execute(
- $self->{description},
- $self->{repeatable},
- $self->{unique_id},
- $self->{opac_display},
- $self->{staff_searchable},
- $self->{authorised_value_category},
- $self->{display_checkout},
- $self->{category_code} || undef,
- $self->{class},
- $self->{code},
+ $self->{'description'},
+ $self->{'repeatable'},
+ $self->{'unique_id'},
+ $self->{'opac_display'},
+ $self->{'opac_editable'},
+ $self->{'staff_searchable'} || 0,
+ $self->{'authorised_value_category'},
+ $self->{'display_checkout'},
+ $self->{'category_code'} || undef,
+ $self->{'class'},
+ $self->{'code'}
);
if ( defined $$self{branches} ) {
@_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
}
+=head2 opac_editable
+
+ my $opac_editable = $attr_type->opac_editable();
+ $attr_type->opac_editable($opac_editable);
+
+Accessor. The C<$opac_editable> argument
+is interpreted as a Perl boolean.
+
+=cut
+
+sub opac_editable {
+ my $self = shift;
+ @_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
+}
+
=head2 staff_searchable
my $staff_searchable = $attr_type->staff_searchable();
my $op = $input->param('op') || '';
-our ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/patron-attr-types.tt",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 'parameters_remaining_permissions'},
- debug => 1,
- });
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ { template_name => "admin/patron-attr-types.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { parameters => 'parameters_remaining_permissions' }
+ }
+);
+
$template->param(script_name => $script_name);
if ($input->param('opac_display')) {
$template->param(opac_display_checked => 1);
}
+ if ($input->param('opac_editable')) {
+ $template->param(opac_editable_checked => 1);
+ }
if ($input->param('staff_searchable')) {
$template->param(staff_searchable_checked => 1);
}
my $opac_display = $input->param('opac_display');
$attr_type->opac_display($opac_display);
+ my $opac_editable = $input->param('opac_editable');
+ $attr_type->opac_editable($opac_editable);
my $staff_searchable = $input->param('staff_searchable');
$attr_type->staff_searchable($staff_searchable);
my $authorised_value_category = $input->param('authorised_value_category');
if ($attr_type->opac_display()) {
$template->param(opac_display_checked => 1);
}
+ if ($attr_type->opac_editable()) {
+ $template->param(opac_editable_checked => 1);
+ }
if ($attr_type->staff_searchable()) {
$template->param(staff_searchable_checked => 1);
}
if ( $("#branches option:selected").length < 1 ) {
$("#branches option:first").attr("selected", "selected");
}
+
+ $("#opac_display").change( function() {
+ if ( this.checked ) {
+ $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
+ } else {
+ $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
+ }
+ } ).change();
} );
//]]>
</script>
[% END %]
<span>Check to display this attribute on a patron's details page in the OPAC.</span>
</li>
+ <li><label for="opac_editable">Editable in OPAC: </label>
+ [% IF ( opac_editable_checked ) %]
+ <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
+ [% ELSE %]
+ <input type="checkbox" id="opac_editable" name="opac_editable" />
+ [% END %]
+ <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above, does not work with <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationVerifyByEmail" target="_blank">PatronSelfRegistrationVerifyByEmail</a>.)</span>
+ </li>
<li><label for="staff_searchable">Searchable: </label>
[% IF ( staff_searchable_checked ) %]
<input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />