X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=60b25edcf933f143c83d829d486220a4fc1c6d26;hb=73af3bb80cd59d1bed31697a97024ec764fad73c;hp=1fe51e0659bdccc0b6ced442f78177b47a48f6b3;hpb=49ba3cd359748f5fa3e1b0087840a23c5838d1ab;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 1fe51e065..60b25edcf 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -21,7 +21,7 @@ use Tie::IxHash; @ISA = qw(Exporter); @EXPORT_OK = qw(dbh fields hfields qsearch qsearchs dbdef jsearch); -$DEBUG = 2; +$DEBUG = 0; $me = '[FS::Record]'; #ask FS::UID to run this stuff for us later @@ -664,7 +664,7 @@ sub insert { if (@virtual_fields) { my %v_values = map { $_, $self->getfield($_) } @virtual_fields; - my $vfieldpart = vfieldpart_hashref($table); + my $vfieldpart = $self->vfieldpart_hashref; my $v_statement = "INSERT INTO virtual_field(recnum, vfieldpart, value) ". "VALUES (?, ?, ?)"; @@ -753,7 +753,7 @@ sub delete { my $primary_key = $self->dbdef_table->primary_key; my $v_sth; my @del_vfields; - my $vfp = vfieldpart_hashref($self->table); + my $vfp = $self->vfieldpart_hashref; foreach($self->virtual_fields) { next if $self->getfield($_) eq ''; unless(@del_vfields) { @@ -870,7 +870,7 @@ sub replace { my $v_rep_sth; my $v_del_sth; my (@add_vfields, @rep_vfields, @del_vfields); - my $vfp = vfieldpart_hashref($old->table); + my $vfp = $old->vfieldpart_hashref; foreach(grep { exists($diff{$_}) } $new->virtual_fields) { if($diff{$_} eq '') { # Delete @@ -1511,9 +1511,11 @@ TABLE. =cut sub vfieldpart_hashref { - my ($table) = @_; + my $self = shift; + my $table = $self->table; + + return {} unless $self->dbdef->table('part_virtual_field'); - return () unless $table; my $dbh = dbh; my $statement = "SELECT vfieldpart, name FROM part_virtual_field WHERE ". "dbtable = '$table'";