Debug edit actioncomm
This commit is contained in:
parent
19c4258e2d
commit
b15fda8d9a
@ -550,7 +550,9 @@ if (empty($reshook) && $action == 'update') {
|
||||
}
|
||||
} else {
|
||||
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
|
||||
$object->type_code = GETPOST("actioncode", 'aZ09');
|
||||
}
|
||||
|
||||
$object->label = GETPOST("label", "alphanohtml");
|
||||
$object->datep = $datep;
|
||||
$object->datef = $datef;
|
||||
|
||||
@ -1150,12 +1150,8 @@ class ActionComm extends CommonObject
|
||||
$userownerid = ($this->userownerid ? $this->userownerid : 0);
|
||||
$userdoneid = ($this->userdoneid ? $this->userdoneid : 0);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
// If a type_id is set, we must also have the type_code set
|
||||
if ($this->type_id > 0) {
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
if (empty($this->type_code)) {
|
||||
$cactioncomm = new CActionComm($this->db);
|
||||
$result = $cactioncomm->fetch($this->type_id);
|
||||
@ -1164,7 +1160,18 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null");
|
||||
|
||||
$code = $this->code;
|
||||
if (empty($code) || (!empty($this->oldcopy) && $this->oldcopy->type_code != $this->type_code)) { // If code unknown or if change the type, we reset $code too
|
||||
$code = $this->type_code;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||
$sql .= ", fk_action = ".(int) $this->type_id;
|
||||
$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
|
||||
$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
|
||||
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user