42@phan-var-force ?string $action
43@phan-var-force int $withproject
44@phan-var-force int $idcomment
45@phan-var-force int $id
48require_once DOL_DOCUMENT_ROOT.
'/core/class/comment.class.php';
50$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
57if ($action ==
'addcomment') {
58 $description =
GETPOST(
'comment_description',
'restricthtml');
59 if (!empty($description)) {
60 $comment->description = $description;
63 $comment->element_type =
GETPOST(
'comment_element_type',
'alpha');
64 $comment->fk_user_author = $user->id;
65 $comment->entity =
$conf->entity;
66 if ($comment->create($user) > 0) {
68 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1' :
''));
76if ($action ===
'updatecomment') {
77 if ($comment->fetch($idcomment) >= 0) {
78 $comment->description =
GETPOST(
'comment_description',
'restricthtml');
79 if ($comment->update($user) > 0) {
81 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1#comment' :
''));
89if ($action ==
'deletecomment') {
90 if ($comment->fetch($idcomment) >= 0) {
91 if ($comment->delete($user) > 0) {
93 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1' :
''));
$id
Support class for third parties, contacts, members, users or resources.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.