X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=92fb89665f9adf0d74c1df45558104700ed82c4f;hb=ec7e8155fce544f19f2b6734476ed6db8c200aa9;hp=0810a7ec3dda6f50b68fb1eb8931374814d2919e;hpb=82f76d01660b785f6c4ea13ba547c93c1c2c404d;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 0810a7ec3..92fb89665 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -45,7 +45,7 @@ our $nowarn_classload = 0; our $no_update_diff = 0; our $no_history = 0; -our $qsearch_qualify_columns = 0; +our $qsearch_qualify_columns = 1; our $no_check_foreign = 1; #well, not inefficiently in perl by default anymore @@ -876,6 +876,7 @@ sub qsearchs { # $result_record = &FS::Record:qsearchs('table',\%hash); my $table = $_[0]; my(@result) = qsearch(@_); cluck "warning: Multiple records in scalar search ($table)" + #.join(' / ', map "$_=>".$_[1]->{$_}, keys %{ $_[1] } ) if scalar(@result) > 1; #should warn more vehemently if the search was on a primary key? scalar(@result) ? ($result[0]) : (); @@ -1809,6 +1810,7 @@ sub process_batch_import { #? default_csv => $opt->{default_csv}, postinsert_callback => $opt->{postinsert_callback}, + insert_args_callback => $opt->{insert_args_callback}, ); if ( $opt->{'batch_namecol'} ) { @@ -1895,6 +1897,9 @@ sub batch_import { my $preinsert_callback = ''; $preinsert_callback = $param->{'preinsert_callback'} if $param->{'preinsert_callback'}; + my $insert_args_callback = ''; + $insert_args_callback = $param->{'insert_args_callback'} + if $param->{'insert_args_callback'}; if ( $param->{'format'} ) { @@ -2204,7 +2209,12 @@ sub batch_import { next if exists $param->{skiprow} && $param->{skiprow}; } - my $error = $record->insert; + my @insert_args = (); + if ( $insert_args_callback ) { + @insert_args = &{$insert_args_callback}($record, $param); + } + + my $error = $record->insert(@insert_args); if ( $error ) { $dbh->rollback if $oldAutoCommit;