From 7d756d1bdee533aa96fe87cf714c3a586175a496 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 16 Oct 2024 12:38:46 +0000 Subject: [PATCH] [23.11]Bug 37891: Submit SMS related data even if SMSSendDriver is empty This is a squash of both patches for 23.11.x. The bug is caused by the SMS data not being submitted as its fieldset is disabled if SMSSendDriver is empty. This causes the SMS instance of the notice to not be updated when the edit happens, becoming out of sync. Once it becomes out of sync with the other notices of same code but different transport_type, the 'GROUP BY branchcode,module,code,name,branchname' in letter.pl will fail, as the name no longer matches, listing the same notice twice on the notices table. This patch updates the logic on the template to have the SMS input elements be disabled/readonly instead of having disabled='disabled' on the SMS fieldset. This keeps the same functionality i.e. staff member is unable to edit SMS notice if SMSSendDriver is disabled, but ensures that SMS related data is submitted to the controller when the notice edit save happens. Test plan: 1) Visit notices and slips: /cgi-bin/koha/tools/letter.pl 2) Search for a notice code e.g. 'ILL_REQUEST_UPDATE'. 3) Notice only one result is returned. Click 'Edit'. 4) Edit the 'Name'. Click 'Save'. 5) Repeat 2. Notice two results are now returned. 6) Apply patch. Repeat test plan. Notice only one result is returned at the end. Signed-off-by: Jason Robb Amended-by: Jonathan Druart Align Signed-off-by: Jonathan Druart [24.05]Bug 37891: (QA follow-up): Fix tt_valid QA test 1) Apply both patches 2) $ qa -c 2 -v 2 Amended-by: Jonathan Druart Add the different attribute at the end of the node so that we can easily see what's different between the two lines Signed-off-by: Jonathan Druart --- .../prog/en/modules/tools/letter.tt | 60 +++++++++++++------ 1 file changed, 43 insertions(+), 17 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 9c72db65ac..0b614fdc82 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -594,12 +594,11 @@
- [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %] -
+ [% SET sms_readonly = letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %] +
+ [% IF sms_readonly %]
You should enable the SMSSendDriver preference to use the SMS templates.
- [% ELSE %] -
- [% END %] + [% END %]
    @@ -618,39 +617,66 @@
  1. [% IF letter.is_html %] - + [% IF sms_readonly %] + + [% ELSE %] + + [% END %] [% ELSE %] - + [% IF sms_readonly %] + + [% ELSE %] + + [% END %] [% END %]
  2. - + + [% IF sms_readonly %] + + [% ELSE %] + + [% END %]
  3. [% IF letter.message_transport_type == 'sms' %] - - [% IF letter.content && letter.content.length > 0 %] - [% tx("{content_length} / 160 characters", {content_length = letter.content.length} ) %] - [% ELSE %] - [% tx("{content_length} / 160 characters", {content_length = 0} ) %] - [% END %] - + [% IF !sms_readonly %] + + [% IF letter.content && letter.content.length > 0 %] + [% tx("{content_length} / 160 characters", {content_length = letter.content.length} ) %] + [% ELSE %] + [% tx("{content_length} / 160 characters", {content_length = 0} ) %] + [% END %] + + [% END %] [% END %]
    - + [% ELSE%] + - + [% IF sms_readonly %] + + [% ELSE %] + + [% END %] + [% IF sms_readonly %] + + [% ELSE %] + [% END %]
    -- 2.39.5