|
Lines 40-45
my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes();
Link Here
|
| 40 |
my $attr_type = C4::Members::AttributeTypes->new($code, $description); |
40 |
my $attr_type = C4::Members::AttributeTypes->new($code, $description); |
| 41 |
$attr_type->code($code); |
41 |
$attr_type->code($code); |
| 42 |
$attr_type->description($description); |
42 |
$attr_type->description($description); |
|
|
43 |
$attr_type->mandatory($mandatory); |
| 43 |
$attr_type->repeatable($repeatable); |
44 |
$attr_type->repeatable($repeatable); |
| 44 |
$attr_type->unique_id($unique_id); |
45 |
$attr_type->unique_id($unique_id); |
| 45 |
$attr_type->opac_display($opac_display); |
46 |
$attr_type->opac_display($opac_display); |
|
Lines 108-113
sub new {
Link Here
|
| 108 |
|
109 |
|
| 109 |
$self->{'code'} = shift; |
110 |
$self->{'code'} = shift; |
| 110 |
$self->{'description'} = shift; |
111 |
$self->{'description'} = shift; |
|
|
112 |
$self->{'mandatory'} = 0; |
| 111 |
$self->{'repeatable'} = 0; |
113 |
$self->{'repeatable'} = 0; |
| 112 |
$self->{'unique_id'} = 0; |
114 |
$self->{'unique_id'} = 0; |
| 113 |
$self->{'opac_display'} = 0; |
115 |
$self->{'opac_display'} = 0; |
|
Lines 146-151
sub fetch {
Link Here
|
| 146 |
|
148 |
|
| 147 |
$self->{'code'} = $row->{'code'}; |
149 |
$self->{'code'} = $row->{'code'}; |
| 148 |
$self->{'description'} = $row->{'description'}; |
150 |
$self->{'description'} = $row->{'description'}; |
|
|
151 |
$self->{'mandatory'} = $row->{'mandatory'}; |
| 149 |
$self->{'repeatable'} = $row->{'repeatable'}; |
152 |
$self->{'repeatable'} = $row->{'repeatable'}; |
| 150 |
$self->{'unique_id'} = $row->{'unique_id'}; |
153 |
$self->{'unique_id'} = $row->{'unique_id'}; |
| 151 |
$self->{'opac_display'} = $row->{'opac_display'}; |
154 |
$self->{'opac_display'} = $row->{'opac_display'}; |
|
Lines 185-198
sub store {
Link Here
|
| 185 |
opac_display = ?, |
188 |
opac_display = ?, |
| 186 |
password_allowed = ?, |
189 |
password_allowed = ?, |
| 187 |
staff_searchable = ?, |
190 |
staff_searchable = ?, |
| 188 |
authorised_value_category = ? |
191 |
authorised_value_category = ?, |
|
|
192 |
mandatory = ? |
| 189 |
WHERE code = ?"); |
193 |
WHERE code = ?"); |
| 190 |
} else { |
194 |
} else { |
| 191 |
$sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types |
195 |
$sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types |
| 192 |
(description, repeatable, unique_id, opac_display, password_allowed, |
196 |
(description, repeatable, unique_id, opac_display, password_allowed, |
| 193 |
staff_searchable, authorised_value_category, code) |
197 |
staff_searchable, authorised_value_category, mandatory, code) |
| 194 |
VALUES (?, ?, ?, ?, ?, |
198 |
VALUES (?, ?, ?, ?, ?, |
| 195 |
?, ?, ?)"); |
199 |
?, ?, ?, ? )"); |
| 196 |
} |
200 |
} |
| 197 |
$sth->bind_param(1, $self->{'description'}); |
201 |
$sth->bind_param(1, $self->{'description'}); |
| 198 |
$sth->bind_param(2, $self->{'repeatable'}); |
202 |
$sth->bind_param(2, $self->{'repeatable'}); |
|
Lines 201-207
sub store {
Link Here
|
| 201 |
$sth->bind_param(5, $self->{'password_allowed'}); |
205 |
$sth->bind_param(5, $self->{'password_allowed'}); |
| 202 |
$sth->bind_param(6, $self->{'staff_searchable'}); |
206 |
$sth->bind_param(6, $self->{'staff_searchable'}); |
| 203 |
$sth->bind_param(7, $self->{'authorised_value_category'}); |
207 |
$sth->bind_param(7, $self->{'authorised_value_category'}); |
| 204 |
$sth->bind_param(8, $self->{'code'}); |
208 |
$sth->bind_param(8, $self->{'mandatory'}); |
|
|
209 |
$sth->bind_param(9, $self->{'code'}); |
| 205 |
$sth->execute; |
210 |
$sth->execute; |
| 206 |
|
211 |
|
| 207 |
} |
212 |
} |
|
Lines 243-248
sub description {
Link Here
|
| 243 |
@_ ? $self->{'description'} = shift : $self->{'description'}; |
248 |
@_ ? $self->{'description'} = shift : $self->{'description'}; |
| 244 |
} |
249 |
} |
| 245 |
|
250 |
|
|
|
251 |
=head2 mandatory |
| 252 |
|
| 253 |
=over 4 |
| 254 |
|
| 255 |
my $mandatory = $attr_type->mandatory(); |
| 256 |
$attr_type->mandatory($mandatory); |
| 257 |
|
| 258 |
=back |
| 259 |
|
| 260 |
Accessor. The C<$mandatory> argument |
| 261 |
is interpreted as a Perl boolean. |
| 262 |
|
| 263 |
=cut |
| 264 |
|
| 265 |
sub mandatory { |
| 266 |
my $self = shift; |
| 267 |
@_ ? $self->{'mandatory'} = ((shift) ? 1 : 0) : $self->{'mandatory'}; |
| 268 |
} |
| 269 |
|
| 246 |
=head2 repeatable |
270 |
=head2 repeatable |
| 247 |
|
271 |
|
| 248 |
=over 4 |
272 |
=over 4 |