From ed4fdda569120a66248bd195cce8383412e3066a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 9 Apr 2021 15:26:45 +0200 Subject: [PATCH] Bug 28031: Remove type from parameter of *_ok methods --- Koha/Patron/Attribute.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm index f0777a6520a..aaaefbcbb80 100644 --- a/Koha/Patron/Attribute.pm +++ b/Koha/Patron/Attribute.pm @@ -46,16 +46,14 @@ sub store { my $self = shift; - my $type = $self->type; - Koha::Exceptions::Patron::Attribute::InvalidType->throw( type => $self->code ) - unless $type; + unless $self->type; Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self ) - unless $self->repeatable_ok($type); + unless $self->repeatable_ok(); Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw( attribute => $self ) - unless $self->unique_ok($type); + unless $self->unique_ok(); return $self->SUPER::store(); } @@ -145,10 +143,10 @@ whether storing the current object state would break the repeatable constraint. sub repeatable_ok { - my ( $self, $type ) = @_; + my ( $self ) = @_; my $ok = 1; - if ( !$type->repeatable ) { + if ( ! $self->type->repeatable ) { my $params = { borrowernumber => $self->borrowernumber, code => $self->code @@ -172,10 +170,10 @@ whether storing the current object state would break the unique constraint. sub unique_ok { - my ( $self, $type ) = @_; + my ( $self ) = @_; my $ok = 1; - if ( $type->unique_id ) { + if ( $self->type->unique_id ) { my $params = { code => $self->code, attribute => $self->attribute }; $params->{borrowernumber} = { '!=' => $self->borrowernumber } if $self->borrowernumber; -- 2.20.1