From d0c8c8796c84eb8e950b0b24162a4baec8e89dca Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 Nov 2023 14:03:00 +0000 Subject: [PATCH] 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 Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer --- .../prog/en/includes/members-toolbar.inc | 2 +- members/notices.pl | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index a625834163..d530fc5758 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -81,7 +81,7 @@ [% END %] [% IF CAN_user_borrowers_edit_borrowers %] -
  • Send welcome email
  • +
  • Send welcome notice
  • [% END %] [% IF CAN_user_borrowers_edit_borrowers && patron.category.effective_reset_password %] diff --git a/members/notices.pl b/members/notices.pl index 2e455f7c19..10fe4fc2ad 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -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 -- 2.20.1