#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Carp;
use List::MoreUtils qw( any uniq );
use JSON qw( to_json );
-use Text::Unaccent qw( unac_string );
+use Unicode::Normalize;
use C4::Context;
use C4::Log;
$self->surname( uc($self->surname) )
if C4::Context->preference("uppercasesurnames");
+ $self->relationship(undef) # We do not want to store an empty string in this field
+ if defined $self->relationship
+ and $self->relationship eq "";
+
unless ( $self->in_storage ) { #AddMember
# Generate a valid userid/login if needed
sub delete {
my ($self) = @_;
- my $deleted;
$self->_result->result_source->schema->txn_do(
sub {
# Cancel Patron's holds
# FIXME Could be $patron->get_lists
$_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } );
- $deleted = $self->SUPER::delete;
+ $self->SUPER::delete;
logaction( "MEMBERS", "DELETE", $self->borrowernumber, "" ) if C4::Context->preference("BorrowersLog");
}
);
- return $deleted;
+ return $self;
}
sub image {
my ( $self ) = @_;
- return scalar Koha::Patron::Images->find( $self->borrowernumber );
+ return Koha::Patron::Images->find( $self->borrowernumber );
}
=head3 library
$firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
$surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
my $userid = lc(($firstname)? "$firstname.$surname" : $surname);
- $userid = unac_string('utf-8',$userid);
+ $userid = NFKD( $userid );
+ $userid =~ s/\p{NonspacingMark}//g;
$userid .= $offset unless $offset == 0;
$self->userid( $userid );
$offset++;
} while (! $self->has_valid_userid );
return $self;
-
}
=head3 attributes
=cut
sub to_api {
- my ( $self ) = @_;
+ my ( $self, $params ) = @_;
- my $json_patron = $self->SUPER::to_api;
+ my $json_patron = $self->SUPER::to_api( $params );
$json_patron->{restricted} = ( $self->is_debarred )
? Mojo::JSON->true