doxygen
This commit is contained in:
parent
4e18f46f28
commit
fbc0be3a43
@ -32,7 +32,7 @@ class Comment extends CommonObject
|
|||||||
public $table_element = 'comment';
|
public $table_element = 'comment';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID of parent key (it's nome the name of a field)
|
* @var int ID of parent key (it's not the name of a field)
|
||||||
*/
|
*/
|
||||||
public $fk_element;
|
public $fk_element;
|
||||||
|
|
||||||
@ -75,10 +75,16 @@ class Comment extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string import key
|
||||||
|
*/
|
||||||
public $import_key;
|
public $import_key;
|
||||||
|
|
||||||
public $comments = array();
|
public $comments = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Comment Object oldcopy
|
||||||
|
*/
|
||||||
public $oldcopy;
|
public $oldcopy;
|
||||||
|
|
||||||
|
|
||||||
@ -134,26 +140,26 @@ class Comment extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
if (!$resql) {
|
||||||
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
|
|
||||||
if (!$notrigger)
|
if (!$notrigger) {
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('TASK_COMMENT_CREATE', $user);
|
$result = $this->call_trigger('TASK_COMMENT_CREATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ($this->errors as $errmsg) {
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
@ -193,12 +199,10 @@ class Comment extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num_rows = $this->db->num_rows($resql);
|
$num_rows = $this->db->num_rows($resql);
|
||||||
|
|
||||||
if ($num_rows)
|
if ($num_rows) {
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
@ -215,8 +219,11 @@ class Comment extends CommonObject
|
|||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
if ($num_rows) return 1;
|
if ($num_rows) {
|
||||||
else return 0;
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
@ -237,8 +244,12 @@ class Comment extends CommonObject
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->fk_element)) $this->fk_project = (int) trim($this->fk_element);
|
if (isset($this->fk_element)) {
|
||||||
if (isset($this->description)) $this->description = trim($this->description);
|
$this->fk_project = (int) trim($this->fk_element);
|
||||||
|
}
|
||||||
|
if (isset($this->description)) {
|
||||||
|
$this->description = trim($this->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
@ -256,24 +267,24 @@ class Comment extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
if (!$resql) {
|
||||||
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
if (!$notrigger) {
|
||||||
if (!$notrigger)
|
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('TASK_COMMENT_MODIFY', $user);
|
$result = $this->call_trigger('TASK_COMMENT_MODIFY', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ($this->errors as $errmsg) {
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
@ -306,24 +317,24 @@ class Comment extends CommonObject
|
|||||||
$sql .= " WHERE rowid=".$this->id;
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
if (!$resql) {
|
||||||
|
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
if (!$notrigger) {
|
||||||
if (!$notrigger)
|
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('TASK_COMMENT_DELETE', $user);
|
$result = $this->call_trigger('TASK_COMMENT_DELETE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ($this->errors as $errmsg) {
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
@ -358,13 +369,10 @@ class Comment extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num_rows = $this->db->num_rows($resql);
|
$num_rows = $this->db->num_rows($resql);
|
||||||
if ($num_rows > 0)
|
if ($num_rows > 0) {
|
||||||
{
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
|
||||||
{
|
|
||||||
$comment = new self($db);
|
$comment = new self($db);
|
||||||
$comment->fetch($obj->rowid);
|
$comment->fetch($obj->rowid);
|
||||||
$this->comments[] = $comment;
|
$this->comments[] = $comment;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user