X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr%2FImport.pm;h=39a7772a36735eaf8de6ed2a098aff3f5834797c;hb=07f96113f8da936c6255245c42f941ae8a3bb16f;hp=472e2206270aff244bf10d5152b8a1b1c444bde0;hpb=189f40043dc1e82373243acc73abd03f8151c87c;p=freeside.git diff --git a/FS/FS/cdr/Import.pm b/FS/FS/cdr/Import.pm index 472e22062..39a7772a3 100644 --- a/FS/FS/cdr/Import.pm +++ b/FS/FS/cdr/Import.pm @@ -34,7 +34,7 @@ CDR importing =head1 CLASS METHODS -=item do_cli_import +=item dbi_import =cut @@ -81,9 +81,9 @@ sub dbi_import { # ) #my @cols = values %{ $args{column_map} }; - my $sql = "SELECT * FROM $table "; # join(',', @cols). " FROM $table ". + my $sql = "SELECT $table.* FROM $table "; # join(',', @cols). " FROM $table ". $sql .= 'LEFT JOIN '. $args{status_table}. - ' USING ( '. $args{primary_key}. ' )' + " ON ( $table.$pkey = ". $args{status_table}. ".$pkey )" if $args{status_table}; $sql .= ' WHERE freesidestatus IS NULL '; @@ -117,13 +117,15 @@ sub dbi_import { $cdr->cdrtypenum($opt{c}) if $opt{c}; - #print $row->{$pkey},"\n" if $opt{v}; + my $pkey_value = $row->{$pkey}; + + #print "$pkey_value\n" if $opt{v}; my $error = $cdr->insert; if ($error) { - #die $row->{$pkey} . ": failed import: $error\n"; - print $row->{$pkey} . ": failed import: $error\n"; + #die "$pkey_value: failed import: $error\n"; + print "$pkey_value: failed import: $error\n"; } else { @@ -142,7 +144,7 @@ sub dbi_import { } - my $updated = $dbi->do($st_sql, undef, $row->{$pkey} ); + my $updated = $dbi->do($st_sql, undef, $pkey_value ); #$updates += $updated; die "failed to set status: ".$dbi->errstr."\n" unless $updated;