X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUpgrade.pm;h=f10ff06eaa211a5de40d9dd4f33b43b6839a77ad;hb=07a313acb1d91488c6aa6044771f3136d5a6fe11;hp=bf99dce12a11ca062a424476bc22e0f057a552b8;hpb=9bea322a16b0947c7d912141b6ba3df9d7eea0b0;p=freeside.git diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index bf99dce12..f10ff06ea 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -40,10 +40,6 @@ database upgrades. sub upgrade { my %opt = @_; - my $oldAutoCommit = $FS::UID::AutoCommit; - local $FS::UID::AutoCommit = 0; - $FS::UID::AutoCommit = 0; - my $data = upgrade_data(%opt); foreach my $table ( keys %$data ) { @@ -54,7 +50,17 @@ sub upgrade { if ( $class->can('_upgrade_data') ) { warn "Upgrading $table...\n"; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + $FS::UID::AutoCommit = 0; + $class->_upgrade_data(%opt); + + if ( $oldAutoCommit ) { + dbh->commit or die dbh->errstr; + } + } else { warn "WARNING: asked for upgrade of $table,". " but FS::$table has no _upgrade_data method\n"; @@ -72,10 +78,6 @@ sub upgrade { } - if ( $oldAutoCommit ) { - dbh->commit or die dbh->errstr; - } - } @@ -84,6 +86,9 @@ sub upgrade_data { tie my %hash, 'Tie::IxHash', + #msgcat + 'msgcat' => [], + #reason type and reasons 'reason_type' => [], 'reason' => [], @@ -206,7 +211,8 @@ sub upgrade_sqlradius { } my $svc_acct = qsearchs({ - 'table' => 'svc_acct.*', + 'select' => 'svc_acct.*', + 'table' => 'svc_acct', 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum )'. 'LEFT JOIN export_svc USING ( svcpart )', 'hashref' => { 'username' => $username },