https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29113
--- Comment #29 from Jonathan Druart <[email protected]> --- (In reply to Marcel de Rooy from comment #28) > + code => $code || 'tmp_code', > > Please explain. The code is mandatory at DB level so we must add a temporary code during the insert, then update it after I feel like it should actually be 'tmp_code' always, at this point we are creating a new entry and $code should never be set. We could add the following change diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl index e63a44a809a..59721e24b2a 100755 --- a/tools/additional-contents.pl +++ b/tools/additional-contents.pl @@ -159,7 +159,7 @@ elsif ( $op eq 'add_validate' ) { my $additional_content = Koha::AdditionalContent->new( { category => $category, - code => $code || 'tmp_code', + code => 'tmp_code', location => $location, branchcode => $branchcode, title => $title, @@ -173,13 +173,11 @@ elsif ( $op eq 'add_validate' ) { )->store; eval { $additional_content->store; - unless ($code) { - $additional_content->discard_changes; - $code = $category eq 'news' - ? 'News_' . $additional_content->idnew - : $location . '_' . $additional_content->idnew; - $additional_content->code($code)->store; - } + $additional_content->discard_changes; + $code = $category eq 'news' + ? 'News_' . $additional_content->idnew + : $location . '_' . $additional_content->idnew; + $additional_content->code($code)->store; }; if ($@) { $success = 0; -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
