From 94d84abb3b04da96767acdba8842ff2353007b78 Mon Sep 17 00:00:00 2001 From: Indranil Das Gupta Date: Mon, 18 May 2015 18:08:07 +0530 Subject: [PATCH] Bug 14206 - message_transport_type handling in C4::Letters::getletter Revised patch based on Jonathan Druart's comment. Addresses the default message_transport_type value in C4::Letters::getletter() for notices that do not use an email template (i.e. uses phone / print / sms). Fixes the issue of not being able to delete notices with non-email templates from Tools -> Notices & Slips Test plan ========= 1/ Go to Tools -> Notices & Slips. Add a new notice only for print, leave 'Library' and 'Koha module' options as default selections. Enter 'KOHA_14206' and 'Koha Test 14206' against Code and Name respectively, and 'Test' and 'Test Message' for subject and body. Leave the Email, Phone and SMS tabs blank. Save the notice. 2/ On the notices listing page the new notice will be listed. Try to delete it. It will load the 'Delete notice' dialog form, but the table will not show any data under s - 'Library', 'Module', 'Code' or 'Name'. 3/ Click the "Yes, delete" button. The page will be submitted and the Notices listing reloaded. The print-only KOHA_14206 notice should continue to exist. This is *wrong*. 4/ Apply the patch 5/ Reload the listings page and click on the 'Delete' link for Notice KOHA_14206. This time, it should show the data under 'Module', 'Code' or 'Name' at least. 6/ Click on 'Yes, delete'. The page should submit and the listing page reload. This time KOHA_14206 will be gone. 7/ Run sql statement SELECT * FROM `letter` WHERE `code` = 'KOHA_14206' to check actual deletion from the database. No record should be returned. 8/ Re-add notice KOHA_14206, but this time also add fill in print, email, phone and sms delivery options. 9/ Delete the newly re-added notice KOHA_14206. It should no longer be shown in the listing. Confirm deletion by running step #7. No record should be returned. --- C4/Letters.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 0faa91e..d8bf7a0 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -226,7 +226,8 @@ sub getletter { my $sth = $dbh->prepare(q{ SELECT * FROM letter - WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '') AND message_transport_type = ? + WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '') + AND (message_transport_type = ? OR message_transport_type IN (SELECT message_transport_type FROM message_transport_types)) ORDER BY branchcode DESC LIMIT 1 }); $sth->execute( $module, $code, $branchcode, $message_transport_type ); -- 1.9.1