<<

NAME

C4::Members::AttributeTypes - mananage extended patron attribute types

SYNOPSIS

  my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes();

  my $attr_type = C4::Members::AttributeTypes->new($code, $description);
  $attr_type->code($code);
  $attr_type->description($description);
  $attr_type->repeatable($repeatable);
  $attr_type->unique_id($unique_id);
  $attr_type->opac_display($opac_display);
  $attr_type->password_allowed($password_allowed);
  $attr_type->staff_searchable($staff_searchable);
  $attr_type->authorised_value_category($authorised_value_category);
  $attr_type->store();
  $attr_type->delete();

  my $attr_type = C4::Members::AttributeTypes->fetch($code);
  $attr_type = C4::Members::AttributeTypes->delete($code);

FUNCTIONS

GetAttributeTypes

  my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes($all_fields);

Returns an array of hashrefs of each attribute type defined in the database. The array is sorted by code. Each hashref contains at least the following fields:

 - code
 - description

If $all_fields is true, then each hashref also contains the other fields from borrower_attribute_types.

METHODS

  my $attr_type = C4::Members::AttributeTypes->new($code, $description);

Create a new attribute type.

fetch

  my $attr_type = C4::Members::AttributeTypes->fetch($code);

Fetches an attribute type from the database. If no type with the given $code exists, returns undef.

store

  $attr_type->store();

Stores attribute type in the database. If the type previously retrieved from the database via the fetch() method, the DB representation of the type is replaced.

code

  my $code = $attr_type->code();
  $attr_type->code($code);

Accessor. Note that the code is immutable once a type is created or fetched from the database.

description

  my $description = $attr_type->description();
  $attr_type->description($description);

Accessor.

repeatable

  my $repeatable = $attr_type->repeatable();
  $attr_type->repeatable($repeatable);

Accessor. The $repeatable argument is interpreted as a Perl boolean.

unique_id

  my $unique_id = $attr_type->unique_id();
  $attr_type->unique_id($unique_id);

Accessor. The $unique_id argument is interpreted as a Perl boolean.

opac_display

  my $opac_display = $attr_type->opac_display();
  $attr_type->opac_display($opac_display);

Accessor. The $opac_display argument is interpreted as a Perl boolean.

password_allowed

  my $password_allowed = $attr_type->password_allowed();
  $attr_type->password_allowed($password_allowed);

Accessor. The $password_allowed argument is interpreted as a Perl boolean.

staff_searchable

  my $staff_searchable = $attr_type->staff_searchable();
  $attr_type->staff_searchable($staff_searchable);

Accessor. The $staff_searchable argument is interpreted as a Perl boolean.

authorised_value_category

  my $authorised_value_category = $attr_type->authorised_value_category();
  $attr_type->authorised_value_category($authorised_value_category);

Accessor.

delete

  $attr_type->delete();
  C4::Members::AttributeTypes->delete($code);

Delete an attribute type from the database. The attribute type may be specified either by an object or by a code.

num_patrons

  my $count = $attr_type->num_patrons();

Returns the number of patron records that use this attribute type.

get_patrons

  my @borrowernumbers = $attr_type->get_patrons($attribute);

Returns the borrowernumber of the patron records that have an attribute with the specifie value.

AUTHOR

Koha Development Team <http://koha-community.org/>

Galen Charlton <galen.charlton@liblime.com>

<<