27require_once DOL_DOCUMENT_ROOT.
'/core/class/comment.class.php';
29$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
36if ($action ==
'addcomment') {
37 $description =
GETPOST(
'comment_description',
'restricthtml');
38 if (!empty($description)) {
39 $comment->description = $description;
40 $comment->datec = time();
41 $comment->fk_element =
GETPOST(
'id',
'int');
42 $comment->element_type =
GETPOST(
'comment_element_type',
'alpha');
43 $comment->fk_user_author = $user->id;
44 $comment->entity = $conf->entity;
45 if ($comment->create($user) > 0) {
47 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
55if ($action ===
'updatecomment') {
56 if ($comment->fetch($idcomment) >= 0) {
57 $comment->description =
GETPOST(
'comment_description',
'restricthtml');
58 if ($comment->update($user) > 0) {
60 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1#comment' :
''));
68if ($action ==
'deletecomment') {
69 if ($comment->fetch($idcomment) >= 0) {
70 if ($comment->delete($user) > 0) {
72 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.