From 5e58256d7f341476fae5a25edc9ffeccf43acc02 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Thu, 14 May 2020 12:32:13 +0300 Subject: [PATCH] Bug 14723: Make delivery notes translatable Delivery notes weren't translatable. This patch adds them in notices.tt. If note is Mail::Sendmail error generic 'Error occured while sending email' is shown. Also fixes MySQLisms and adds AFTER to atomicupdate file. To test prove t/db_dependent/Letters.t Sponsored-by: Koha-Suomi Oy Signed-off-by: Stina Hallin Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- C4/Letters.pm | 2 +- ...4723_-_Additional_delivery_notes_to_messages.perl | 2 +- .../intranet-tmpl/prog/en/modules/members/notices.tt | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index a2c63cb2e7..d9a7ea8d8b 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -965,7 +965,7 @@ sub EnqueueLetter { INSERT INTO message_queue ( borrowernumber, subject, content, metadata, letter_code, message_transport_type, status, time_queued, to_address, from_address, reply_address, content_type, delivery_note ) VALUES -( ?, ?, ?, ?, ?, ?, ?, NOW(), ?, ?, ?, ?, ? ) +( ?, ?, ?, ?, ?, ?, ?, CAST(NOW() AS DATE), ?, ?, ?, ?, ? ) ENDSQL my $sth = $dbh->prepare($statement); diff --git a/installer/data/mysql/atomicupdate/Bug-14723_-_Additional_delivery_notes_to_messages.perl b/installer/data/mysql/atomicupdate/Bug-14723_-_Additional_delivery_notes_to_messages.perl index 5f03d8200d..3d3098c504 100644 --- a/installer/data/mysql/atomicupdate/Bug-14723_-_Additional_delivery_notes_to_messages.perl +++ b/installer/data/mysql/atomicupdate/Bug-14723_-_Additional_delivery_notes_to_messages.perl @@ -1,6 +1,6 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - $dbh->do("ALTER TABLE message_queue ADD delivery_note mediumtext"); + $dbh->do("ALTER TABLE message_queue ADD delivery_note mediumtext AFTER content_type"); # Always end with this (adjust the bug info) SetVersion( $DBversion ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt index f14231707a..e6db22d3c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -91,7 +91,17 @@ [% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %] [% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %] - [% QUEUED_MESSAGE.delivery_note | html %] + + [% IF ( QUEUED_MESSAGE.delivery_note ) %] + [% IF ( QUEUED_MESSAGE.delivery_note == "Invalid borrowernumber $borrowernumber" ) %]Invalid borrowernumber [% borrowernumber | html %] + [% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Unable to find an email address for this borrower' ) %]Unable to find an email address for this borrower + [% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Missing SMS number' ) %]Missing SMS number + [% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Message is duplicate' ) %]Message is duplicate + [% ELSIF ( QUEUED_MESSAGE.delivery_note == 'No notes from SMS driver' ) %]No notes from SMS driver + [% ELSE %]Error occured while sending email. + [% END %] + [% END %] + [% END %] -- 2.39.5