summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-02-26 11:42:37 +0000
committerivan <ivan>2002-02-26 11:42:37 +0000
commitfc0715ded1a4c1ace11f1ad1df7600f726206afc (patch)
treedcf0c840ab0d176bc5fa6f36b8bd906746cabc4c
parent1fdd857c556d4e6ee7e2b577085ede891dd41506 (diff)
in Record.pm - call ->check **BEFORE** generating @diff for SQL. causing
weird effects with cust_main::check that modifies record (ship_ field weirdness) fix nasty logic error triggered by changing a ship_ field from something TO identical to the corresponding non-ship_ field. ouch
-rw-r--r--FS/FS/Record.pm12
-rw-r--r--FS/FS/cust_main.pm4
2 files changed, 8 insertions, 8 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index f30223351..0aa010bbc 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -575,12 +575,6 @@ sub replace {
my ( $new, $old ) = ( shift, shift );
warn "[debug]$me $new ->replace $old\n" if $DEBUG;
- my @diff = grep $new->getfield($_) ne $old->getfield($_), $old->fields;
- unless ( @diff ) {
- carp "[warning]$me $new -> replace $old: records identical";
- return '';
- }
-
return "Records not in same table!" unless $new->table eq $old->table;
my $primary_key = $old->dbdef_table->primary_key;
@@ -591,6 +585,12 @@ sub replace {
my $error = $new->check;
return $error if $error;
+ my @diff = grep $new->getfield($_) ne $old->getfield($_), $old->fields;
+ unless ( @diff ) {
+ carp "[warning]$me $new -> replace $old: records identical";
+ return '';
+ }
+
my $statement = "UPDATE ". $old->table. " SET ". join(', ',
map {
"$_ = ". _quote($new->getfield($_),$old->table,$_)
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 125332c9d..cf5bd3314 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -512,7 +512,7 @@ and repalce methods.
sub check {
my $self = shift;
- warn "BEFORE: \n". $self->_dump;
+ #warn "BEFORE: \n". $self->_dump;
my $error =
$self->ut_numbern('custnum')
@@ -698,7 +698,7 @@ sub check {
$self->otaker(getotaker);
- warn "AFTER: \n". $self->_dump;
+ #warn "AFTER: \n". $self->_dump;
''; #no error
}