Bug 22521: (QA follow-up) Corrections to tests
[koha-equinox.git] / installer / data / mysql / atomicupdate / bug_22521.perl
1 $DBversion = 'XXX';    # will be replaced by the RM
2 if ( CheckVersion($DBversion) ) {
3
4     $dbh->do(qq{
5         UPDATE
6           `account_offset_types`
7         SET
8           type = 'OVERDUE'
9         WHERE
10           type = 'Fine';
11     });
12
13     $dbh->do(qq{
14         UPDATE
15           `account_offset_types`
16         SET
17           type = 'OVERDUE_INCREASE'
18         WHERE
19           type = 'fine_increase';
20     });
21
22     $dbh->do(qq{
23         UPDATE
24           `account_offset_types`
25         SET
26           type = 'OVERDUE_DECREASE'
27         WHERE
28           type = 'fine_decrease';
29     });
30
31     if ( column_exists( 'accountlines', 'accounttype' ) ) {
32         $dbh->do(
33             qq{
34             ALTER TABLE `accountlines`
35             CHANGE COLUMN `accounttype`
36               `accounttype` varchar(16) DEFAULT NULL;
37           }
38         );
39     }
40
41     $dbh->do(qq{
42         UPDATE
43           accountlines
44         SET
45           accounttype = 'OVERDUE',
46           status = 'UNRETURNED'
47         WHERE
48           accounttype = 'FU';
49     });
50
51     $dbh->do(qq{
52         UPDATE
53           accountlines
54         SET
55           accounttype = 'OVERDUE',
56           status = 'FORGIVEN'
57         WHERE
58           accounttype = 'FFOR';
59     });
60
61     $dbh->do(qq{
62         UPDATE
63           accountlines
64         SET
65           accounttype = 'OVERDUE',
66           status = 'RETURNED'
67         WHERE
68           accounttype = 'F';
69     });
70     SetVersion($DBversion);
71     print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n";
72 }