[Koha-bugs] [Bug 14251] Allow use of CSS in discharge letter
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Feb 6 19:23:54 CET 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14251
--- Comment #25 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 146295
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146295&action=edit
Bug 14251: Allow use of CSS in discharge letter
The discharge feature relies PDF::FromHTML which explicitly doesn't
handle CSS [1].
This patch makes it use the `weasyprint` command-line tool to generate
the PDF. This tool handles CSS correctly.
To test:
1. Install weasyprint:
$ apt install weasyprint
2. Add some style to your DISCHARGE letter. I used:
<<today>>
<h1>Discharge confirmation</h1>
<p style="background-color: yellow;"><<branches.branchname>> certifies that the
following borrower:<br>
<<borrowers.firstname>> <<borrowers.surname>> (cardnumber:
<<borrowers.cardnumber>>)<br>
has returned all items.</p>
3. Have some non-latin chars on the patron name. I picked 'Henry
Acevedo' and added 'Δοκιμή' as picked from bug 23589. Only to check no
regressions.
4. Enable the 'UseDischarge' syspref
5. Go to Henry's detail page
6. Choose More > Discharge and Generate the discharge
=> SUCCESS:
- Style is applied to the PDF
- Greek characters are displayed correctly
7. Run the tests:
$ kshell
k$ prove -v t/db_dependent/Patron/Borrower_Discharge.t
=> SUCCESS: The rewritten tests pass!
8. Remove weasyprint:
$ apt remove weasyprint
9. Repeat 7
=> SUCCESS: Tests pass, relevant test is skipped because of missing
weasyprint
10. Sign off :-D
[1] https://metacpan.org/pod/PDF::FromHTML#CAVEATS
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list