#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
#use warnings; FIXME - Bug 2505
use C4::Context;
-use vars qw($VERSION);
-BEGIN {
- # set the version for version checking
- $VERSION = 3.07.00.049;
-}
=head1 NAME
$attr_type->repeatable($repeatable);
$attr_type->unique_id($unique_id);
$attr_type->opac_display($opac_display);
- $attr_type->password_allowed($password_allowed);
+ $attr_type->opac_editable($opac_editable);
$attr_type->staff_searchable($staff_searchable);
$attr_type->authorised_value_category($authorised_value_category);
$attr_type->store();
return \%hash;
}
-=head2 AttributeTypeExists
-
- my $have_attr_xyz = C4::Members::AttributeTypes::AttributeTypeExists($code)
-
-Returns true if we have attribute type C<$code>
-in the database.
-
-=cut
-
-sub AttributeTypeExists {
- my ($code) = @_;
- my $dbh = C4::Context->dbh;
- my $exists = $dbh->selectrow_array("SELECT code FROM borrower_attribute_types WHERE code = ?", undef, $code);
- return $exists;
-}
-
=head1 METHODS
my $attr_type = C4::Members::AttributeTypes->new($code, $description);
$self->{'repeatable'} = 0;
$self->{'unique_id'} = 0;
$self->{'opac_display'} = 0;
- $self->{'password_allowed'} = 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->{'password_allowed'} = $row->{'password_allowed'};
+ $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 = ?,
- password_allowed = ?,
+ 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, password_allowed,
- 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->bind_param(1, $self->{'description'});
- $sth->bind_param(2, $self->{'repeatable'});
- $sth->bind_param(3, $self->{'unique_id'});
- $sth->bind_param(4, $self->{'opac_display'});
- $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->{'display_checkout'});
- $sth->bind_param(9, $self->{'category_code'} || undef);
- $sth->bind_param(10, $self->{'class'});
- $sth->bind_param(11, $self->{'code'});
- $sth->execute;
+
+ $sth->execute(
+ $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} ) {
$sth = $dbh->prepare("DELETE FROM borrower_attribute_types_branches WHERE bat_code = ?");
my $self = shift;
@_ ? $self->{'unique_id'} = ((shift) ? 1 : 0) : $self->{'unique_id'};
}
+
=head2 opac_display
my $opac_display = $attr_type->opac_display();
my $self = shift;
@_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
}
-=head2 password_allowed
- my $password_allowed = $attr_type->password_allowed();
- $attr_type->password_allowed($password_allowed);
+=head2 opac_editable
+
+ my $opac_editable = $attr_type->opac_editable();
+ $attr_type->opac_editable($opac_editable);
-Accessor. The C<$password_allowed> argument
+Accessor. The C<$opac_editable> argument
is interpreted as a Perl boolean.
=cut
-sub password_allowed {
+sub opac_editable {
my $self = shift;
- @_ ? $self->{'password_allowed'} = ((shift) ? 1 : 0) : $self->{'password_allowed'};
+ @_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
}
+
=head2 staff_searchable
my $staff_searchable = $attr_type->staff_searchable();