From f8d11504b7513fe797e9ed3050887026d0746ef8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Jan 2022 10:15:35 +0100 Subject: [PATCH] Bug 29828: Prevent additional content to be created without default When creating or editing an additional content, the form is submitted if only the title of the 'default' tab is filled in. We should submit the form only if both title and content exist. Test plan: Create a new content using text editor (codemirror) Confirm that the form is submitted only if title and content from the default tab are not empty Try again with wysiwyg (tinymce) Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 05934b89b1b43ceb88928b48a4e1fd69708ac61b) Signed-off-by: Lucas Gass (cherry picked from commit be11af15e61653f2f853a22870468bc8987fbdd4) Signed-off-by: Arthur Suzuki --- .../prog/en/modules/tools/additional-contents.tt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 1c3ac717cc..cfa0d00a91 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -560,6 +560,18 @@ alert(__("Please specify a title for 'Default'")); return false; } + else { + [% UNLESS wysiwyg %] + let content = $('#content_default').siblings(".CodeMirror")[0].CodeMirror.getValue(); + [% ELSE %] + let content = tinyMCE.get('content_default').getContent(); + [% END %] + + if ( ! content.length > 0 ) { + alert(__("Please specify a content for 'Default'")); + return false; + } + } form.submit(); } -- 2.39.5