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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 89e65657b1
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
1b1bfdc2a8
commit
b9e26b55a1
1 changed files with 4 additions and 1 deletions
|
@ -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 ||= '<!-- no_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 ($@) {
|
||||
|
|
Loading…
Reference in a new issue