diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 81f64ef6016..6d9587961c6 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -499,7 +499,7 @@ if ($object->fetch($id) >= 0) // Fix/update nbemail on emailing record if it differs (may happen if user edit lines from database directly) if (empty($asearchcriteriahasbeenset)) { - if ($nbtotalofrecords != $object->email) { + if ($nbtotalofrecords != $object->nbemail) { dol_syslog("We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail"); //print "nbemail=".$object->nbemail." nbtotalofrecords=".$nbtotalofrecords; $resultrefresh = $object->refreshNbOfTargets(); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 17b5a779617..873dae1464a 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -603,12 +603,15 @@ class Mailing extends CommonObject if (! $resqlupdate) { $this->error = $this->db->lasterror(); return -1; + } else { + $this->nbemail = (int) $nbforupdate; } } } else { $this->error = $this->db->lasterror(); return -1; } + return 1; }