View | Details | Raw Unified | Return to bug 28031
Collapse All | Expand All

(-)a/Koha/Patron/Attribute.pm (-6 / +15 lines)
Lines 52-61 sub store { Link Here
52
        unless $type;
52
        unless $type;
53
53
54
    Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self )
54
    Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self )
55
        unless $self->repeatable_ok($type);
55
        unless $self->repeatable_ok;
56
56
57
    Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw( attribute => $self )
57
    Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw( attribute => $self )
58
        unless $self->unique_ok($type);
58
        unless $self->unique_ok;
59
59
60
    return $self->SUPER::store();
60
    return $self->SUPER::store();
61
}
61
}
Lines 72-78 sub type { Link Here
72
72
73
    my $self = shift;
73
    my $self = shift;
74
74
75
    return scalar Koha::Patron::Attribute::Types->find( $self->code );
75
    $self->{_type} ||= Koha::Patron::Attribute::Types->find( $self->code );
76
77
    return $self->{_type};
76
}
78
}
77
79
78
=head3 authorised_value
80
=head3 authorised_value
Lines 145-151 whether storing the current object state would break the repeatable constraint. Link Here
145
147
146
sub repeatable_ok {
148
sub repeatable_ok {
147
149
148
    my ( $self, $type ) = @_;
150
    my ( $self ) = @_;
151
152
    my $type = $self->type;
153
    Koha::Exceptions::Patron::Attribute::InvalidType->throw( type => $self->code )
154
        unless $type;
149
155
150
    my $ok = 1;
156
    my $ok = 1;
151
    if ( !$type->repeatable ) {
157
    if ( !$type->repeatable ) {
Lines 172-178 whether storing the current object state would break the unique constraint. Link Here
172
178
173
sub unique_ok {
179
sub unique_ok {
174
180
175
    my ( $self, $type ) = @_;
181
    my ( $self ) = @_;
182
183
    my $type = $self->type;
184
    Koha::Exceptions::Patron::Attribute::InvalidType->throw( type => $self->code )
185
        unless $type;
176
186
177
    my $ok = 1;
187
    my $ok = 1;
178
    if ( $type->unique_id ) {
188
    if ( $type->unique_id ) {
179
- 

Return to bug 28031