my $table = $cache ? $cache->table : $stable;
my $dbdef_table = dbdef->table($table)
or die "No schema for table $table found - ".
- "do you need to create it or run dbdef-create?";
+ "do you need to run freeside-upgrade?";
my $pkey = $dbdef_table->primary_key;
my @real_fields = grep exists($record->{$_}), real_fields($table);
warn "[debug]$me $new ->replace $old\n" if $DEBUG;
+ if ( $new->can('replace_check') ) {
+ my $error = $new->replace_check($old);
+ return $error if $error;
+ }
+
return "Records not in same table!" unless $new->table eq $old->table;
my $primary_key = $old->dbdef_table->primary_key;