Bug 35267 - Clarify CSS options for Notices
Summary: Clarify CSS options for Notices
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords: roadmap_25_05
Depends on: 30287 33478
Blocks: 33260 38078 38090
  Show dependency treegraph
 
Reported: 2023-11-06 14:28 UTC by Martin Renvoize (ashimema)
Modified: 2024-12-19 12:58 UTC (History)
13 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-10-04 16:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-10-04 16:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.22 KB, patch)
2024-10-04 16:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Remove printslip css from printnotice (1.25 KB, patch)
2024-10-04 16:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.67 KB, patch)
2024-10-04 16:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.67 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.46 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (2.02 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate notice printing to members/print_notice (14.58 KB, patch)
2024-10-07 13:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-10-07 14:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-10-07 14:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.67 KB, patch)
2024-10-07 14:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.41 KB, patch)
2024-10-07 14:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-10-07 14:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-10-07 14:46 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate notice printing to members/print_notice (14.58 KB, patch)
2024-10-07 14:46 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.57 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.41 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate notice printing to members/print_notice (14.58 KB, patch)
2024-10-07 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.57 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.42 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-12-16 18:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.63 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.57 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.42 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-12-19 12:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.62 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.57 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.42 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-12-19 12:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add and Update Notice CSS system preferences (8.62 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Add preferences to UI (4.20 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Expose style preferences in template editor (3.57 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Apply preferences to preview and mailing (10.93 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Move JS to bottom in printslip (1.86 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Migrate accounts_summary to printslip (2.58 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35267: Update unit tests (1.42 KB, patch)
2024-12-19 12:51 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2023-11-06 14:28:58 UTC
During review of bug 33487 I made the suggestion that we should have more CSS options for our notices at the system preference level.  I've also hit this when looking into bug 30287.

So.. recording this here and hopefully we'll find some time to work on it.

Personally.. I'd have 

* EmailNoticeCSS - CSS stored in the DB for email notice CSS
* EmailNoticeCSSHosted - Location of CSS file for email notice CSS (to retain the old NoticeCSS option)
* PrintNoticeCSS - CSS stored in the DB for print notice CSS
* PrintNoticeCSSHosted - Location of the CSS file for the print notice CSS (to reatin the old SlipCSS option)

SMS doesn't support HTML/CSS so no need for that transport type to have these CSS options.
Comment 1 Martin Renvoize (ashimema) 2023-11-13 11:40:59 UTC
Correction, it was bug 33478
Comment 2 Martin Renvoize (ashimema) 2023-11-13 15:47:39 UTC
This would be easier to implement if we had continued down the path from bug 31714.. we'd have fewer places to change :(
Comment 3 Martin Renvoize (ashimema) 2024-10-04 06:43:16 UTC
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33478#c78 is the original comment regarding this.
Comment 4 Martin Renvoize (ashimema) 2024-10-04 16:02:53 UTC
Created attachment 172414 [details] [review]
Bug 35267: Add and Update Notice CSS system preferences

This patch clarifies the system level notice css preferences.

We rename NoticeCSS to EmailNoticeStylesheet
We rename SlipCSS to PrintSlipStylesheet
We add AllNoticeStylesheet
We add AllNoticeCSS to contain inline CSS for all html notices
We add EmailNoticeCSS to contain inline CSS for Email notices
We add PrintNoticeCSS to contain inline CSS for Print notices
We add PrintSlipCSS to contain inline CSS for Print slips
Comment 5 Martin Renvoize (ashimema) 2024-10-04 16:02:55 UTC
Created attachment 172415 [details] [review]
Bug 35267: Add preferences to UI
Comment 6 Martin Renvoize (ashimema) 2024-10-04 16:02:58 UTC
Created attachment 172416 [details] [review]
Bug 35267: Apply preferences to preview and mailing

This patch applies the new style preferences to the preview display and
email sending code.

TODO: We still need to apply these more clearly to the printing code,
both batch and slip printing
Comment 7 Martin Renvoize (ashimema) 2024-10-04 16:03:00 UTC
Created attachment 172417 [details] [review]
Bug 35267: Remove printslip css from printnotice

This is the begginings of trying to apply styling selectively in the
various printing scripts for Koha's notices and slips.
Comment 8 Martin Renvoize (ashimema) 2024-10-04 16:03:03 UTC
Created attachment 172418 [details] [review]
Bug 35267: Expose style preferences in template editor
Comment 9 Martin Renvoize (ashimema) 2024-10-04 16:04:11 UTC
There's still more work to do here to make sure we catch all the different printing cases.. but I think this is a solid start.

I'd love some help/thoughts on the notice editing UI changes and the relocation of preferences to one place under the 'Tools' section for system preferences.
Comment 10 Martin Renvoize (ashimema) 2024-10-07 13:58:02 UTC Comment hidden (obsolete)
Comment 11 Martin Renvoize (ashimema) 2024-10-07 13:58:05 UTC Comment hidden (obsolete)
Comment 12 Martin Renvoize (ashimema) 2024-10-07 13:58:08 UTC Comment hidden (obsolete)
Comment 13 Martin Renvoize (ashimema) 2024-10-07 13:58:11 UTC Comment hidden (obsolete)
Comment 14 Martin Renvoize (ashimema) 2024-10-07 13:58:14 UTC Comment hidden (obsolete)
Comment 15 Martin Renvoize (ashimema) 2024-10-07 13:58:16 UTC Comment hidden (obsolete)
Comment 16 Martin Renvoize (ashimema) 2024-10-07 13:58:19 UTC Comment hidden (obsolete)
Comment 17 Martin Renvoize (ashimema) 2024-10-07 14:45:47 UTC Comment hidden (obsolete)
Comment 18 Martin Renvoize (ashimema) 2024-10-07 14:45:50 UTC Comment hidden (obsolete)
Comment 19 Martin Renvoize (ashimema) 2024-10-07 14:45:53 UTC Comment hidden (obsolete)
Comment 20 Martin Renvoize (ashimema) 2024-10-07 14:45:56 UTC Comment hidden (obsolete)
Comment 21 Martin Renvoize (ashimema) 2024-10-07 14:45:58 UTC Comment hidden (obsolete)
Comment 22 Martin Renvoize (ashimema) 2024-10-07 14:46:01 UTC Comment hidden (obsolete)
Comment 23 Martin Renvoize (ashimema) 2024-10-07 14:46:05 UTC Comment hidden (obsolete)
Comment 24 Martin Renvoize (ashimema) 2024-10-07 15:45:14 UTC
# Test plan
This is going to be a fun road to travel.

## UI
1) Apply patches and run database updates
2) Note that 'NoticeCSS' and 'SlipCSS' have been renamed to 'EmailNoticeStylesheet' and 'PrintSlipStylesheet' to better reflect their content and both have been migrated into 'Admin > System preferences > Tools > Notices and slips'
3) Note in the same location in system preferences, we now also have 'EmailNoticeCSS', 'PrintNoticeCSS' and 'PrintSlipCSS' preferences that allow direct entry of CSS rules for their respective notice message transports.
4) Under 'Tools > Notices and Slips', edit a notice and note we have a new accordion near the top of the page that displays the content of 'AllNoticeCSS', 'EmailNoticeCSS', 'PrintNoticeCSS' and 'PrintSlipCSS' preferences for the end users reference
4a) If the user has administrative permissions, they should also see an 'Edit' button that's a shortcut the the relevant preference in the system preferences

## Adding styles
1) Add a simple style for testing to 'AllNoticeCSS'
   `.alltest { color: red }`
