From b9e26b55a14ba42a4d62364cc7ec1aac1fe4d461 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 16 Aug 2022 12:02:13 +0000 Subject: [PATCH] Bug 29782: Fix handling records without title or content Test plan: Save a new record with only a title in the non-default tab (english). Check if you see it on the list. Edit. Save a new record without title but only content in non-default lang. Check if you see it. Do the same 2 edits on the default tab only. Verify too. Signed-off-by: Marcel de Rooy Signed-off-by: Caroline Cyr La Rose Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 89e65657b106570b717dede6476a6d6f65511b67) Signed-off-by: Lucas Gass --- tools/additional-contents.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl index 3d165216ea..de36d5d8e6 100755 --- a/tools/additional-contents.pl +++ b/tools/additional-contents.pl @@ -104,6 +104,9 @@ elsif ( $op eq 'add_validate' ) { for my $lang ( sort {$a ne 'default'} @lang ) { # Process 'default' first my $title = $cgi->param( 'title_' . $lang ); my $content = $cgi->param( 'content_' . $lang ); + # Force a default record + $content ||= '' if $lang eq 'default'; + my $additional_content = Koha::AdditionalContents->find( { category => $category, @@ -113,7 +116,7 @@ elsif ( $op eq 'add_validate' ) { } ); # Delete if title or content is empty - unless ( $title and $content ) { + if( $lang ne 'default' && !$title && !$content ) { if ( $additional_content ) { eval { $additional_content->delete }; unless ($@) { -- 2.39.5