Lines 9732-9737
if ( CheckVersion($DBversion) ) {
Link Here
|
9732 |
SetVersion($DBversion); |
9732 |
SetVersion($DBversion); |
9733 |
} |
9733 |
} |
9734 |
|
9734 |
|
|
|
9735 |
$DBversion = "3.19.00.XXX"; |
9736 |
if(CheckVersion($DBversion)) { |
9737 |
$dbh->do(q{ |
9738 |
INSERT INTO authorised_values (category, authorised_value, lib) VALUES |
9739 |
('ORDER_CANCELLATION_REASON', 0, 'No reason'), |
9740 |
('ORDER_CANCELLATION_REASON', 1, 'Sold out'), |
9741 |
('ORDER_CANCELLATION_REASON', 2, 'Restocking') |
9742 |
}); |
9743 |
|
9744 |
my $already_existing_reasons = $dbh->selectcol_arrayref(q{ |
9745 |
SELECT DISTINCT( cancellationreason ) |
9746 |
FROM aqorders; |
9747 |
}, { Slice => {} }); |
9748 |
|
9749 |
my $update_orders_sth = $dbh->prepare(q{ |
9750 |
UPDATE aqorders |
9751 |
SET cancellationreason = ? |
9752 |
WHERE cancellationreason = ? |
9753 |
}); |
9754 |
|
9755 |
my $insert_av_sth = $dbh->prepare(q{ |
9756 |
INSERT INTO authorised_values (category, authorised_value, lib) VALUES |
9757 |
('ORDER_CANCELLATION_REASON', ?, ?) |
9758 |
}); |
9759 |
my $i = 3; |
9760 |
for my $reason ( @$already_existing_reasons ) { |
9761 |
next unless $reason; |
9762 |
$insert_av_sth->execute( $i, $reason ); |
9763 |
$update_orders_sth->execute( $i, $reason ); |
9764 |
$i++; |
9765 |
} |
9766 |
print "Upgrade to $DBversion done (Bug XXXXX - Add the ORDER_CANCELLATION_REASON authorised value)\n"; |
9767 |
SetVersion($DBversion); |
9768 |
} |
9769 |
|
9735 |
=head1 FUNCTIONS |
9770 |
=head1 FUNCTIONS |
9736 |
|
9771 |
|
9737 |
=head2 TableExists($table) |
9772 |
=head2 TableExists($table) |