Commit d7bd3c69 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen
Browse files

DEICH-5663 limit mailchimp synchronization to adults

parent 78978d7c
......@@ -457,11 +457,13 @@ sub AddMember {
});
}
# DEICH-5747 : send update to MessageQueue
Deichman::MQueue::UserUpdates->new()->PublishBorrowerCreated({
email => $patron->email,
borrowernumber => $patron->borrowernumber,
});
# DEICH-5747 : send update to MessageQueue if adult
if ($patron->{categorycode} eq "V") {
Deichman::MQueue::UserUpdates->new()->PublishBorrowerCreated({
email => $patron->email,
borrowernumber => $patron->borrowernumber,
});
}
logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog");
......
......@@ -196,11 +196,13 @@ sub Add {
my $sth = $dbh->prepare($q);
$sth->execute( @{$obj->{insertValues}} ) or Deichman::Exception::Patron->throw($dbh->errstr);
$self->{patron}->{borrowernumber} = $sth->last_insert_id();
# DEICH-5747 : send update to MessageQueue
Deichman::MQueue::UserUpdates->new()->PublishBorrowerCreated({
email => $patron->{alertemail},
borrowernumber => $patron->{borrowernumber},
});
# DEICH-5747 : send update to MessageQueue if adult
if ($patron->{categorycode} eq "V") {
Deichman::MQueue::UserUpdates->new()->PublishBorrowerCreated({
email => $patron->{alertemail},
borrowernumber => $patron->{borrowernumber},
});
}
return $self->Read;
}
......@@ -214,12 +216,14 @@ sub Update {
. " WHERE borrowernumber = ?";
my $sth = $dbh->prepare($q);
$sth->execute( $self->{patron}->{borrowernumber} ) or Deichman::Exception::Patron->throw($dbh->errstr);
# DEICH-5747 : send update to MessageQueue
Deichman::MQueue::UserUpdates->new()->PublishBorrowerEmailUpdated({
oldEmail => $self->{patron}->{alertemail},
newEmail => $patron->{alertemail},
borrowernumber => $patron->{borrowernumber},
});
# DEICH-5747 : send update to MessageQueue if adult
if ($self->{patron}->{categorycode} eq "V") {
Deichman::MQueue::UserUpdates->new()->PublishBorrowerEmailUpdated({
oldEmail => $self->{patron}->{alertemail},
newEmail => $patron->{alertemail},
borrowernumber => $patron->{borrowernumber},
});
}
return $self->Read;
}
......@@ -395,12 +399,13 @@ sub Delete {
$r->{reserve} = $reserve;
$r->Archive();
}
# DEICH-5747 : send update to MessageQueue
Deichman::MQueue::UserUpdates->new()->PublishBorrowerDeleted({
email => $self->{patron}->{alertemail},
borrowernumber => $self->{patron}->{borrowernumber},
});
# DEICH-5747 : send update to MessageQueue if adult
if ($self->{patron}->{categorycode} eq "V") {
Deichman::MQueue::UserUpdates->new()->PublishBorrowerDeleted({
email => $self->{patron}->{alertemail},
borrowernumber => $self->{patron}->{borrowernumber},
});
}
$self->anonymize();
$self->performDelete();
$self->{logger}->info("Deleted patron " . $self->{patron}->{borrowernumber} . " with cardnumber " . $card);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment