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

(-)a/installer/data/mysql/atomicupdate/bug_29457.pl (-3 / +10 lines)
Lines 6-12 return { Link Here
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        my ( $count ) = $dbh->selectrow_array( q{SELECT COUNT(*) FROM accountlines WHERE credit_type_code = 'CANCELLATION' AND manager_id is NULL} );
9
        my ( $count_bad ) = $dbh->selectrow_array( q{SELECT COUNT(*) FROM accountlines WHERE credit_type_code = 'CANCELLATION' AND manager_id IS NOT NULL} );
10
        say "Note: We counted $count cancellations in accountlines with an empty manager_id. We regret that this information is missing, but it can't hurt. This release fixed the bug causing it." if $count;
10
        if ( $count_bad ) {
11
            say $out "Warning: We counted $count_bad cancellations in accountlines where the manager_id is likely incorrect.";
12
            say $out "Prior to this patch a users 'userid' was being passed into the manager_id field where borrowernumber is expected";
13
            say $out "You may wish to run 'UPDATE accountlines SET manager_id = NULL WHERE credit_type_code = 'CANCELLATION'";
14
            say $out "Alternatively you may wish to run 'UPDATE accountlines SET manager_id = ( SELECT borrowernumber FROM borrowers WHERE borrowers.userid = accountlines.manager_id ) WHERE credit_type_code = 'CANCELLATION''";
15
        }
16
17
        my ( $count_empty ) = $dbh->selectrow_array( q{SELECT COUNT(*) FROM accountlines WHERE credit_type_code = 'CANCELLATION' AND manager_id IS NULL} );
18
        say $out "Note: We counted $count_empty cancellations in accountlines with an empty manager_id. We regret that this information is missing, but it can't hurt. This release fixed the bug causing it." if $count_empty;
11
    },
19
    },
12
}
20
}
13
- 

Return to bug 29457