Bug 17648: (QA follow-up) Restore imediate sending of the notice

The original notice was sent using SendAlerts, which triggers
immediately on submission and doesn't wait for the cron task.

This patch restores that immediacy and also fixes a bug in the imports
on the original patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2022-03-01 16:47:52 +00:00 committed by Kyle Hall
parent 1ccbd0b7a9
commit b3125c9f38

View file

@ -30,7 +30,7 @@ use C4::Context;
use C4::Output qw( output_and_exit output_and_exit_if_error output_html_with_http_headers );
use C4::Members qw( checkcardnumber get_cardnumber_length );
use C4::Koha qw( GetAuthorisedValues );
use C4::Letters qw( SendAlerts );
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
use C4::Form::MessagingPreferences;
use Koha::AuthUtils;
use Koha::AuthorisedValues;
@ -478,7 +478,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
want_librarian => 1,
) or return;
my $success = EnqueueLetter(
my $message_id = EnqueueLetter(
{
letter => $letter,
borrowernumber => $patron->id,
@ -486,6 +486,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
message_transport_type => 'email'
}
);
SendQueuedMessages({ message_id => $message_id });
};
if ($@) {
$template->param( error_alert => $@ );