[Koha-bugs] [Bug 30287] Notices using HTML render differently in notices.pl

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Nov 11 11:14:30 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30287

David Nind <david at davidnind.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david at davidnind.com
             Status|Needs Signoff               |Failed QA

--- Comment #21 from David Nind <david at davidnind.com> ---
I've tested, using the test plan below. I hope this covers things. Feel free to
add other notices that better reflect the changes.

I think everything works as expected, however the tests fail - see [3].

Test plan:

1. Setup KTD so it can send emails.[1]
2. Add an email to a patron's account (I used Henry Acevedo) and the koha user.
3. Add an email address to KohaAdminEmailAddress.
4. Edit patron so that email messages are sent for holds filled, item check-in,
and item checkout.
5. Generate and send notices:[2]
   5.1 Send the welcome email (Patron account > More > Send welcome email
   5.2 Place and fill a hold so that is waiting for pickup
   5.3 Checkout the held item to the patron
   5.4 Check in the item checked out
   5.5 Enable two-factor authentication (TwoFactorAuthentication system
preference) for the koha user under Patrons > [Patron account] > More > Manage
two-factor authentication 
   5.6 Enable UseEmailReceipts system preference, add a manual invoice, and
then pay it
   5.7 Change the password for the patron (using Edit the patron, rather than
Change password)
   5.8 Run misc/cronjobs/process_message_queue.pl
6. Compare the emails received and the notice previews under notices for the
patron - see [2] for what to expect.
7. Apply the patch, flush_memcached, and restart_all.
8. Repeat steps 5 and 6 - the preview for the notices should either still match
or be better (extra lines remove in previews), as noted in [2].
9. Check that the new tests pass: prove t/db_dependent/Koha/Notice/Message.t

[1] To test sending emails using a Google account:
   1. Set up an App password for your Google Account
   2. Edit /etc/koha/sites/kohadev/koha-conf.xml file and add this
configuration near the end (where <user_name> = your Google email address;
<password> = your APP password, not your Google account password):

 <smtp_server>
    <host>smtp.gmail.com</host>
    <port>587</port>
    <timeout>5</timeout>
    <ssl_mode>STARTTLS</ssl_mode>
    <user_name>GOOGLEACCOUNTUSER</user_name>
    <password>GOOGLEAPPPASSWORD</password>
    <debug>1</debug>
 </smtp_server>

[2] These notices were tested (includes any notes about before and after):
- WELCOME (HTML - uses <br>s):  before - both email and preview match; after -
both email and preview match
- HOLD (plaintext): before - both email and preview match; after - both email
and preview match
- CHECKOUT (plaintext): before - both email and preview match (no lines between
paragraphs); after - both email and preview match
- CHECKIN (plaintext):  before - both email and preview match (no lines between
paragraphs); after - both email and preview match
- 2FA_ENABLE (HTML - uses <p> tags): before - the email mesage is fine, the
preview has extra blank lines between paragraphs; after -  the email mesage is
fine (no change), the preview is now displayed correctly with no extra blank
lines between paragraphs
- ACCOUNT_PAYMENT (plaintext): before - both email and preview match;  after -
both email and preview match; 
- PASSWORD_CHANGE (plaintext): before - email and preview match; after -  email
and preview match (note: sent directly, not through the message queue, but
shows in notices)

[3] The tests fail for me after the patches are applied:

kohadev-koha at kohadevbox:koha(bz30287)$ prove
t/db_dependent/Koha/Notice/Message.t
t/db_dependent/Koha/Notice/Message.t .. 
    #   Failed test 'html_content returned the correct html wrapped letter'
    #   at t/db_dependent/Koha/Notice/Message.t line 91.
    #          got: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
    #     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    # <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    #   <head>
    #     <title>fyOGZoKQa</title>
    #     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    #     <link rel="stylesheet" type="text/css"
href="http://127.0.0.1:8081/intranet-tmpl/prog/css/notices.css">
    #   </head>
    #   <body>
    #   This is a test template using borrower 55
    #   </body>
    # </html>
    # '
    #     expected: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
    #     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    # <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    #   <head>
    #     <title>fyOGZoKQa</title>
    #     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    # 
    #   </head>
    #   <body>
    #   This is a test template using borrower 55
    #   </body>
    # </html>
    # '
    # Looks like you failed 1 test of 2.
t/db_dependent/Koha/Notice/Message.t .. 1/1 
#   Failed test 'html_content() tests'
#   at t/db_dependent/Koha/Notice/Message.t line 117.
# Looks like you failed 1 test of 1.
t/db_dependent/Koha/Notice/Message.t .. Dubious, test returned 1 (wstat 256,
0x100)
Failed 1/1 subtests 

Test Summary Report
-------------------
t/db_dependent/Koha/Notice/Message.t (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=1,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.94 cusr  0.15
csys =  1.11 CPU)
Result: FAIL


Other testing notes:

1. I tried to test sending the cart and a list (I realised after that these are
sent these are sent direct, and not included in the patron's notices list). I
had trouble sending these, although I had added email addresses everywhere I
could think of. I got this message after submitting the form: "There was an
error sending the list.". There is this error in the log:  [WARN] Error sending
mail: sender's email address is invalid at /usr/share/perl5/CGI/Compile.pm line
151. Not sure whether this is just something wrong on my KTD configuration, or
a bug.

2. I tried testing using NoticeCSS:
   2.1 Edit the welcome message: 
       . add a new line: <p class="highlight-notice">This is red.</p>
       . add another new line: <p style="font-family:Arial,Helvetica,Serif;
color:red;">This is also red</p>
   2.2 Add this URL to NoticeCSS:
http://127.0.0.1:8081/intranet-tmpl/prog/css/notices.css
   2.3 Add a new CSS file called notices.css to
koha-tmpl/intranet-tmpl/prog/css/
          .highlight-notice {
           color: red;
           }
   2.4 Before - NoticeCSS doesn't show in email or preview; after - doesn't
show in email, shows in preview
   2.5 Note: Inline CSS shows both before and after
   2.6 Note: This Wiki page indicates that using NoticeCSS is not recommended
(that is how I read it)
https://wiki.koha-community.org/wiki/Customising_Notices_and_Slips#Quick_Tips_for_Custom_HTML_Notices.2FSlips

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list