Merge pull request #26093 from solution-libre/fix-reduce--unnecessary-complexity
FIX Reduce unnecessary complexity
This commit is contained in:
commit
e8f5f32141
1 changed files with 3 additions and 4 deletions
|
|
@ -754,15 +754,14 @@ class Notify
|
|||
continue;
|
||||
}
|
||||
|
||||
$sendto = $val;
|
||||
|
||||
$threshold = (float) $reg[1];
|
||||
if (!empty($object->total_ht) && $object->total_ht <= $threshold) {
|
||||
dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
|
||||
continue;
|
||||
}
|
||||
|
||||
$param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
||||
|
||||
$sendto = $conf->global->$param;
|
||||
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
|
||||
if ($notifcodedefid <= 0) {
|
||||
dol_print_error($this->db, 'Failed to get id from code');
|
||||
|
|
@ -973,7 +972,7 @@ class Notify
|
|||
|
||||
if ($mailfile->sendfile()) {
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($sendto)."')";
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue