From afe1d0a4c66fd139744d419c3721794b41f0fd24 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 25 Jul 2024 16:39:00 +0000 Subject: [PATCH] Bug 35044: (QA follow-up): Allow for '0' in serials batch edit This commit also ensures any existing '0' value additional fields are kept if batch editing and submitting the input empty Signed-off-by: Julian Maurice Signed-off-by: Katrin Fischer --- Koha/Object/Mixin/AdditionalFields.pm | 4 ++-- serials/subscription-batchedit.pl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm index 80bc266b91..18bc782bc0 100644 --- a/Koha/Object/Mixin/AdditionalFields.pm +++ b/Koha/Object/Mixin/AdditionalFields.pm @@ -150,7 +150,7 @@ sub add_additional_fields { push @additional_fields, { id => $field->id, value => $value, - } if $value; + } if defined $value && $value ne ''; } } else { my $existing_additional_field_values = $self->additional_field_values->search( { field_id => $field->id } ); @@ -158,7 +158,7 @@ sub add_additional_fields { push @additional_fields, { id => $field->id, value => $existing->value, - } if $existing && $existing->value; + } if $existing && defined $existing->value && $existing->value ne ''; } } } diff --git a/serials/subscription-batchedit.pl b/serials/subscription-batchedit.pl index bffeaf9733..676905cbba 100755 --- a/serials/subscription-batchedit.pl +++ b/serials/subscription-batchedit.pl @@ -72,7 +72,7 @@ if ( $op eq 'cud-batchedit' ) { my @submitted_fields_array; foreach my $submitted_field (@submitted_fields) { - push @submitted_fields_array, $submitted_field if $submitted_field; + push @submitted_fields_array, $submitted_field if defined $submitted_field && $submitted_field ne ''; } $field_values->{ $available_field->id } = \@submitted_fields_array; } -- 2.39.5