From 1c2d715d2df8488e8297b2a5b6e2875412cee723 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Feb 2014 14:57:55 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 11867: MTT: Manage *_PHONE notices The *_PHONE notices (HOLD_PHONE, PREDUE_PHONE and OVERDUE_PHONE) should be "merged" into the main code (i.e. HOLD, PREDUE and OVERDUE). Test plan: 1/ Make sure you have HOLD_PHONE, PREDUE_PHONE and OVERDUE_PHONE notices 2/ Execute the update DB entry 3/ Verify the 3 notices have been merged into "phone" template of the HOLD, PREDUE and OVERDUE notices 4/ Verify there is no regression in the Talking Tech feature (how?) Signed-off-by: Bernardo Gonzalez Kriegel No koha-qa errors Verified that notices are merged TalkingTech_itiva_outbound.pl runs without problem... but can't produce any output, may be not correctly configured (my setup), no warnings nor log messages --- ...-4246-Talking-Tech-itiva-phone-notifications.pl | 14 +++++----- installer/data/mysql/updatedatabase.pl | 29 ++++++++++++++++++++ .../thirdparty/TalkingTech_itiva_outbound.pl | 5 ++-- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/atomicupdate/Bug-4246-Talking-Tech-itiva-phone-notifications.pl b/installer/data/mysql/atomicupdate/Bug-4246-Talking-Tech-itiva-phone-notifications.pl index 7f288e2..5355554 100644 --- a/installer/data/mysql/atomicupdate/Bug-4246-Talking-Tech-itiva-phone-notifications.pl +++ b/installer/data/mysql/atomicupdate/Bug-4246-Talking-Tech-itiva-phone-notifications.pl @@ -7,18 +7,18 @@ my $dbh = C4::Context->dbh; # add phone message transport type $dbh->do("INSERT INTO message_transport_types (message_transport_type) VALUES ('phone')"); -# adds HOLD_PHONE and PREDUE_PHONE letters (as placeholders) -$dbh->do("INSERT INTO letter (module, code, name, title, content) VALUES - ('reserves', 'HOLD_PHONE', 'Item Available for Pick-up (phone notice)', 'Item Available for Pick-up (phone notice)', 'Your item is available for pickup'), - ('circulation', 'PREDUE_PHONE', 'Advance Notice of Item Due (phone notice)', 'Advance Notice of Item Due (phone notice)', 'Your item is due soon'), - ('circulation', 'OVERDUE_PHONE', 'Overdue Notice (phone notice)', 'Overdue Notice (phone notice)', 'Your item is overdue') +# adds HOLD and PREDUE letters (as placeholders) +$dbh->do("INSERT INTO letter (module, code, name, title, content, message_transport_type) VALUES + ('reserves', 'HOLD', 'Item Available for Pick-up (phone notice)', 'Item Available for Pick-up (phone notice)', 'Your item is available for pickup', 'phone'), + ('circulation', 'PREDUE', 'Advance Notice of Item Due (phone notice)', 'Advance Notice of Item Due (phone notice)', 'Your item is due soon', 'phone'), + ('circulation', 'OVERDUE', 'Overdue Notice (phone notice)', 'Overdue Notice (phone notice)', 'Your item is overdue', 'phone') "); # add phone notifications to patron message preferences options $dbh->do("INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES - (4, 'phone', 0, 'reserves', 'HOLD_PHONE'), - (2, 'phone', 0, 'circulation', 'PREDUE_PHONE') + (4, 'phone', 0, 'reserves', 'HOLD'), + (2, 'phone', 0, 'circulation', 'PREDUE') "); # add TalkingTechItivaPhoneNotification syspref diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e8ed1c4..6eb320f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8299,6 +8299,35 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(q| + UPDATE letter + SET code="HOLD", + message_transport_type="phone", + name=(SELECT name FROM ( SELECT name FROM letter WHERE code="HOLD" LIMIT 1 ) AS t) + WHERE code="HOLD_PHONE" + |); + + $dbh->do(q| + UPDATE letter + SET code="PREDUE", + message_transport_type="phone", + name=(SELECT name FROM ( SELECT name FROM letter WHERE code="HOLD" LIMIT 1 ) AS t) + WHERE code="PREDUE_PHONE" + |); + + $dbh->do(q| + UPDATE letter + SET code="OVERDUE", + message_transport_type="phone", + name=(SELECT name FROM ( SELECT name FROM letter WHERE code="HOLD" LIMIT 1 ) AS t) + WHERE code="OVERDUE_PHONE" + |); + + print "Upgrade to $DBversion done (Bug XXXXX: Update letters *_PHONE)\n"; + SetVersion($DBversion); +} diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl index 42728d6..7d9f5e3 100755 --- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl +++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl @@ -68,8 +68,8 @@ my $type_module_map = { }; my $type_notice_map = { - 'PREOVERDUE' => 'PREDUE_PHONE', - 'OVERDUE' => 'OVERDUE_PHONE', + 'PREOVERDUE' => 'PREDUE', + 'OVERDUE' => 'OVERDUE', 'RESERVE' => 'HOLD', }; @@ -136,6 +136,7 @@ foreach my $type (@types) { biblioitems => $issues->{'biblionumber'}, message_transport_type => 'phone', }, + message_transport_type => 'phone', ); die "No letter found for type $type!... dying\n" unless $letter; -- 1.7.9.5