mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge pull request #7427 from atm-arnaud/NEW_comment_generic_element
New comment generic element
This commit is contained in:
@@ -308,6 +308,12 @@ abstract class CommonObject
|
||||
* @var CommonObjectLine[]
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* @var mixed Contains comments
|
||||
* @see fetchComments()
|
||||
*/
|
||||
public $comments=array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
@@ -5288,5 +5294,28 @@ abstract class CommonObject
|
||||
|
||||
// TODO...
|
||||
}
|
||||
|
||||
/**
|
||||
* Load comments linked with current task
|
||||
* @return boolean 1 if ok
|
||||
*/
|
||||
public function fetchComments()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
|
||||
|
||||
$comment = new Comment($this->db);
|
||||
$this->comments = Comment::fetchAllFor($this->element, $this->id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return nb comments already posted
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNbComments()
|
||||
{
|
||||
return count($this->comments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user