From 359c1661408dfa39910e6744233ee748332ec1a8 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 Signed-off-by: Jonathan Druart --- 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 f0777a6520..aaaefbcbb8 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.39.5