@@ -, +, @@
---
C4/Members/AttributeTypes.pm | 31 +++++++++++++++++--
C4/Members/Attributes.pm | 3 +-
admin/patron-attr-types.pl | 9 +++++-
circ/circulation.pl | 3 ++
.../0009-patron-attr-display-checkout.pl | 7 ++++
installer/data/mysql/kohastructure.sql | 1 +
.../intranet-tmpl/prog/en/includes/circ-menu.inc | 7 ++++
.../intranet-tmpl/prog/en/includes/circ-menu.tt | 7 ++++
.../prog/en/modules/admin/patron-attr-types.tt | 7 ++++-
members/boraccount.pl | 6 +++-
members/mancredit.pl | 3 ++
members/maninvoice.pl | 3 ++
members/member-flags.pl | 5 ++-
members/member-password.pl | 7 +++-
members/messaging.pl | 3 ++
members/moremember.pl | 3 ++
members/notices.pl | 5 ++-
members/pay.pl | 2 +
members/readingrec.pl | 6 +++-
19 files changed, 105 insertions(+), 13 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl
--- a/C4/Members/AttributeTypes.pm
+++ a/C4/Members/AttributeTypes.pm
@@ -118,6 +118,7 @@ sub new {
$self->{'opac_display'} = 0;
$self->{'password_allowed'} = 0;
$self->{'staff_searchable'} = 0;
+ $self->{'display_checkout'} = 0;
$self->{'authorised_value_category'} = '';
bless $self, $class;
@@ -152,6 +153,7 @@ sub fetch {
$self->{'opac_display'} = $row->{'opac_display'};
$self->{'password_allowed'} = $row->{'password_allowed'};
$self->{'staff_searchable'} = $row->{'staff_searchable'};
+ $self->{'display_checkout'} = $row->{'display_checkout'};
$self->{'authorised_value_category'} = $row->{'authorised_value_category'};
bless $self, $class;
@@ -182,14 +184,15 @@ sub store {
opac_display = ?,
password_allowed = ?,
staff_searchable = ?,
- authorised_value_category = ?
+ authorised_value_category = ?,
+ display_checkout = ?
WHERE code = ?");
} else {
$sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types
(description, repeatable, unique_id, opac_display, password_allowed,
- staff_searchable, authorised_value_category, code)
+ staff_searchable, authorised_value_category, display_checkout, code)
VALUES (?, ?, ?, ?, ?,
- ?, ?, ?)");
+ ?, ?, ?, ?)");
}
$sth->bind_param(1, $self->{'description'});
$sth->bind_param(2, $self->{'repeatable'});
@@ -198,7 +201,8 @@ sub store {
$sth->bind_param(5, $self->{'password_allowed'});
$sth->bind_param(6, $self->{'staff_searchable'});
$sth->bind_param(7, $self->{'authorised_value_category'});
- $sth->bind_param(8, $self->{'code'});
+ $sth->bind_param(8, $self->{'display_checkout'});
+ $sth->bind_param(9, $self->{'code'});
$sth->execute;
}
@@ -304,6 +308,25 @@ sub staff_searchable {
@_ ? $self->{'staff_searchable'} = ((shift) ? 1 : 0) : $self->{'staff_searchable'};
}
+=head2 display_checkout
+
+=over 4
+
+my $display_checkout = $attr_type->display_checkout();
+$attr_type->display_checkout($display_checkout);
+
+=back
+
+Accessor. The C<$display_checkout> argument
+is interpreted as a Perl boolean.
+
+=cut
+
+sub display_checkout {
+ my $self = shift;
+ @_ ? $self->{'display_checkout'} = ((shift) ? 1 : 0) : $self->{'display_checkout'};
+}
+
=head2 authorised_value_category
my $authorised_value_category = $attr_type->authorised_value_category();
--- a/C4/Members/Attributes.pm
+++ a/C4/Members/Attributes.pm
@@ -72,7 +72,7 @@ sub GetBorrowerAttributes {
my $opac_only = @_ ? shift : 0;
my $dbh = C4::Context->dbh();
- my $query = "SELECT code, description, attribute, lib, password
+ my $query = "SELECT code, description, attribute, lib, password, display_checkout
FROM borrower_attributes
JOIN borrower_attribute_types USING (code)
LEFT JOIN authorised_values ON (category = authorised_value_category AND attribute = authorised_value)
@@ -89,6 +89,7 @@ sub GetBorrowerAttributes {
value => $row->{'attribute'},
value_description => $row->{'lib'},
password => $row->{'password'},
+ display_checkout => $row->{'display_checkout'},
}
}
return \@results;
--- a/admin/patron-attr-types.pl
+++ a/admin/patron-attr-types.pl
@@ -106,6 +106,9 @@ sub error_add_attribute_type_form {
if ($input->param('staff_searchable')) {
$template->param(staff_searchable_checked => 1);
}
+ if ($input->param('display_checkout')) {
+ $template->param(display_checkout_checked => 'checked="checked"');
+ }
$template->param(
attribute_type_form => 1,
@@ -147,6 +150,8 @@ sub add_update_attribute_type {
$attr_type->authorised_value_category($authorised_value_category);
my $password_allowed = $input->param('password_allowed');
$attr_type->password_allowed($password_allowed);
+ my $display_checkout = $input->param('display_checkout');
+ $attr_type->display_checkout($display_checkout);
if ($op eq 'edit') {
$template->param(edited_attribute_type => $attr_type->code());
@@ -222,7 +227,9 @@ sub edit_attribute_type_form {
if ($attr_type->staff_searchable()) {
$template->param(staff_searchable_checked => 1);
}
-
+ if ($attr_type->display_checkout()) {
+ $template->param(display_checkout_checked => 'checked="checked"');
+ }
authorised_value_category_list($template, $attr_type->authorised_value_category());
$template->param(
--- a/circ/circulation.pl
+++ a/circ/circulation.pl
@@ -35,6 +35,7 @@ use C4::Biblio;
use C4::Reserves;
use C4::Context;
use CGI::Session;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
use Date::Calc qw(
Today
@@ -635,6 +636,7 @@ my $fast_cataloging = 0;
if (defined getframeworkinfo('FA')) {
$fast_cataloging = 1
}
+my $attributes = GetBorrowerAttributes($borrowernumber);
$template->param(
lib_messages_loop => $lib_messages_loop,
@@ -684,6 +686,7 @@ $template->param(
circview => 1,
soundon => C4::Context->preference("SoundOn"),
fast_cataloging => $fast_cataloging,
+ extendedattributes => $attributes,
);
# save stickyduedate to session
--- a/installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl
+++ a/installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl
@@ -0,0 +1,7 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+use C4::Context;
+my $dbh=C4::Context->dbh;
+$dbh->do("ALTER TABLE borrower_attribute_types ADD COLUMN `display_checkout` TINYINT(1) NOT NULL DEFAULT '0';");
+print "Upgrade done (Added a display_checkout field in borrower_attribute_types table)\n";
--- a/installer/data/mysql/kohastructure.sql
+++ a/installer/data/mysql/kohastructure.sql
@@ -284,6 +284,7 @@ CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field
`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)
`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)
`authorised_value_category` varchar(10) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
+ `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
PRIMARY KEY (`code`),
KEY `auth_val_cat_idx` (`authorised_value_category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -48,6 +48,13 @@
No email stored.
[% END %]
[% END %]
+ [% FOREACH extendedattribute IN extendedattributes %]
+ [% IF ( extendedattribute.display_checkout ) %]
+ [% IF ( extendedattribute.value ) %]
+
[% extendedattribute.description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]
+ [% END %]
+ [% END %]
+ [% END %]
Category: [% categoryname %] ([% categorycode %])
Home Library: [% IF ( branchname ) %][% branchname %][% ELSE %][% branch %][% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
@@ -50,6 +50,13 @@ in the global namespace %]
No email stored.
[% END %]
[% END %]
+ [% FOREACH extendedattribute IN borrower.extendedattributes %]
+ [% IF ( extendedattribute.display_checkout ) %]
+ [% IF ( extendedattribute.value ) %]
+
[% extendedattribute.description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]
Because the 'ExtendedPatronAttributes` system preference is currently not enabled, extended patron attributes cannot be given to patron records. Go here if you wish to enable this feature.
+
Because the 'ExtendedPatronAttributes` system preference is currently not enabled, extended patron attributes cannot be given to patron records. Go here if you wish to enable this feature.
[% END %]
[% IF ( attribute_type_form ) %]
@@ -158,6 +158,11 @@ function CheckAttributeTypeForm(f) {
[% END %]
Check to make this attribute staff_searchable in the staff patron search.
+
+
+ Check to show this attribute in patron check-out.
+