2) Add a simple style for testing to 'EmailNoticeCSS'
   `.emailtest { color: green }`
3) Add a simple style for testing to 'PrintNoticeCSS'
   `.printtest { color: organge }`
4) Let use the WELCOME notice for testing.. add a simple html template as follows.
```
<p>
    This is a notice for testing</br>
    <span class="alltest">All message transport types should display this red</span><br>
    <span class="emailtest">Only email notices should display this green</span></br>
    <span class="printtest">Only print notices should display this orange</span><br>
    All done
</p>
```
5) Lets use 'Henry A' to test the notice
5a) Do NOT set an email address for Henry
5b) Queue a 'Welcome' print notice using 'More > Send welcome'
5c) Add a primary email address for Henry
5d) Queue a 'Welcome' email notice using 'More > Send welcome'
6) Navigate to the 'Notices' tab for Henry
7) Click the title of the print notice to display a preview and note the correct colors are displayed
8) Click the title of the email notice to display a preview and note the correct colors are displayed

## Testing the functionality
1) Run 'gather_print_notices.pl' with options to output to html file
2) Confirm that the generated notice contains the correct classes and styles
3) Enable 'ManageNotices' preference from the dependency bug
4) Navigate to 'Tools > Mange notices'
5) Select both notices and print using the bottom button
6) Confirm that the two notices display the different colors and are on two separate pages in the print preview.
Comment 25 Martin Renvoize (ashimema) 2024-10-07 16:00:26 UTC Comment hidden (obsolete)
Comment 26 Martin Renvoize (ashimema) 2024-10-07 16:00:29 UTC Comment hidden (obsolete)
Comment 27 Martin Renvoize (ashimema) 2024-10-07 16:00:32 UTC Comment hidden (obsolete)
Comment 28 Martin Renvoize (ashimema) 2024-10-07 16:00:35 UTC Comment hidden (obsolete)
Comment 29 Martin Renvoize (ashimema) 2024-10-07 16:00:38 UTC Comment hidden (obsolete)
Comment 30 Martin Renvoize (ashimema) 2024-10-07 16:00:42 UTC Comment hidden (obsolete)
Comment 31 Martin Renvoize (ashimema) 2024-10-07 16:00:45 UTC Comment hidden (obsolete)
Comment 32 Martin Renvoize (ashimema) 2024-10-07 16:07:16 UTC
This clarifies the original Notice and Slip CSS options expanding from just supporting linked stylesheets to using local style input fields too.

