Bug 17828: Use Koha::Patron::Attributes instead of _resultset

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-03-28 11:39:09 -03:00 committed by Kyle M Hall
parent e610025bab
commit dd54e970a5
1 changed files with 2 additions and 4 deletions

View File

@ -109,8 +109,7 @@ sub _check_repeatable {
my $self = shift;
if ( !$self->type->repeatable ) {
my $attr_count
= Koha::Database->new->schema->resultset( $self->_type )->search(
my $attr_count = Koha::Patron::Attributes->search(
{ borrowernumber => $self->borrowernumber,
code => $self->code
}
@ -135,8 +134,7 @@ sub _check_unique_id {
my $self = shift;
if ( $self->type->unique_id ) {
my $unique_count
= Koha::Database->new->schema->resultset( $self->_type )
my $unique_count = Koha::Patron::Attributes
->search( { code => $self->code, attribute => $self->attribute } )
->count;
Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw()