Lines 473-481
ListOwnershipUponPatronDeletion pref, but entries from the borrower to other lis
Link Here
|
473 |
sub delete { |
473 |
sub delete { |
474 |
my ($self) = @_; |
474 |
my ($self) = @_; |
475 |
|
475 |
|
476 |
my $anonymous_patron = C4::Context->preference("AnonymousPatron"); |
|
|
477 |
Koha::Exceptions::Patron::FailedDeleteAnonymousPatron->throw() |
476 |
Koha::Exceptions::Patron::FailedDeleteAnonymousPatron->throw() |
478 |
if $anonymous_patron && $self->id eq $anonymous_patron; |
477 |
if $self->is_anonymous; |
479 |
|
478 |
|
480 |
# Check if patron is protected |
479 |
# Check if patron is protected |
481 |
Koha::Exceptions::Patron::FailedDeleteProtectedPatron->throw() if defined $self->protected && $self->protected == 1; |
480 |
Koha::Exceptions::Patron::FailedDeleteProtectedPatron->throw() if defined $self->protected && $self->protected == 1; |
Lines 736-743
sub siblings {
Link Here
|
736 |
sub merge_with { |
735 |
sub merge_with { |
737 |
my ( $self, $patron_ids ) = @_; |
736 |
my ( $self, $patron_ids ) = @_; |
738 |
|
737 |
|
739 |
my $anonymous_patron = C4::Context->preference("AnonymousPatron"); |
738 |
return if $self->is_anonymous; |
740 |
return if $anonymous_patron && $self->id eq $anonymous_patron; |
|
|
741 |
|
739 |
|
742 |
# Do not merge other patrons into a protected patron |
740 |
# Do not merge other patrons into a protected patron |
743 |
return if $self->protected; |
741 |
return if $self->protected; |
Lines 755-766
sub merge_with {
Link Here
|
755 |
sub { |
753 |
sub { |
756 |
foreach my $patron_id (@patron_ids) { |
754 |
foreach my $patron_id (@patron_ids) { |
757 |
|
755 |
|
758 |
next if $anonymous_patron && $patron_id eq $anonymous_patron; |
|
|
759 |
|
760 |
my $patron = Koha::Patrons->find($patron_id); |
756 |
my $patron = Koha::Patrons->find($patron_id); |
761 |
|
757 |
|
762 |
next unless $patron; |
758 |
next unless $patron; |
763 |
|
759 |
|
|
|
760 |
next if $patron->is_anonymous; |
761 |
|
764 |
# Do not merge protected patrons into other patrons |
762 |
# Do not merge protected patrons into other patrons |
765 |
next if $patron->protected; |
763 |
next if $patron->protected; |
766 |
|
764 |
|
Lines 3048-3058
This method tells if the Koha:Patron object can be deleted. Possible return valu
Link Here
|
3048 |
sub safe_to_delete { |
3046 |
sub safe_to_delete { |
3049 |
my ($self) = @_; |
3047 |
my ($self) = @_; |
3050 |
|
3048 |
|
3051 |
my $anonymous_patron = C4::Context->preference('AnonymousPatron'); |
|
|
3052 |
|
3053 |
my $error; |
3049 |
my $error; |
3054 |
|
3050 |
|
3055 |
if ( $anonymous_patron && $self->id eq $anonymous_patron ) { |
3051 |
if ( $self->is_anonymous ) { |
3056 |
$error = 'is_anonymous_patron'; |
3052 |
$error = 'is_anonymous_patron'; |
3057 |
} elsif ( $self->checkouts->count ) { |
3053 |
} elsif ( $self->checkouts->count ) { |
3058 |
$error = 'has_checkouts'; |
3054 |
$error = 'has_checkouts'; |
Lines 3405-3410
sub is_patron_inside_charge_limits {
Link Here
|
3405 |
return $patron_charge_limits; |
3401 |
return $patron_charge_limits; |
3406 |
} |
3402 |
} |
3407 |
|
3403 |
|
|
|
3404 |
=head3 is_anonymous |
3405 |
|
3406 |
my $is_anonymous_patron= $patron->is_anonymous(); |
3407 |
|
3408 |
Returns true if the patron the anonymous patron (AnonymousPatron) |
3409 |
|
3410 |
=cut |
3411 |
|
3412 |
sub is_anonymous { |
3413 |
my ($self) = @_; |
3414 |
my $anonymous_patron = C4::Context->preference('AnonymousPatron'); |
3415 |
return ( $anonymous_patron && $self->borrowernumber eq $anonymous_patron ) ? 1 : 0; |
3416 |
} |
3417 |
|
3408 |
=head2 Internal methods |
3418 |
=head2 Internal methods |
3409 |
|
3419 |
|
3410 |
=head3 _type |
3420 |
=head3 _type |