1 $DBversion = 'XXX'; # will be replaced by the RM
2 if ( CheckVersion($DBversion) ) {
8 'Manual Credit' => 'C',
12 my $sth = $dbh->prepare( "SELECT accountlines_id FROM accountlines WHERE accounttype = 'VOID'" );
13 my $sth2 = $dbh->prepare( "SELECT type FROM account_offsets WHERE credit_id = ? ORDER BY created_on LIMIT 1" );
14 my $sth3 = $dbh->prepare( "UPDATE accountlines SET accounttype = ?, status = 'VOID' WHERE accountlines_id = ?" );
16 while (my $row = $sth->fetchrow_hashref) {
17 $sth2->execute($row->{accountlines_id});
18 my $result = $sth2->fetchrow;
19 my $type = $types_map->{$result->{'type'}} // 'Pay';
20 $sth3->execute($type,$row->{accountlines_id});
23 SetVersion($DBversion);
24 print "Upgrade to $DBversion done (Bug 22511 - Update existing VOID accountlines)\n";