X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fphone_avail.pm;h=0d591138c737c4cca28add354e9b7309863a414c;hb=c079fb7da9ff7647611754608378151259b6e2d1;hp=92286abb7536c25e0147a051c242503eac5825cf;hpb=ec49e826250476a58686bfb322e7f1839e35983d;p=freeside.git diff --git a/FS/FS/phone_avail.pm b/FS/FS/phone_avail.pm index 92286abb7..0d591138c 100644 --- a/FS/FS/phone_avail.pm +++ b/FS/FS/phone_avail.pm @@ -188,13 +188,28 @@ sub process_batch_import { my $opt = { 'table' => 'phone_avail', 'params' => [ 'availbatch', 'exportnum', 'countrycode' ], - 'formats' => { 'default' => [ 'state', $numsub ] }, + 'formats' => { 'default' => [ 'state', $numsub, 'name' ], }, }; FS::Record::process_batch_import( $job, $opt, @_ ); } +sub flush { # evil direct SQL + my $opt = shift; + + if ( $opt->{'ratecenter'} =~ /^[\w\s]+$/ + && $opt->{'state'} =~ /^[A-Z][A-Z]$/ + && $opt->{'exportnum'} =~ /^\d+$/) { + my $sth = dbh->prepare('delete from phone_avail where exportnum = ? '. + ' and state = ? and name = ?'); + $sth->execute($opt->{'exportnum'},$opt->{'state'},$opt->{'ratecenter'}) + or die $sth->errstr; + } + + ''; +} + # Used by FS::Upgrade to migrate to a new database. sub _upgrade_data { my ($class, %opts) = @_;