|
Lines 146-158
sub _check_repeatable {
Link Here
|
| 146 |
my $self = shift; |
146 |
my $self = shift; |
| 147 |
|
147 |
|
| 148 |
if ( !$self->type->repeatable ) { |
148 |
if ( !$self->type->repeatable ) { |
| 149 |
my $attr_count = Koha::Patron::Attributes->search( |
149 |
my $params = { |
| 150 |
{ borrowernumber => $self->borrowernumber, |
150 |
borrowernumber => $self->borrowernumber, |
| 151 |
code => $self->code |
151 |
code => $self->code |
| 152 |
} |
152 |
}; |
| 153 |
)->count; |
153 |
|
|
|
154 |
$params->{id} = { '!=' => $self->id } |
| 155 |
if $self->in_storage; |
| 156 |
|
| 154 |
Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self ) |
157 |
Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self ) |
| 155 |
if $attr_count > 0; |
158 |
if Koha::Patron::Attributes->search($params)->count > 0; |
| 156 |
} |
159 |
} |
| 157 |
|
160 |
|
| 158 |
return $self; |
161 |
return $self; |
| 159 |
- |
|
|