43@phan-var-force ?string $action
44@phan-var-force int $withproject
45@phan-var-force int $idcomment
46@phan-var-force int $id
49require_once DOL_DOCUMENT_ROOT.
'/core/class/comment.class.php';
51$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
58if ($action ==
'addcomment') {
59 $description =
GETPOST(
'comment_description',
'restricthtml');
60 if (!empty($description)) {
61 $comment->description = $description;
64 $comment->element_type =
GETPOST(
'comment_element_type',
'alpha');
65 $comment->fk_user_author = $user->id;
66 $comment->entity =
$conf->entity;
67 if ($comment->create($user) > 0) {
69 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1' :
''));
77if ($action ===
'updatecomment') {
78 if ($comment->fetch($idcomment) >= 0) {
80 if ($comment->fk_element !=
$id || $comment->element_type !=
$object->element) {
83 $comment->description =
GETPOST(
'comment_description',
'restricthtml');
84 if ($comment->update($user) > 0) {
86 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1#comment' :
''));
94if ($action ==
'deletecomment') {
95 if ($comment->fetch($idcomment) >= 0) {
97 if ($comment->fk_element !=
$id || $comment->element_type !=
$object->element) {
100 if ($comment->delete($user) > 0) {
102 header(
'Location: '.$varpage.
'?id='.
$id.($withproject ?
'&withproject=1' :
''));
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.