Lines 9890-9896
if ( CheckVersion($DBversion) ) {
Link Here
|
9890 |
$dbh->do("DROP TABLE old_overduerules"); |
9890 |
$dbh->do("DROP TABLE old_overduerules"); |
9891 |
$dbh->do("ALTER TABLE overduerules_transport_types |
9891 |
$dbh->do("ALTER TABLE overduerules_transport_types |
9892 |
ADD COLUMN overduerules_id mediumint NOT NULL"); |
9892 |
ADD COLUMN overduerules_id mediumint NOT NULL"); |
9893 |
my $update = $dbh->prepare("update overduerules_transport_types set overduerules_id = (select overduerules_id from overduerules where branchcode=? and categorycode=? limit 1) where id=?"); |
|
|
9894 |
my $mtts = $dbh->selectall_arrayref("select * from overduerules_transport_types", { Slice => {} }); |
9893 |
my $mtts = $dbh->selectall_arrayref("select * from overduerules_transport_types", { Slice => {} }); |
9895 |
$dbh->do("DELETE FROM overduerules_transport_types"); |
9894 |
$dbh->do("DELETE FROM overduerules_transport_types"); |
9896 |
$dbh->do("ALTER TABLE overduerules_transport_types |
9895 |
$dbh->do("ALTER TABLE overduerules_transport_types |
Lines 9898-9907
if ( CheckVersion($DBversion) ) {
Link Here
|
9898 |
ADD FOREIGN KEY overduerules_transport_types_fk (overduerules_id) REFERENCES overduerules (overduerules_id) ON DELETE CASCADE ON UPDATE CASCADE, |
9897 |
ADD FOREIGN KEY overduerules_transport_types_fk (overduerules_id) REFERENCES overduerules (overduerules_id) ON DELETE CASCADE ON UPDATE CASCADE, |
9899 |
DROP COLUMN branchcode, |
9898 |
DROP COLUMN branchcode, |
9900 |
DROP COLUMN categorycode"); |
9899 |
DROP COLUMN categorycode"); |
9901 |
my $s = $dbh->prepare("insert into overduerules_transport_types (id, overduerules_id, letternumber, message_transport_type) values(?,?,?,?)"); |
9900 |
my $s = $dbh->prepare("insert into overduerules_transport_types (overduerules_id, id, letternumber, message_transport_type) " |
|
|
9901 |
." values((SELECT overduerules_id FROM overduerules WHERE branchcode = ? AND categorycode = ?),?,?,?)"); |
9902 |
foreach my $mtt(@$mtts){ |
9902 |
foreach my $mtt(@$mtts){ |
9903 |
$s->execute($mtt->{id}, 1, $mtt->{letternumber}, $mtt->{message_transport_type} ); |
9903 |
$s->execute($mtt->{branchcode}, $mtt->{categorycode}, $mtt->{id}, $mtt->{letternumber}, $mtt->{message_transport_type} ); |
9904 |
$update->execute($mtt->{branchcode}, $mtt->{categorycode}, $mtt->{id}); |
|
|
9905 |
} |
9904 |
} |
9906 |
$dbh->do("SET FOREIGN_KEY_CHECKS=1"); |
9905 |
$dbh->do("SET FOREIGN_KEY_CHECKS=1"); |
9907 |
print "Upgrade to $DBversion done (Bug 13624 - Remove columns branchcode, categorytype from table overduerules_transport_types)\n"; |
9906 |
print "Upgrade to $DBversion done (Bug 13624 - Remove columns branchcode, categorytype from table overduerules_transport_types)\n"; |