From 9d7013fcaa4b843ece0440280b3a4a12a3efd6e9 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 Content-Type: text/plain; charset=utf-8 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 --- 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.20.1