Bugzilla – Attachment 164754 Details for
Bug 33478
Customise the format of notices when they are printed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33478: Consider TranslateNotices when saving notice styles
Bug-33478-Consider-TranslateNotices-when-saving-no.patch (text/plain), 7.71 KB, created by
Martin Renvoize (ashimema)
on 2024-04-11 14:30:14 UTC
(
hide
)
Description:
Bug 33478: Consider TranslateNotices when saving notice styles
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-11 14:30:14 UTC
Size:
7.71 KB
patch
obsolete
>From 407a0f087cb552d415f5f6e0f1f20ba339e6696b Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 29 Feb 2024 01:30:06 +0000 >Subject: [PATCH] Bug 33478: Consider TranslateNotices when saving notice > styles > >This patch ensures saving styles per notice still works as expected when the TranslateNotices system preference is enabled. > >To test, enable the TranslateNotices system preference and attempt to save different CSS for each installed language for one notice. Confirm the correct CSS is saved for the correct language. > >Confirm the CSS selector helpers are inserted into the textarea as expected. > >Confirm the 'Apply format settings to all notices for this language' setting works, as in CSS is saved for all relevant language notices. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/modules/tools/letter.tt | 33 ++++++++++--------- > koha-tmpl/intranet-tmpl/prog/js/letter.js | 4 +-- > tools/letter.pl | 14 ++++---- > 3 files changed, 27 insertions(+), 24 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >index 107bc472201..47606c98f0a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >@@ -680,17 +680,17 @@ > <ol> > <li id="css-helpers"> > <label>Insert selectors to apply styles to: </label> >- <a class="css-helper" id="headings">Headings</a> >- <a class="css-helper" id="tables">Tables</a> >- <a class="css-helper" id="text">All text</a> >+ <a class="css-helper headings" data-lang="[% lang | html %]">Headings</a> >+ <a class="css-helper tables" data-lang="[% lang | html %]">Tables</a> >+ <a class="css-helper text" data-lang="[% lang | html %]">All text</a> > </li> >- <li> >- <label for="style">Style (CSS): </label> >- <textarea id="style" name="style" rows="15" cols="80">[% letters.$lang.params.style | $raw %]</textarea> >+ <li class="style_notices_option"> >+ <label for="style_[% lang | html %]">Style (CSS): </label> >+ <textarea id="style_[% lang | html %]" name="style_[% lang | html %]" rows="15" cols="80">[% letters.$lang.params.style | $raw %]</textarea> > </li> >- <li> >- <label for="format_all">Apply format settings to all notices:</label> >- <input type="checkbox" name="format_all" id="format_all" value="1" /> >+ <li class="format_all_notices_option"> >+ <label for="format_all_[% lang | html %]">Apply format settings to all notices[% IF Koha.Preference('TranslateNotices') %] for this language[% END %]:</label> >+ <input type="checkbox" name="format_all_[% lang | html %]" id="format_all_[% lang | html %]" class="format_all" value="1" /> > <span class="hint">Existing format settings will be overwritten.</span> > </li> > </ol> >@@ -719,23 +719,26 @@ > var new_branchcode = '[% new_branchcode | html %]'; > var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %]; > $(document).ready(function(){ >- $("#headings").click(function(){ >- $("#style").val(function(i, text) { >+ $(".headings").click(function(){ >+ var lang = $(this).data('lang'); >+ $("#style_"+lang).val(function(i, text) { > return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' + > '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6 {\n' + > '// insert CSS here\n' + > '}'; > }); > }); >- $("#tables").click(function(){ >- $("#style").val(function(i, text) { >+ $(".tables").click(function(){ >+ var lang = $(this).data('lang'); >+ $("#style_"+lang).val(function(i, text) { > return text + '\nbody, table, th, td, th:last-child, td:last-child {\n' + > '// insert CSS here\n' + > '}'; > }); > }); >- $("#text").click(function(){ >- $("#style").val(function(i, text) { >+ $(".text").click(function(){ >+ var lang = $(this).data('lang'); >+ $("#style_"+lang).val(function(i, text) { > return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' + > '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6,\n' + > 'table, th, td, th:last-child, td:last-child {\n' + >diff --git a/koha-tmpl/intranet-tmpl/prog/js/letter.js b/koha-tmpl/intranet-tmpl/prog/js/letter.js >index 5ea32df655e..44524c04526 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/letter.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/letter.js >@@ -49,7 +49,7 @@ function confirmOverwrite( new_lettercode, new_branchcode ){ > } > > function confirmFormatOverwrite( event ) { >- if ( confirm(__("Existing format settings for all notices will be overwritten by these format settings.")) ) { >+ if ( confirm(__("Existing format settings for all notices of the same language will be overwritten by these format settings.")) ) { > return true; > } else { > return false; >@@ -94,7 +94,7 @@ $(document).ready(function() { > }); > > $("#submit_form").on("click",function(e){ >- if ( $("#format_all").is(":checked") ){ >+ if ( $(".format_all").is(":checked") ){ > if ( confirmFormatOverwrite(e) ) { > $("#add_notice").submit(); > } else { >diff --git a/tools/letter.pl b/tools/letter.pl >index 8f16f375068..6b7f965be49 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -307,18 +307,18 @@ sub add_validate { > my $oldmodule = $input->param('oldmodule'); > my $code = $input->param('code'); > my $name = $input->param('name'); >- my $style = $input->param('style'); >- my $format_all = $input->param('format_all'); > my @mtt = $input->multi_param('message_transport_type'); > my @title = $input->multi_param('title'); > my @content = $input->multi_param('content'); > my @lang = $input->multi_param('lang'); > for my $mtt ( @mtt ) { >- my $lang = shift @lang; >- if ( $format_all ) { >- my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list; >- foreach my $letter ( @letters ) { >- $letter->set({ style => $style })->store; >+ my $lang = shift @lang; >+ my $style = $input->param("style_$lang"); >+ my $format_all = $input->param("format_all_$lang"); >+ if ($format_all) { >+ my @letters = Koha::Notice::Templates->search( { lang => $lang } )->as_list; >+ foreach my $letter (@letters) { >+ $letter->set( { style => $style } )->store; > } > } > my $is_html = $input->param("is_html_$mtt\_$lang"); >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33478
:
149743
|
149785
|
149786
|
149787
|
149914
|
149915
|
149916
|
149917
|
149918
|
149999
|
150000
|
150001
|
150002
|
150003
|
150004
|
150005
|
150006
|
150007
|
150008
|
150009
|
150010
|
150011
|
150012
|
150265
|
150266
|
150267
|
150268
|
150269
|
150270
|
150271
|
150272
|
150273
|
150274
|
150275
|
150276
|
150277
|
150324
|
150325
|
150326
|
150327
|
150328
|
150329
|
150330
|
150331
|
150332
|
150333
|
150334
|
150335
|
150336
|
150337
|
150338
|
150339
|
150340
|
150341
|
150342
|
150343
|
150344
|
150345
|
151548
|
151580
|
151581
|
151582
|
151583
|
151584
|
151585
|
151586
|
151587
|
151588
|
151589
|
151590
|
151591
|
151592
|
151593
|
156469
|
157368
|
157369
|
157370
|
157371
|
157372
|
157373
|
157374
|
157375
|
157376
|
157377
|
157378
|
157379
|
157380
|
157381
|
157382
|
157387
|
158835
|
158836
|
158837
|
158838
|
158839
|
158840
|
158841
|
158842
|
158843
|
158844
|
158845
|
158846
|
158847
|
158848
|
158849
|
158856
|
162556
|
162557
|
162558
|
162559
|
162560
|
162561
|
162562
|
162563
|
162564
|
162565
|
162566
|
162567
|
162568
|
162569
|
163903
|
163904
|
163905
|
163906
|
163907
|
163908
|
163909
|
163910
|
163911
|
163912
|
163913
|
163914
|
163915
|
163916
|
163924
|
163925
|
163926
|
163927
|
163928
|
163929
|
163930
|
163931
|
163932
|
163933
|
163934
|
163935
|
163936
|
163937
|
163938
|
164719
|
164720
|
164721
|
164722
|
164723
|
164724
|
164725
|
164726
|
164727
|
164728
|
164729
|
164730
|
164731
|
164732
|
164733
|
164741
|
164742
|
164743
|
164744
|
164745
|
164746
|
164747
|
164748
|
164749
|
164750
|
164751
|
164752
|
164753
| 164754 |
164755