Lines 9593-9599
if(CheckVersion($DBversion)) {
Link Here
|
9593 |
SetVersion($DBversion); |
9593 |
SetVersion($DBversion); |
9594 |
} |
9594 |
} |
9595 |
|
9595 |
|
|
|
9596 |
$DBversion = "3.19.00.XXX"; |
9597 |
if(CheckVersion($DBversion)) { |
9598 |
$dbh->do(q{ |
9599 |
INSERT INTO authorised_values (category, authorised_value, lib) VALUES |
9600 |
('ORDER_CANCELLATION_REASON', 0, 'No reason'), |
9601 |
('ORDER_CANCELLATION_REASON', 1, 'Sold out'), |
9602 |
('ORDER_CANCELLATION_REASON', 2, 'Restocking') |
9603 |
}); |
9604 |
|
9605 |
my $already_existing_reasons = $dbh->selectcol_arrayref(q{ |
9606 |
SELECT DISTINCT( cancellationreason ) |
9607 |
FROM aqorders; |
9608 |
}, { Slice => {} }); |
9609 |
|
9610 |
my $update_orders_sth = $dbh->prepare(q{ |
9611 |
UPDATE aqorders |
9612 |
SET cancellationreason = ? |
9613 |
WHERE cancellationreason = ? |
9614 |
}); |
9596 |
|
9615 |
|
|
|
9616 |
my $insert_av_sth = $dbh->prepare(q{ |
9617 |
INSERT INTO authorised_values (category, authorised_value, lib) VALUES |
9618 |
('ORDER_CANCELLATION_REASON', ?, ?) |
9619 |
}); |
9620 |
my $i = 3; |
9621 |
for my $reason ( @$already_existing_reasons ) { |
9622 |
next unless $reason; |
9623 |
$insert_av_sth->execute( $i, $reason ); |
9624 |
$update_orders_sth->execute( $i, $reason ); |
9625 |
$i++; |
9626 |
} |
9627 |
print "Upgrade to $DBversion done (Bug XXXXX - Add the ORDER_CANCELLATION_REASON authorised value)\n"; |
9628 |
SetVersion($DBversion); |
9629 |
} |
9597 |
|
9630 |
|
9598 |
=head1 FUNCTIONS |
9631 |
=head1 FUNCTIONS |
9599 |
|
9632 |
|