X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=e24c0eb9a83eb54eb45e155d92d8628b48253876;hb=c62991706722410987b249893f1323b4ba0e7a5f;hp=5465f078a6edb7c81db06de0f5f7805ee6e2eb29;hpb=9d013bfbad3913b8ab9f1885fc66ba34032f1b0a;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 5465f078a..e24c0eb9a 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -180,7 +180,7 @@ sub create { } } -=item qsearch TABLE, HASHREF, SELECT, EXTRA_SQL, CACHE_OBJ, AS +=item qsearch TABLE, HASHREF, SELECT, EXTRA_SQL, CACHE_OBJ, ADDL_FROM Searches the database for all records matching (at least) the key/value pairs in HASHREF. Returns all the records found as `FS::TABLE' objects if that @@ -199,7 +199,7 @@ objects. =cut sub qsearch { - my($stable, $record, $select, $extra_sql, $cache, $as ) = @_; + my($stable, $record, $select, $extra_sql, $cache, $addl_from ) = @_; #$stable =~ /^([\w\_]+)$/ or die "Illegal table: $table"; #for jsearch $stable =~ /^([\w\s\(\)\.\,\=]+)$/ or die "Illegal table: $stable"; @@ -223,7 +223,7 @@ sub qsearch { } my $statement = "SELECT $select FROM $stable"; - $statement .= " AS $as" if $as; + $statement .= " $addl_from" if $addl_from; if ( @real_fields or @virtual_fields ) { $statement .= ' WHERE '. join(' AND ', ( map { @@ -428,7 +428,7 @@ sub jsearch { ); } -=item qsearchs TABLE, HASHREF +=item qsearchs TABLE, HASHREF, SELECT, EXTRA_SQL, CACHE_OBJ, ADDL_FROM Same as qsearch, except that if more than one record matches, it Bs but returns the first. If this happens, you either made a logic error in asking @@ -439,7 +439,7 @@ for a single item, or your data is corrupted. sub qsearchs { # $result_record = &FS::Record:qsearchs('table',\%hash); my $table = $_[0]; my(@result) = qsearch(@_); - carp "warning: Multiple records in scalar search ($table)" + cluck "warning: Multiple records in scalar search ($table)" if scalar(@result) > 1; #should warn more vehemently if the search was on a primary key? scalar(@result) ? ($result[0]) : ();