Bug 19516

Summary: Can't save changes on notices if letter is already created
Product: Koha Reporter: Hugo Agud <hagud>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: katrin.fischer, stefan.berndtsson
Version: 17.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Fix condition when updating an existing letter with language support turned on

Description Hugo Agud 2017-10-23 12:59:05 UTC
we have seen a problem modifying notices in koha 17.05.04, the issue is that you can not modify notices if they're already created, when you try to modify you get an error in plack as these one.

DBD::mysql::db do failed: Duplicate entry 'circulation-PREDUE--email-ca-ES' 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-PREDUE--sms-ca-ES' 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-PREDUE--email-es-ES' 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-PREDUE--sms-es-ES' 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-PREDUE--email-default' 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-PREDUE--sms-default' 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.
Comment 1 Stefan Berndtsson 2017-11-10 13:58:17 UTC
Created attachment 69086 [details] [review]
Fix condition when updating an existing letter with language support turned on

There is a missing condition for "lang" in the UPDATE line in letter.pl.
Comment 2 Katrin Fischer 2017-12-05 06:59:13 UTC
Hi Hugo and Stefan, 
could this be a duplicate to bug 19675? 
Don't forget to change status to 'needs sign-off' after posting a patch!
Comment 3 Stefan Berndtsson 2017-12-05 09:44:59 UTC
(In reply to Katrin Fischer from comment #2)
> Hi Hugo and Stefan, 
> could this be a duplicate to bug 19675? 
> Don't forget to change status to 'needs sign-off' after posting a patch!

Yes, 19675 is the same fix. It will solve the problem.
Comment 4 Katrin Fischer 2017-12-05 10:29:03 UTC

*** This bug has been marked as a duplicate of bug 19675 ***