The lang parameter is missing in the where clause of the update statement. The below patch fixes the problem. diff --git a/tools/letter.pl b/tools/letter.pl index 5920a8437f..f89930472c 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -303,11 +303,11 @@ sub add_validate { q{ UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ?, lang = ? - WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ? + WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ? AND lang = ? }, undef, $branchcode || '', $module, $name, $is_html || 0, $title, $content, $lang, - $branchcode, $oldmodule, $code, $mtt + $branchcode, $oldmodule, $code, $mtt, $lang ); } else { $dbh->do( To reproduce: 1. Enable TranslateNotices global preference. 2. Edit any notice message and save a translation. 3. Try updating any translation. The save will fail and the log-file will contain errors such as this: DBIx::Class::Storage::DBI::select_single(): Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single at /usr/share/koha/lib/Koha/Objects.pm line 92 DBIx::Class::Storage::DBI::select_single(): Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single at /usr/share/koha/lib/Koha/Objects.pm line 92 DBD::mysql::db do failed: Duplicate entry 'circulation-ODUE--email-sv-SE' for key 'PRIMARY' [for Statement " UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ?, lang = ? WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ? "] at /usr/share/koha/intranet/cgi-bin/tools/letter.pl line 302. DBD::mysql::db do failed: Duplicate entry 'circulation-ODUE--email-en' for key 'PRIMARY' [for Statement " UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ?, lang = ? WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ? "] at /usr/share/koha/intranet/cgi-bin/tools/letter.pl line 302.
Could you please attach the diff as a Git patch? There are some good tips about the easiest way to do that here: https://wiki.koha-community.org/wiki/Git_bz_configuration
Created attachment 69347 [details] [review] Bug 19675: Fix update notice templates when they are translatable Avoid the following error: DBD::mysql::db do failed: Duplicate entry 'acquisition-xxx--email-default' for key 'PRIMARY' [for Statement "
Created attachment 69348 [details] [review] Bug 19675: Fix update notice templates when they are translatable Avoid the following error: DBD::mysql::db do failed: Duplicate entry 'acquisition-xxx--email-default' for key 'PRIMARY' [for Statement " Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Skipping QA.
Path pushed to master for 17.11, thanks Andreas and congrats for your first patch in!
Thanks you for pushing this so swiftly!
*** Bug 19516 has been marked as a duplicate of this bug. ***