Bug 24378: Database update to rewrite notice if left unchanged
authorKatrin Fischer <katrin.fischer.83@web.de>
Sat, 11 Apr 2020 17:52:30 +0000 (17:52 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 12 May 2020 10:03:42 +0000 (11:03 +0100)
The database update makes the same changes as done by
Andrew on the old database entry. We check for full sentences
left unchanged to minimize issues with changes made by the library.

Test plan of first patch applies.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

installer/data/mysql/atomicupdate/bug_24378_auto_renewals.perl [new file with mode: 0644]

diff --git a/installer/data/mysql/atomicupdate/bug_24378_auto_renewals.perl b/installer/data/mysql/atomicupdate/bug_24378_auto_renewals.perl
new file mode 100644 (file)
index 0000000..a958035
--- /dev/null
@@ -0,0 +1,35 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    # you can use $dbh here like:
+    # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
+
+    $dbh->do(q{
+        UPDATE letter SET
+        name = REPLACE(name, "notification on auto renewing", "Notification of automatic renewal"),
+        title = REPLACE(title, "Auto renewals", "Automatic renewal notice"),
+        content = REPLACE(content, "You have reach the maximum of checkouts possible.", "You have reached the maximum number of checkouts possible.")
+        WHERE code = 'AUTO_RENEWALS';
+    });
+    $dbh->do(q{
+        UPDATE letter SET
+        content = REPLACE(content, "You have overdues.", "You have overdue items.")
+        WHERE code = 'AUTO_RENEWALS';
+    });
+    $dbh->do(q{
+        UPDATE letter SET
+        content = REPLACE(content, "It\'s too late to renew this checkout.", "It\'s too late to renew this item.")
+        WHERE code = 'AUTO_RENEWALS';
+    });
+    $dbh->do(q{
+        UPDATE letter SET
+        content = REPLACE(content, "You have too much unpaid fines.", "Your total unpaid fines are too high.")
+        WHERE code = 'AUTO_RENEWALS';
+    });
+    $dbh->do(q{
+        UPDATE letter SET
+        content = REPLACE(content, "The following item [% biblio.title %] has correctly been renewed and is now due [% checkout.date_due %]", "The following item, [% biblio.title %], has correctly been renewed and is now due on [% checkout.date_due %]
+")
+        WHERE code = 'AUTO_RENEWALS';
+    });
+    NewVersion( $DBversion, 24378, "Fix some grammatical errors in default auto renewal notice");
+}