- map {
- new FS::Record ($table,$sth->fetchrow_hashref);
- } ( 1 .. $sth->execute );
+ if ( eval ' scalar(@FS::'. $table. '::ISA);' ) {
+ map {
+ eval 'create FS::'. $table. ' ( $sth->fetchrow_hashref );';
+ } ( 1 .. $sth->execute );
+ } else {
+ carp "qsearch: warning: FS::$table not loaded; returning generic FS::Record objects";
+ map {
+ new FS::Record ($table,$sth->fetchrow_hashref);
+ } ( 1 .. $sth->execute );
+ }