Bug 11867: MTT: Manage *_PHONE notices
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 27 Feb 2014 13:57:55 +0000 (14:57 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 2 May 2014 20:29:20 +0000 (20:29 +0000)
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 <bgkriegel@gmail.com>
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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

installer/data/mysql/atomicupdate/Bug-4246-Talking-Tech-itiva-phone-notifications.pl
installer/data/mysql/updatedatabase.pl
misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl

index 7f288e2..5355554 100644 (file)
@@ -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
index f1eb110..7ad52f6 100755 (executable)
@@ -8310,6 +8310,39 @@ if ( CheckVersion($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 11867: Update letters *_PHONE)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index ba1b8f2..d7054c2 100755 (executable)
@@ -68,8 +68,8 @@ my $type_module_map = {
 };
 
 my $type_notice_map = {
-    'PREOVERDUE' => 'PREDUE_PHONE',
-    'OVERDUE'    => 'OVERDUE_PHONE',
+    'PREOVERDUE' => 'PREDUE',
+    'OVERDUE'    => 'OVERDUE',
     'RESERVE'    => 'HOLD',
 };