View | Details | Raw Unified | Return to bug 22610
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_22610.perl (-1 / +29 lines)
Lines 40-45 if ( CheckVersion($DBversion) ) { Link Here
40
          accounttype = 'Pay02';
40
          accounttype = 'Pay02';
41
    });
41
    });
42
42
43
    my $sth = $dbh->prepare( qq{SELECT * FROM accountlines WHERE accounttype LIKE "Pay%" AND accounttype != "Pay" } );
44
    $sth->execute();
45
    my $seen = {};
46
    while (my $row = $sth->fetchrow_hashref) {
47
        my $type = $row->{accounttype};
48
        my $sipcode = $type;
49
        $sipcode =~ s/Pay/SIP/g;
50
        unless ($seen->{$sipcode}) {
51
            $dbh->do(qq{
52
                INSERT INTO
53
                  authorised_values (category,authorised_value,lib)
54
                VALUES
55
                  ('PAYMENT_TYPE',"$sipcode",'Unrecognised SIP2 payment type')
56
            });
57
    
58
             $dbh->do(qq{
59
                UPDATE
60
                  accountlines
61
                SET
62
                  accounttype  = 'Pay',
63
                  payment_type = "$sipcode"
64
                WHERE
65
                  accounttype = "$type";
66
            });
67
    
68
            $seen->{$sipcode} = 1;
69
        }
70
    }
71
43
    SetVersion($DBversion);
72
    SetVersion($DBversion);
44
    print "Upgrade to $DBversion done (Bug 22610 - Fix accounttypes for SIP2 payments)\n";
73
    print "Upgrade to $DBversion done (Bug 22610 - Fix accounttypes for SIP2 payments)\n";
45
}
74
}
46
- 

Return to bug 22610