[Koha-bugs] [Bug 19675] New: Cannot save notices when setting the TranslateNotices preference

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 21 17:20:53 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19675

            Bug ID: 19675
           Summary: Cannot save notices when setting the TranslateNotices
                    preference
 Change sponsored?: ---
           Product: Koha
           Version: 17.05
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Notices
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andreas.jonsson at kreablo.se
        QA Contact: testopia at bugs.koha-community.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list