Bug 19496: Fixing to_address for patron notes

This patch ensures the patron note to_address is the branch email or the
Koha Admin email, and the from_address is the patron's email.

To test:
1) Ensure syspref 'allowcheckoutnotes' is turned on
2) Go to OPAC, leave a note on a checkout
3) Confirm that the note is received (in mysql message_queue) but the
to_address is the patron's email - this is wrong
4) Apply patch and refresh OPAC
5) Leave a note on a checkout
6) Confirm that the note is received in message queue
7) Confirm that the to_address is one of:
- branch email
- branch reply to
- syspref ReplytoDefault
- syspref KohaAdminEmailAddress
8) Confirm that the from_address is one of:
- patron email
- patron emailpro
- patron B_email

Sponsored-by: Catalyst IT

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Aleisha Amohia 2017-11-27 21:33:58 +00:00 committed by Jonathan Druart
parent a8e42c5f21
commit d5292616ac
2 changed files with 22 additions and 2 deletions

View file

@ -79,7 +79,17 @@ if ( $action eq 'issuenote' && C4::Context->preference('AllowCheckoutNotes') ) {
'borrowers' => $borrowernumber,
},
);
C4::Message->enqueue($letter, $patron->unblessed, 'email');
my $to_address = $branch->branchemail || $branch->branchreplyto || C4::Context->ReplytoDefault || C4::Context->preference('KohaAdminEmailAddress');
my $from_address = $patron->email || $patron->emailpro || $patron->B_email;
C4::Letters::EnqueueLetter({
letter => $letter,
message_transport_type => 'email',
borrowernumber => $patron->borrowernumber,
to_address => $to_address,
from_address => $from_address,
});
}
}
print $query->redirect("/cgi-bin/koha/opac-user.pl");

View file

@ -89,7 +89,17 @@ if ($is_ajax) {
'borrowers' => $borrowernumber,
},
);
C4::Message->enqueue($letter, $patron->unblessed, 'email');
my $to_address = $branch->branchemail || $branch->branchreplyto || C4::Context->ReplytoDefault || C4::Context->preference('KohaAdminEmailAddress');
my $from_address = $patron->email || $patron->emailpro || $patron->B_email;
C4::Letters::EnqueueLetter({
letter => $letter,
message_transport_type => 'email',
borrowernumber => $patron->borrowernumber,
to_address => $to_address,
from_address => $from_address,
});
} else { # note empty, i.e removed
$status = "removed";
}