From ae542fb8217b2435f59fb7bcca75f4ac06d9d180 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 30 Apr 2024 12:49:33 +0100 Subject: [PATCH] Bug 32610: (QA follow-up) Tidy Koha::Patron::Attribute Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/Patron/Attribute.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm index 00b55362ce..5fc1b9111d 100644 --- a/Koha/Patron/Attribute.pm +++ b/Koha/Patron/Attribute.pm @@ -98,7 +98,7 @@ sub authorised_value { authorised_value => $self->attribute, } ); - return unless $av->count; # Data inconsistency + return unless $av->count; # Data inconsistency return $av->next; } @@ -114,7 +114,7 @@ displayed instead of the code. =cut sub description { - my ( $self) = @_; + my ($self) = @_; if ( $self->type->authorised_value_category ) { my $av = $self->authorised_value; return $av ? $av->lib : ""; @@ -147,10 +147,10 @@ whether storing the current object state would break the repeatable constraint. sub repeatable_ok { - my ( $self ) = @_; + my ($self) = @_; my $ok = 1; - if ( ! $self->type->repeatable ) { + if ( !$self->type->repeatable ) { my $params = { borrowernumber => $self->borrowernumber, code => $self->code @@ -174,7 +174,7 @@ whether storing the current object state would break the unique constraint. sub unique_ok { - my ( $self ) = @_; + my ($self) = @_; my $ok = 1; if ( $self->type->unique_id ) { @@ -183,9 +183,7 @@ sub unique_ok { $params->{borrowernumber} = { '!=' => $self->borrowernumber } if $self->borrowernumber; $params->{id} = { '!=' => $self->id } if $self->in_storage; - my $unique_count = Koha::Patron::Attributes - ->search( $params ) - ->count; + my $unique_count = Koha::Patron::Attributes->search($params)->count; $ok = 0 if $unique_count > 0; } @@ -201,11 +199,11 @@ Checks if the value of the attribute is valid for the type sub value_ok { - my ( $self ) = @_; + my ($self) = @_; my $ok = 1; if ( $self->type->is_date ) { - eval { dt_from_string($self->attribute); }; + eval { dt_from_string( $self->attribute ); }; if ($@) { $ok = 0; } -- 2.39.5