Bug 35279: Add fallback to print for 'Send welcome email'

We update the 'Send welcome email' button to read 'Send welcome notice'
and add a fallback to enqueue a notice for print when the user doesn't
have an email address defined.

Test plan
1) Apply patch
2) Use the 'Henry Acevedo' user who doesn't yet have a valid email
   address.
3) Click the 'Send welcome notice' button available from the 'more'
   menu.
4) Note that no notice is queued at all.
5) Copy the content of the 'email' WELCOME notice into the 'print'
   template.
5) Repeat step 3.
6) Note that this time a 'print' type notice is queued for the user.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2023-11-07 14:03:00 +00:00 committed by Katrin Fischer
parent 2ad4c93cdc
commit d0c8c8796c
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 24 additions and 1 deletions

View File

@ -81,7 +81,7 @@
[% END %]
[% IF CAN_user_borrowers_edit_borrowers %]
<li><a id="sendwelcome" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber | uri %]&op=send_welcome">Send welcome email</a></li>
<li><a id="sendwelcome" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber | uri %]&op=send_welcome">Send welcome notice</a></li>
[% END %]
[% IF CAN_user_borrowers_edit_borrowers && patron.category.effective_reset_password %]

View File

@ -88,6 +88,29 @@ if ( $op eq 'send_welcome' ) {
}
);
};
} else {
eval {
my $print = GetPreparedLetter(
module => 'members',
letter_code => 'WELCOME',
branchcode => $patron->branchcode,,
lang => $patron->lang || 'default',
tables => {
'branches' => $patron->branchcode,
'borrowers' => $patron->borrowernumber,
},
want_librarian => 1,
message_transport_type => 'print'
) or return;
my $message_id = EnqueueLetter(
{
letter => $print,
borrowernumber => $patron->id,
message_transport_type => 'print'
}
);
};
}
# redirect to self to avoid form submission on refresh