X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=a667f4e7e1ec8ed511c367f88d304abf7d7f1d8a;hb=7516e3da0f17eeecba27219ef96a8b5f46af2083;hp=1b7ac8a7cff5258eaa365ffc306e4e82006fde66;hpb=b853ec09fb19df91fe0188c5dde9d759333a2503;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 1b7ac8a7c..a667f4e7e 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -402,26 +402,7 @@ sub qsearch { get_real_fields($table, $record, \@real_fields)); } - if( defined($extra_sql) ){ - if( $statement =~ /\sWHERE\s/i ){ - if( $extra_sql =~ /^\s*AND /i ){ - # correct format - }elsif($extra_sql =~ /^\s*WHERE /i ){ - $extra_sql =~ s/WHERE /AND /i; - }else{ - $extra_sql = " AND $extra_sql"; - } - }else{ - if( $extra_sql =~ /^\s*AND /i ){ - $extra_sql =~ s/AND /WHERE /i; - }elsif($extra_sql =~ /^\s*WHERE /i ){ - # correct format - }else{ - $extra_sql = " WHERE $extra_sql"; - } - } - $statement .= " $extra_sql"; - } + $statement .= " $extra_sql" if defined($extra_sql); $statement .= " $order_by" if defined($order_by); push @statement, $statement; @@ -1785,17 +1766,14 @@ files. Currently only supports a single file named "file". =cut -use Storable qw(thaw); use Data::Dumper; -use MIME::Base64; sub process_batch_import { - my($job, $opt) = ( shift, shift ); + my($job, $opt, $param) = @_; my $table = $opt->{table}; my @pass_params = $opt->{params} ? @{ $opt->{params} } : (); my %formats = %{ $opt->{formats} }; - my $param = thaw(decode_base64(shift)); warn Dumper($param) if $DEBUG; my $files = $param->{'uploaded_files'} @@ -2668,8 +2646,8 @@ sub ut_alpha_lower { Check/untaint phone numbers. May be null. If there is an error, returns the error, otherwise returns false. -Takes an optional two-letter ISO country code; without it or with unsupported -countries, ut_phonen simply calls ut_alphan. +Takes an optional two-letter ISO 3166-1 alpha-2 country code; without +it or with unsupported countries, ut_phonen simply calls ut_alphan. =cut @@ -3341,7 +3319,7 @@ sub scalar_sql { defined($scalar) ? $scalar : ''; } -=item count [ WHERE ] +=item count [ WHERE [, PLACEHOLDER ...] ] Convenience method for the common case of "SELECT COUNT(*) FROM table", with optional WHERE. Must be called as method on a class with an @@ -3354,7 +3332,7 @@ sub count { my $table = $self->table or die 'count called on object of class '.ref($self); my $sql = "SELECT COUNT(*) FROM $table"; $sql .= " WHERE $where" if $where; - $self->scalar_sql($sql); + $self->scalar_sql($sql, @_); } =back