We do not yet handle clarifying how the per notice per transport type level CSS can be defined.  This needs some thought and I've got that as a follow-up bug 38090
Comment 33 Martin Renvoize (ashimema) 2024-10-07 16:08:55 UTC
This also, does not fully implement the stylesheet link options for the multi-print handling code.. that was already failing in bug 33260 and will also need some thought.. I think this should also be a follow-up bug as I'm really not sure if anyone is actually using that functionality in real life.
Comment 34 Martin Renvoize (ashimema) 2024-12-16 18:22:42 UTC Comment hidden (obsolete)
Comment 35 Martin Renvoize (ashimema) 2024-12-16 18:22:46 UTC Comment hidden (obsolete)
Comment 36 Martin Renvoize (ashimema) 2024-12-16 18:22:49 UTC Comment hidden (obsolete)
Comment 37 Martin Renvoize (ashimema) 2024-12-16 18:22:51 UTC Comment hidden (obsolete)
Comment 38 Martin Renvoize (ashimema) 2024-12-16 18:22:55 UTC Comment hidden (obsolete)
Comment 39 Martin Renvoize (ashimema) 2024-12-16 18:22:58 UTC Comment hidden (obsolete)
Comment 40 Martin Renvoize (ashimema) 2024-12-16 18:34:54 UTC
Bugs reordered and rebased so we don't hold up this important fix/enhancement behind the more contentious notices management page and print options bug.
Comment 41 Martin Renvoize (ashimema) 2024-12-16 18:37:25 UTC
With the reorder the following parts of the above test plan should be ignored.. or rather only tested when the relevant bug is applied atop this one:

3) Enable 'ManageNotices' preference from the dependency bug
4) Navigate to 'Tools > Mange notices'
5) Select both notices and print using the bottom button
6) Confirm that the two notices display the different colors and are on two separate pages in the print preview.
Comment 42 David Nind 2024-12-16 23:13:47 UTC
After applying the patches, there was an error with the databae update

 updatedatabase
String found where operator expected at /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_35267.pl line 20, near "$out "Added new system preference 'AllNoticeCSS'""
	(Missing operator before "Added new system preference 'AllNoticeCSS'"?)
DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_35267.pl  [23:07:10]
	ERROR: {UNKNOWN}: Can't use an undefined value as a subroutine reference at /kohadevbox/koha/C4/Installer.pm line 741. at /kohadevbox/koha/C4/Installer.pm line 743
Comment 43 Martin Renvoize (ashimema) 2024-12-19 12:21:30 UTC Comment hidden (obsolete)
Comment 44 Martin Renvoize (ashimema) 2024-12-19 12:21:33 UTC Comment hidden (obsolete)
Comment 45 Martin Renvoize (ashimema) 2024-12-19 12:21:37 UTC Comment hidden (obsolete)
Comment 46 Martin Renvoize (ashimema) 2024-12-19 12:21:40 UTC Comment hidden (obsolete)
Comment 47 Martin Renvoize (ashimema) 2024-12-19 12:21:44 UTC Comment hidden (obsolete)
Comment 48 Martin Renvoize (ashimema) 2024-12-19 12:21:48 UTC Comment hidden (obsolete)
Comment 49 Martin Renvoize (ashimema) 2024-12-19 12:25:36 UTC Comment hidden (obsolete)
Comment 50 Martin Renvoize (ashimema) 2024-12-19 12:25:39 UTC Comment hidden (obsolete)
Comment 51 Martin Renvoize (ashimema) 2024-12-19 12:25:42 UTC Comment hidden (obsolete)
Comment 52 Martin Renvoize (ashimema) 2024-12-19 12:25:46 UTC Comment hidden (obsolete)
Comment 53 Martin Renvoize (ashimema) 2024-12-19 12:25:49 UTC Comment hidden (obsolete)
Comment 54 Martin Renvoize (ashimema) 2024-12-19 12:25:52 UTC Comment hidden (obsolete)
Comment 55 Martin Renvoize (ashimema) 2024-12-19 12:51:20 UTC Comment hidden (obsolete)
Comment 56 Martin Renvoize (ashimema) 2024-12-19 12:51:24 UTC Comment hidden (obsolete)
Comment 57 Martin Renvoize (ashimema) 2024-12-19 12:51:28 UTC Comment hidden (obsolete)
Comment 58 Martin Renvoize (ashimema) 2024-12-19 12:51:32 UTC Comment hidden (obsolete)
Comment 59 Martin Renvoize (ashimema) 2024-12-19 12:51:36 UTC Comment hidden (obsolete)
Comment 60 Martin Renvoize (ashimema) 2024-12-19 12:51:39 UTC Comment hidden (obsolete)
Comment 61 Martin Renvoize (ashimema) 2024-12-19 12:51:43 UTC Comment hidden (obsolete)
Comment 62 Martin Renvoize (ashimema) 2024-12-19 12:58:38 UTC
Looks like I lost a colon during the patch re-arrangement, thanks for spotting it David :)