Lines 465-473
sub siblings {
Link Here
|
465 |
=cut |
465 |
=cut |
466 |
|
466 |
|
467 |
sub merge_with { |
467 |
sub merge_with { |
468 |
my ( $self, $patron_ids ) = @_; |
468 |
my ( $self, $patron_ids, $interface ) = @_; |
469 |
|
469 |
|
470 |
my @patron_ids = @{ $patron_ids }; |
470 |
my @patron_ids = @{ $patron_ids }; |
|
|
471 |
my @interface = @{ $interface }; |
471 |
|
472 |
|
472 |
# Ensure the keeper isn't in the list of patrons to merge |
473 |
# Ensure the keeper isn't in the list of patrons to merge |
473 |
@patron_ids = grep { $_ ne $self->id } @patron_ids; |
474 |
@patron_ids = grep { $_ ne $self->id } @patron_ids; |
Lines 475-480
sub merge_with {
Link Here
|
475 |
my $schema = Koha::Database->new()->schema(); |
476 |
my $schema = Koha::Database->new()->schema(); |
476 |
|
477 |
|
477 |
my $results; |
478 |
my $results; |
|
|
479 |
my $patron_merged; |
480 |
my $info; |
478 |
|
481 |
|
479 |
$self->_result->result_source->schema->txn_do( sub { |
482 |
$self->_result->result_source->schema->txn_do( sub { |
480 |
foreach my $patron_id (@patron_ids) { |
483 |
foreach my $patron_id (@patron_ids) { |
Lines 493-501
sub merge_with {
Link Here
|
493 |
|
496 |
|
494 |
$patron->move_to_deleted(); |
497 |
$patron->move_to_deleted(); |
495 |
$patron->delete(); |
498 |
$patron->delete(); |
496 |
} |
|
|
497 |
}); |
498 |
|
499 |
|
|
|
500 |
if (C4::Context->preference("BorrowersLog")){ |
501 |
$info = $patron->firstname. " " . $patron->surname . " ( ".$patron->cardnumber . ")". " has been merged into " . $self->firstname . " " . $self->surname . " ( ".$self->cardnumber . ")" ; |
502 |
logaction("Patrons", "Merge", $patron_id, $info ,@interface); |
503 |
} |
504 |
} |
505 |
}); |
499 |
return $results; |
506 |
return $results; |
500 |
} |
507 |
} |
501 |
|
508 |
|
Lines 506-512
sub merge_with {
Link Here
|
506 |
$wants_check = $patron->wants_check_for_previous_checkout; |
513 |
$wants_check = $patron->wants_check_for_previous_checkout; |
507 |
|
514 |
|
508 |
Return 1 if Koha needs to perform PrevIssue checking, else 0. |
515 |
Return 1 if Koha needs to perform PrevIssue checking, else 0. |
509 |
|
|
|
510 |
=cut |
516 |
=cut |
511 |
|
517 |
|
512 |
sub wants_check_for_previous_checkout { |
518 |
sub wants_check_for_previous_checkout { |
513 |
- |
|
|