From 8dda59ee4b406f572430583591be1e8cbeacff94 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 22 Mar 2019 11:46:36 +0000
Subject: [PATCH] Bug 22521: Update existing accounttypes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 .../data/mysql/atomicupdate/bug_22521.perl    | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/installer/data/mysql/atomicupdate/bug_22521.perl b/installer/data/mysql/atomicupdate/bug_22521.perl
index d6d5acf6ba..f4bb25d614 100644
--- a/installer/data/mysql/atomicupdate/bug_22521.perl
+++ b/installer/data/mysql/atomicupdate/bug_22521.perl
@@ -11,6 +11,35 @@ if ( CheckVersion($DBversion) ) {
         );
     }
 
+    $dbh->do(qq{
+        UPDATE
+          accountlines
+        SET
+          accounttype = 'OVERDUE',
+          status = 'UNRETURNED'
+        WHERE
+          accounttype = 'FU';    
+    });
+
+    $dbh->do(qq{
+        UPDATE
+          accountlines
+        SET
+          accounttype = 'OVERDUE',
+          status = 'FORGIVEN'
+        WHERE
+          accounttype = 'FFOR';    
+    });
+
+    $dbh->do(qq{
+        UPDATE
+          accountlines
+        SET
+          accounttype = 'OVERDUE',
+          status = 'RETURNED'
+        WHERE
+          accounttype = 'F';    
+    });
     SetVersion($DBversion);
-    print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16))\n";
+    print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n";
 }
-- 
2.20.1