X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=f88be8b00f80639a980148c0bc774f8662656114;hb=08cc56589e213542a72060234bdad49fbfeb67c2;hp=69913c18d798bc21f92bacf6cae342a50535448a;hpb=064b854f445b96607bb1193bb277f44a5b84b00a;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 69913c18d..f88be8b00 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -6,9 +6,8 @@ use subs qw(reload_dbdef); use Exporter; use Carp qw(carp cluck croak confess); use File::CounterFile; +use DBIx::DBSchema; use FS::UID qw(dbh checkruid swapuid getotaker datasrc driver_name); -use FS::dbdef; -use diagnostics; @ISA = qw(Exporter); @EXPORT_OK = qw(dbh fields hfields qsearch qsearchs dbdef); @@ -127,7 +126,7 @@ sub new { $hashref->{$field}='' unless defined $hashref->{$field}; #trim the '$' and ',' from money fields for Pg (belong HERE?) #(what about Pg i18n?) - if ( driver_name eq 'Pg' + if ( driver_name =~ /^Pg$/i && $self->dbdef_table->column($field)->type eq 'money' ) { ${$hashref}{$field} =~ s/^\$//; ${$hashref}{$field} =~ s/\,//; @@ -150,26 +149,38 @@ sub create { } } -=item qsearch TABLE, HASHREF +=item qsearch TABLE, HASHREF, SELECT, EXTRA_SQL 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 module is loaded (i.e. via `use FS::cust_main;'), otherwise returns FS::Record objects. +###oops, argh, FS::Record::new only lets us create database fields. +#Normal behaviour if SELECT is not specified is `*', as in +#C