34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncommreminder.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/cactioncomm.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
53$langs->loadLangs(array(
"companies",
"other",
"commercial",
"bills",
"orders",
"agenda",
"mails"));
56$action =
GETPOST(
'action',
'aZ09');
57$cancel =
GETPOST(
'cancel',
'alpha');
58$backtopage =
GETPOST(
'backtopage',
'alpha');
59$socpeopleassigned =
GETPOST(
'socpeopleassigned',
'array');
60$origin =
GETPOST(
'origin',
'alpha');
61$originid =
GETPOST(
'originid',
'int');
62$confirm =
GETPOST(
'confirm',
'alpha');
64$fulldayevent =
GETPOST(
'fullday',
'alpha');
66$aphour =
GETPOST(
'aphour',
'int');
67$apmin =
GETPOST(
'apmin',
'int');
68$p2hour =
GETPOST(
'p2hour',
'int');
69$p2min =
GETPOST(
'p2min',
'int');
71$addreminder =
GETPOST(
'addreminder',
'alpha');
72$offsetvalue =
GETPOST(
'offsetvalue',
'int');
73$offsetunit =
GETPOST(
'offsetunittype_duration',
'aZ09');
74$remindertype =
GETPOST(
'selectremindertype',
'aZ09');
75$modelmail =
GETPOST(
'actioncommsendmodel_mail',
'int');
76$complete =
GETPOST(
'complete',
'alpha');
77$private =
GETPOST(
'private',
'alphanohtml');
78if ($complete ==
'na' || $complete == -2) {
85 $datep =
dol_mktime(
'00',
'00', 0,
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'), $tzforfullday ? $tzforfullday :
'tzuserrel');
86 $datef =
dol_mktime(
'23',
'59',
'59',
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'), $tzforfullday ? $tzforfullday :
'tzuserrel');
94 if (
GETPOST(
'datep') ==
'now') {
96 } elseif (preg_match(
'/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',
GETPOST(
"datep"), $reg)) {
97 $datep =
dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1],
'tzuser');
102$socid =
GETPOST(
'socid',
'int');
104if ($user->socid && ($socid != $user->socid)) {
109$donotclearsession =
GETPOST(
'donotclearsession') ?
GETPOST(
'donotclearsession') : 0;
118$form =
new Form($db);
123if ($id > 0 && $action !=
'add') {
124 $ret = $object->fetch($id);
126 $ret = $object->fetch_optionals();
127 $ret1 = $object->fetch_userassigned();
129 if ($ret < 0 || $ret1 < 0) {
135$extrafields->fetch_name_optionals_label($object->table_element);
138$hookmanager->initHooks(array(
'actioncard',
'globalcard'));
140$parameters = array(
'socid' => $socid);
141$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
146$TRemindTypes = array();
147if (!empty($conf->global->AGENDA_REMINDER_BROWSER)) {
148 $TRemindTypes[
'browser'] = array(
'label'=>$langs->trans(
'BrowserPush'),
'disabled'=>(empty($conf->global->AGENDA_REMINDER_BROWSER) ? 1 : 0));
150if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) {
151 $TRemindTypes[
'email'] = array(
'label'=>$langs->trans(
'EMail'),
'disabled'=>(empty($conf->global->AGENDA_REMINDER_EMAIL) ? 1 : 0));
154$TDurationTypes = array(
'y'=>$langs->trans(
'Years'),
'm'=>$langs->trans(
'Month'),
'w'=>$langs->trans(
'Weeks'),
'd'=>$langs->trans(
'Days'),
'h'=>$langs->trans(
'Hours'),
'i'=>$langs->trans(
'Minutes'));
156$result =
restrictedArea($user,
'agenda', $object,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
158$usercancreate = $user->hasRight(
'agenda',
'allactions',
'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'create'));
165$listUserAssignedUpdated =
false;
167if (empty($reshook) && (
GETPOST(
'removedassigned') ||
GETPOST(
'removedassigned') ==
'0')) {
168 $idtoremove =
GETPOST(
'removedassigned');
170 if (!empty($_SESSION[
'assignedtouser'])) {
171 $tmpassigneduserids = json_decode($_SESSION[
'assignedtouser'], 1);
173 $tmpassigneduserids = array();
176 foreach ($tmpassigneduserids as $key => $val) {
177 if ($val[
'id'] == $idtoremove || $val[
'id'] == -1) {
178 unset($tmpassigneduserids[$key]);
182 $_SESSION[
'assignedtouser'] = json_encode($tmpassigneduserids);
183 $donotclearsession = 1;
184 if ($action ==
'add') {
187 if ($action ==
'update') {
191 $listUserAssignedUpdated =
true;
195if (empty($reshook) && (
GETPOST(
'addassignedtouser') ||
GETPOST(
'updateassignedtouser'))) {
197 if (
GETPOST(
'assignedtouser') > 0) {
198 $assignedtouser = array();
199 if (!empty($_SESSION[
'assignedtouser'])) {
200 $assignedtouser = json_decode($_SESSION[
'assignedtouser'],
true);
202 $assignedtouser[
GETPOST(
'assignedtouser')] = array(
'id'=>
GETPOST(
'assignedtouser'),
'transparency'=>
GETPOST(
'transparency'),
'mandatory'=>1);
203 $_SESSION[
'assignedtouser'] = json_encode($assignedtouser);
205 $donotclearsession = 1;
206 if ($action ==
'add') {
209 if ($action ==
'update') {
213 $listUserAssignedUpdated =
true;
217if (empty($reshook) && $action ==
'classin' && ($user->hasRight(
'agenda',
'allactions',
'create') ||
218 (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'create')))) {
220 $object->setProject(
GETPOST(
'projectid',
'int'));
224if (empty($reshook) && $action ==
'confirm_clone' && $confirm ==
'yes') {
225 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
230 if (!empty($object->socpeopleassigned)) {
231 reset($object->socpeopleassigned);
232 $object->contact_id = key($object->socpeopleassigned);
234 $result = $object->createFromClone($user,
GETPOST(
'socid',
'int'));
236 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
247if (empty($reshook) && $action ==
'add') {
250 if (empty($backtopage)) {
252 $backtopage = DOL_URL_ROOT.
'/societe/agenda.php?socid='.$socid;
254 $backtopage = DOL_URL_ROOT.
'/comm/action/index.php';
258 if (!empty($socpeopleassigned[0])) {
259 $result = $contact->fetch($socpeopleassigned[0]);
263 header(
"Location: ".$backtopage);
267 $percentage = in_array(
GETPOST(
'status'), array(-1, 100)) ?
GETPOST(
'status') : (in_array($complete, array(-1, 100)) ? $complete :
GETPOST(
"percentage",
'int'));
273 $datep =
dol_mktime(
'00',
'00',
'00',
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'), $tzforfullday ? $tzforfullday :
'tzuserrel');
274 $datef =
dol_mktime(
'23',
'59',
'59',
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'), $tzforfullday ? $tzforfullday :
'tzuserrel');
276 $datep =
dol_mktime(
GETPOST(
"aphour",
'int'),
GETPOST(
"apmin",
'int'),
GETPOST(
"apsec",
'int'),
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'),
'tzuserrel');
277 $datef =
dol_mktime(
GETPOST(
"p2hour",
'int'),
GETPOST(
"p2min",
'int'),
GETPOST(
"apsec",
'int'),
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'),
'tzuserrel');
281 if (!$datef && $percentage == 100) {
282 $error++; $donotclearsession = 1;
284 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DateEnd")),
null,
'errors');
287 if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && !
GETPOST(
'label')) {
288 $error++; $donotclearsession = 1;
290 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Title")),
null,
'errors');
294 if (GETPOSTISSET(
'actioncode') && !
GETPOST(
'actioncode',
'aZ09')) {
295 $error++; $donotclearsession = 1;
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
299 $object->type_code =
GETPOST(
'actioncode',
'aZ09');
304 $object->priority = GETPOSTISSET(
"priority") ?
GETPOST(
"priority",
"int") : 0;
305 $object->fulldayevent = ($fulldayevent ? 1 : 0);
306 $object->location =
GETPOST(
"location",
'alphanohtml');
307 $object->label =
GETPOST(
'label',
'alphanohtml');
309 if (
GETPOST(
"elementtype",
'alpha')) {
310 $modulecodetouseforpermissioncheck =
GETPOST(
"elementtype",
'alpha');
312 $hasPermissionOnLinkedObject = 0;
313 if ($user->hasRight($modulecodetouseforpermissioncheck,
'read')) {
314 $hasPermissionOnLinkedObject = 1;
316 if ($hasPermissionOnLinkedObject) {
317 $object->fk_element =
GETPOST(
"fk_element",
'int');
318 $object->elementtype =
GETPOST(
"elementtype",
'alpha');
323 if (
GETPOST(
'actioncode',
'aZ09') ==
'AC_RDV' && $contact->getFullName($langs)) {
324 $object->label = $langs->transnoentitiesnoconv(
"TaskRDVWith", $contact->getFullName($langs));
326 if ($langs->trans(
"Action".$object->type_code) !=
"Action".$object->type_code) {
327 $object->label = $langs->transnoentitiesnoconv(
"Action".$object->type_code).
"\n";
329 $cactioncomm->fetch($object->type_code);
330 $object->label = $cactioncomm->label;
334 $object->fk_project = GETPOSTISSET(
"projectid") ?
GETPOST(
"projectid",
'int') : 0;
336 $taskid =
GETPOST(
'taskid',
'int');
337 if (!empty($taskid)) {
338 $taskProject =
new Task($db);
339 if ($taskProject->fetch($taskid) > 0) {
340 $object->fk_project = $taskProject->fk_project;
343 $object->fk_element = $taskid;
344 $object->elementtype =
'task';
347 $object->datep = $datep;
348 $object->datef = $datef;
349 $object->percentage = $percentage;
350 $object->duree = (((int)
GETPOST(
'dureehour') * 60) + (
int)
GETPOST(
'dureemin')) * 60;
352 $transparency = (
GETPOST(
"transparency") ==
'on' ? 1 : 0);
354 $listofuserid = array();
355 if (!empty($_SESSION[
'assignedtouser'])) {
356 $listofuserid = json_decode($_SESSION[
'assignedtouser'],
true);
359 foreach ($listofuserid as $key => $value) {
361 if ($value[
'id'] > 0) {
362 $object->userownerid = $value[
'id'];
364 $object->transparency = $transparency;
367 $object->userassigned[$value[
'id']] = array(
'id'=>$value[
'id'],
'transparency'=>$transparency);
373 if (!$error && !empty($conf->global->AGENDA_ENABLE_DONEBY)) {
375 $object->userdoneid =
GETPOST(
"doneby",
"int");
379 $object->note_private = trim(
GETPOST(
"note",
"restricthtml"));
381 if (GETPOSTISSET(
"contactid")) {
382 $object->contact = $contact;
385 if (
GETPOST(
'socid',
'int') > 0) {
386 $object->socid =
GETPOST(
'socid',
'int');
387 $object->fetch_thirdparty();
389 $object->societe = $object->thirdparty;
393 if (empty($object->userownerid) && empty($_SESSION[
'assignedtouser'])) {
394 $error++; $donotclearsession = 1;
396 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ActionsOwnedBy")),
null,
'errors');
398 if ($object->type_code ==
'AC_RDV' && ($datep ==
'' || ($datef ==
'' && empty($fulldayevent)))) {
399 $error++; $donotclearsession = 1;
401 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DateEnd")),
null,
'errors');
405 $error++; $donotclearsession = 1;
407 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
410 foreach ($socpeopleassigned as $cid) {
411 $object->socpeopleassigned[$cid] = array(
'id' => $cid);
413 if (!empty($object->socpeopleassigned)) {
414 reset($object->socpeopleassigned);
415 $object->contact_id = key($object->socpeopleassigned);
419 $ret = $extrafields->setOptionalsFromPost(
null, $object);
429 $selectedrecurrulefreq =
'no';
430 $selectedrecurrulebymonthday =
'';
431 $selectedrecurrulebyday =
'';
432 $object->recurrule = GETPOSTISSET(
'recurrulefreq') ?
"FREQ=".GETPOST(
'recurrulefreq',
'alpha') :
"";
433 $object->recurrule .= (
GETPOST(
'recurrulefreq',
'alpha') ==
'MONTHLY' && GETPOSTISSET(
'BYMONTHDAY')) ?
"_BYMONTHDAY".
GETPOST(
'BYMONTHDAY',
'alpha') :
"";
434 $object->recurrule .= (
GETPOST(
'recurrulefreq',
'alpha') ==
'WEEKLY' && GETPOSTISSET(
'BYDAY')) ?
"_BYDAY".
GETPOST(
'BYDAY',
'alpha') :
"";
436 $reg1 = array(); $reg2 = array(); $reg3 = array();
437 if ($object->recurrule && preg_match(
'/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
438 $selectedrecurrulefreq = $reg1[1];
440 if ($object->recurrule && preg_match(
'/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) {
441 $selectedrecurrulebymonthday = $reg2[1];
443 if ($object->recurrule && preg_match(
'/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) {
444 $selectedrecurrulebyday = $reg3[1];
448 $eventisrecurring = 0;
449 $userepeatevent = (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') == 2 ? 1 : 0);
450 if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq !=
'no') {
451 $eventisrecurring = 1;
455 unset($object->recurid);
456 unset($object->recurrule);
457 unset($object->recurdateend);
461 $idaction = $object->create($user);
464 if (!$object->error) {
466 $categories =
GETPOST(
'categories',
'array');
467 $object->setCategories($categories);
469 unset($_SESSION[
'assignedtouser']);
472 if ($user->id != $object->userownerid) {
473 $moreparam =
"filtert=-1";
477 if ($addreminder ==
'on') {
482 $actionCommReminder->dateremind = $dateremind;
483 $actionCommReminder->typeremind = $remindertype;
484 $actionCommReminder->offsetunit = $offsetunit;
485 $actionCommReminder->offsetvalue = $offsetvalue;
486 $actionCommReminder->status = $actionCommReminder::STATUS_TODO;
487 $actionCommReminder->fk_actioncomm = $object->id;
488 if ($remindertype ==
'email') {
489 $actionCommReminder->fk_email_template = $modelmail;
493 foreach ($object->userassigned as $userassigned) {
494 $actionCommReminder->fk_user = $userassigned[
'id'];
495 $res = $actionCommReminder->create($user);
500 $langs->load(
"errors");
501 $error = $langs->trans(
'ErrorReminderActionCommCreation');
503 $action =
'create'; $donotclearsession = 1;
514 $moreparam .= ($moreparam ?
'&' :
'').
'disabledefaultvalues=1';
534 $langs->load(
"errors");
535 $error = $langs->trans($object->error);
537 $action =
'create'; $donotclearsession = 1;
542 $action =
'create'; $donotclearsession = 1;
545 if ($eventisrecurring) {
547 if ($selectedrecurrulefreq ==
'WEEKLY' && !empty($selectedrecurrulebyday)) {
549 $datep =
dol_mktime($fulldayevent ?
'00' :
GETPOST(
"aphour",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apmin",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apsec",
'int'), $firstdatearray[
'month'], $firstdatearray[
'first_day'], $firstdatearray[
'year'], $tzforfullday ? $tzforfullday :
'tzuser');
553 } elseif ($selectedrecurrulefreq ==
'MONTHLY' && !empty($selectedrecurrulebymonthday)) {
554 $firstday = $selectedrecurrulebymonthday;
555 $firstmonth =
GETPOST(
"apday") > $selectedrecurrulebymonthday ?
GETPOST(
"apmonth",
'int') + 1 :
GETPOST(
"apmonth",
'int');
556 $datep =
dol_mktime($fulldayevent ?
'00' :
GETPOST(
"aphour",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apmin",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apsec",
'int'), $firstmonth, $firstday,
GETPOST(
"apyear",
'int'), $tzforfullday ? $tzforfullday :
'tzuser');
563 $repeateventlimitdate =
dol_mktime(23, 59, 59, GETPOSTISSET(
"limitmonth") ?
GETPOST(
"limitmonth",
'int') : 1, GETPOSTISSET(
"limitday") ?
GETPOST(
"limitday",
'int') : 1, GETPOSTISSET(
"limityear") &&
GETPOST(
"limityear",
'int') < 2100 ?
GETPOST(
"limityear",
'int') : 2100, $tzforfullday ? $tzforfullday :
'tzuser');
568 while ($datep <= $repeateventlimitdate && !$error) {
569 $finalobject = clone $object;
572 $finalobject->datep = $datep;
573 $finalobject->datef = $datef;
575 $idaction = $finalobject->create($user);
578 if (!$finalobject->error) {
580 $categories =
GETPOST(
'categories',
'array');
581 $finalobject->setCategories($categories);
583 unset($_SESSION[
'assignedtouser']);
586 if ($user->id != $finalobject->userownerid) {
587 $moreparam =
"filtert=-1";
591 if ($addreminder ==
'on') {
596 $actionCommReminder->dateremind = $dateremind;
597 $actionCommReminder->typeremind = $remindertype;
598 $actionCommReminder->offsetunit = $offsetunit;
599 $actionCommReminder->offsetvalue = $offsetvalue;
600 $actionCommReminder->status = $actionCommReminder::STATUS_TODO;
601 $actionCommReminder->fk_actioncomm = $finalobject->id;
602 if ($remindertype ==
'email') {
603 $actionCommReminder->fk_email_template = $modelmail;
607 foreach ($finalobject->userassigned as $userassigned) {
608 $actionCommReminder->fk_user = $userassigned[
'id'];
609 $res = $actionCommReminder->create($user);
614 $langs->load(
"errors");
615 $error = $langs->trans(
'ErrorReminderActionCommCreation');
617 $action =
'create'; $donotclearsession = 1;
628 $moreparam .= ($moreparam ?
'&' :
'').
'disabledefaultvalues=1';
638 $langs->load(
"errors");
639 $error = $langs->trans($finalobject->error);
641 $action =
'create'; $donotclearsession = 1;
646 $action =
'create'; $donotclearsession = 1;
650 if (!($userepeatevent && GETPOSTISSET(
'recurrulefreq') &&
GETPOST(
'recurrulefreq') !=
'no' && GETPOSTISSET(
"limityear") && GETPOSTISSET(
"limitmonth") && GETPOSTISSET(
"limitday"))) {
661 if (!empty($backtopage) && !$error) {
662 dol_syslog(
"Back to ".$backtopage.($moreparam ? (preg_match(
'/\?/', $backtopage) ?
'&'.$moreparam :
'?'.$moreparam) :
''));
663 header(
"Location: ".$backtopage.($moreparam ? (preg_match(
'/\?/', $backtopage) ?
'&'.$moreparam :
'?'.$moreparam) :
''));
664 } elseif ($idaction) {
665 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/card.php?id='.$idaction.($moreparam ?
'&'.$moreparam :
''));
667 header(
"Location: ".DOL_URL_ROOT.
'/comm/action/index.php'.($moreparam ?
'?'.$moreparam :
''));
676if (empty($reshook) && $action ==
'update') {
677 if (empty($cancel)) {
678 $fulldayevent =
GETPOST(
'fullday');
679 $aphour =
GETPOST(
'aphour',
'int');
680 $apmin =
GETPOST(
'apmin',
'int');
681 $p2hour =
GETPOST(
'p2hour',
'int');
682 $p2min =
GETPOST(
'p2min',
'int');
683 $percentage = in_array(
GETPOST(
'status'), array(-1, 100)) ?
GETPOST(
'status') : (in_array($complete, array(-1, 100)) ? $complete :
GETPOST(
"percentage",
'int'));
700 $object->fetch_optionals();
701 $object->fetch_userassigned();
708 $datep =
dol_mktime($fulldayevent ?
'00' :
GETPOST(
"aphour",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apmin",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apsec",
'int'),
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'), $tzforfullday ? $tzforfullday :
'tzuser');
709 $datef =
dol_mktime($fulldayevent ?
'23' :
GETPOST(
"p2hour",
'int'), $fulldayevent ?
'59' :
GETPOST(
"p2min",
'int'), $fulldayevent ?
'59' :
GETPOST(
"apsec",
'int'),
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'), $tzforfullday ? $tzforfullday :
'tzuser');
711 $datep =
dol_mktime($fulldayevent ?
'00' :
GETPOST(
"aphour",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apmin",
'int'), $fulldayevent ?
'00' :
GETPOST(
"apsec",
'int'),
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'),
'tzuser');
712 $datef =
dol_mktime($fulldayevent ?
'23' :
GETPOST(
"p2hour",
'int'), $fulldayevent ?
'59' :
GETPOST(
"p2min",
'int'), $fulldayevent ?
'59' :
GETPOST(
"apsec",
'int'),
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'),
'tzuser');
715 if ($object->elementtype ==
'ticket') {
717 if ($object->code ==
'TICKET_MSG') {
718 $object->code =
'TICKET_MSG_PRIVATE';
720 if ($object->code ==
'TICKET_MSG_SENTBYMAIL') {
721 $object->code =
'TICKET_MSG_PRIVATE_SENTBYMAIL';
724 if ($object->code ==
'TICKET_MSG_PRIVATE') {
725 $object->code =
'TICKET_MSG';
727 if ($object->code ==
'TICKET_MSG_PRIVATE_SENTBYMAIL') {
728 $object->code =
'TICKET_MSG_SENTBYMAIL';
734 $object->type_code =
GETPOST(
"actioncode",
'aZ09');
737 $object->label =
GETPOST(
"label",
"alphanohtml");
738 $object->datep = $datep;
739 $object->datef = $datef;
740 $object->percentage = $percentage;
741 $object->priority =
GETPOST(
"priority",
"int");
742 $object->fulldayevent =
GETPOST(
"fullday") ? 1 : 0;
743 $object->location =
GETPOST(
'location',
"alphanohtml");
744 $object->socid =
GETPOST(
"socid",
"int");
745 $socpeopleassigned =
GETPOST(
"socpeopleassigned",
'array');
746 $object->socpeopleassigned = array();
747 foreach ($socpeopleassigned as $cid) {
748 $object->socpeopleassigned[$cid] = array(
'id' => $cid);
750 $object->contact_id =
GETPOST(
"contactid",
'int');
751 if (empty($object->contact_id) && !empty($object->socpeopleassigned)) {
752 reset($object->socpeopleassigned);
753 $object->contact_id = key($object->socpeopleassigned);
755 $object->fk_project =
GETPOST(
"projectid",
'int');
756 $object->note_private = trim(
GETPOST(
"note",
"restricthtml"));
758 if (
GETPOST(
"elementtype",
'alpha')) {
759 $modulecodetouseforpermissioncheck =
GETPOST(
"elementtype",
'alpha');
761 $hasPermissionOnLinkedObject = 0;
762 if ($user->hasRight($modulecodetouseforpermissioncheck,
'read')) {
763 $hasPermissionOnLinkedObject = 1;
765 if ($hasPermissionOnLinkedObject) {
766 $object->fk_element =
GETPOST(
"fk_element",
'int');
767 $object->elementtype =
GETPOST(
"elementtype",
'alpha');
771 if (!$datef && $percentage == 100) {
773 $donotclearsession = 1;
774 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DateEnd")), $object->errors,
'errors');
778 $transparency = (
GETPOST(
"transparency") ==
'on' ? 1 : 0);
781 $listofuserid = array();
782 if (!empty($_SESSION[
'assignedtouser'])) {
784 $tmplist1 = json_decode($_SESSION[
'assignedtouser'],
true);
785 foreach ($tmplist1 as $key => $val) {
786 if ($val[
'id'] > 0 && $val[
'id'] != $assignedtouser) {
787 $listofuserid[$val[
'id']] = $val;
791 $assignedtouser = (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
792 if ($assignedtouser) {
793 $listofuserid[$assignedtouser] = array(
'id'=>$assignedtouser,
'mandatory'=>0,
'transparency'=>($user->id == $assignedtouser ? $transparency :
''));
796 $object->userassigned = array(); $object->userownerid = 0;
798 foreach ($listofuserid as $key => $val) {
800 $object->userownerid = $val[
'id'];
802 $object->userassigned[$val[
'id']] = array(
'id'=>$val[
'id'],
'mandatory'=>0,
'transparency'=>($user->id == $val[
'id'] ? $transparency :
''));
806 $object->transparency = $transparency;
809 if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) {
811 $object->userdoneid =
GETPOST(
"doneby",
"int");
816 if (GETPOSTISSET(
'actioncode') && !
GETPOST(
'actioncode',
'aZ09')) {
817 $error++; $donotclearsession = 1;
819 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
821 $result = $cactioncomm->fetch(
GETPOST(
'actioncode',
'aZ09'));
823 if (empty($object->userownerid)) {
824 $error++; $donotclearsession = 1;
826 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ActionsOwnedBy")),
null,
'errors');
830 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
837 if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element ==
'action') {
838 $eventDateStart = $object->datep;
839 $eventDateEnd = $object->datef;
841 $sql =
"SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label";
842 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_resources as er";
843 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'";
844 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element).
"'";
845 $sql .=
" WHERE ac.id <> ".((int) $object->id);
846 $sql .=
" AND er.resource_id IN (";
847 $sql .=
" SELECT resource_id FROM ".MAIN_DB_PREFIX.
"element_resources";
848 $sql .=
" WHERE element_id = ".((int) $object->id);
849 $sql .=
" AND element_type = '".$db->escape($object->element).
"'";
850 $sql .=
" AND busy = 1";
852 $sql .=
" AND er.busy = 1";
856 $sql .=
" (ac.datep <= '".$db->idate($eventDateStart).
"' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart).
"'))";
858 if (!empty($eventDateEnd)) {
859 $sql .=
" OR (ac.datep <= '".$db->idate($eventDateEnd).
"' AND (ac.datep2 >= '".$db->idate($eventDateEnd).
"'))";
863 $sql .=
"ac.datep >= '".$db->idate($eventDateStart).
"'";
864 if (!empty($eventDateEnd)) {
865 $sql .=
" AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd).
"')";
870 $resql = $db->query($sql);
873 $object->error = $db->lasterror();
874 $object->errors[] = $object->error;
876 if ($db->num_rows($resql) > 0) {
879 $object->error = $langs->trans(
'ErrorResourcesAlreadyInUse').
' : ';
880 while ($obj = $db->fetch_object($resql)) {
881 $object->error .=
'<br> - '.$langs->trans(
'ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.
' ['.$obj->ac_id.
']');
883 $object->errors[] = $object->error;
897 $result = $object->update($user);
901 $categories =
GETPOST(
'categories',
'array');
902 $object->setCategories($categories);
904 $object->loadReminders($remindertype, 0,
false);
907 if (!empty($object->reminders)) {
908 foreach ($object->reminders as $reminder) {
909 if ($reminder->status < 1) {
910 $reminder->delete($user);
913 $object->reminders = array();
917 if ($addreminder ==
'on') {
922 $actionCommReminder->dateremind = $dateremind;
923 $actionCommReminder->typeremind = $remindertype;
924 $actionCommReminder->offsetunit = $offsetunit;
925 $actionCommReminder->offsetvalue = $offsetvalue;
926 $actionCommReminder->status = $actionCommReminder::STATUS_TODO;
927 $actionCommReminder->fk_actioncomm = $object->id;
928 if ($remindertype ==
'email') {
929 $actionCommReminder->fk_email_template = $modelmail;
933 foreach ($object->userassigned as $userassigned) {
934 $actionCommReminder->fk_user = $userassigned[
'id'];
935 $res = $actionCommReminder->create($user);
939 $langs->load(
"errors");
940 $error = $langs->trans(
'ErrorReminderActionCommCreation');
942 $action =
'create'; $donotclearsession = 1;
948 unset($_SESSION[
'assignedtouser']);
963 if (!empty($backtopage)) {
964 unset($_SESSION[
'assignedtouser']);
965 header(
"Location: ".$backtopage);
972if (empty($reshook) && $action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
'yes') {
974 $object->fetch_optionals();
975 $object->fetch_userassigned();
978 if ($user->hasRight(
'agenda',
'myactions',
'delete')
979 || $user->rights->agenda->allactions->delete) {
980 $result = $object->delete();
983 header(
"Location: index.php");
995if (empty($reshook) &&
GETPOST(
'actionmove',
'alpha') ==
'mupdate') {
1001 $newdate =
GETPOST(
'newdate',
'alpha');
1002 if (empty($newdate) || strpos($newdate,
'dayevent_') != 0) {
1003 header(
"Location: ".$backtopage,
true, 307);
1007 $datep =
dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4),
'tzuserrel');
1010 if ($datep != $object->datep) {
1011 if (!empty($object->datef)) {
1012 $object->datef += $datep - $object->datep;
1014 $object->datep = $datep;
1018 if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element ==
'action') {
1019 $eventDateStart = $object->datep;
1020 $eventDateEnd = $object->datef;
1022 $sql =
"SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label";
1023 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_resources as er";
1024 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'";
1025 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element).
"'";
1026 $sql .=
" WHERE ac.id <> ".((int) $object->id);
1027 $sql .=
" AND er.resource_id IN (";
1028 $sql .=
" SELECT resource_id FROM ".MAIN_DB_PREFIX.
"element_resources";
1029 $sql .=
" WHERE element_id = ".((int) $object->id);
1030 $sql .=
" AND element_type = '".$db->escape($object->element).
"'";
1031 $sql .=
" AND busy = 1";
1033 $sql .=
" AND er.busy = 1";
1037 $sql .=
" (ac.datep <= '".$db->idate($eventDateStart).
"' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart).
"'))";
1039 if (!empty($eventDateEnd)) {
1040 $sql .=
" OR (ac.datep <= '".$db->idate($eventDateEnd).
"' AND (ac.datep2 >= '".$db->idate($eventDateEnd).
"'))";
1044 $sql .=
"ac.datep >= '".$db->idate($eventDateStart).
"'";
1045 if (!empty($eventDateEnd)) {
1046 $sql .=
" AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd).
"')";
1051 $resql = $db->query($sql);
1054 $object->error = $db->lasterror();
1055 $object->errors[] = $object->error;
1057 if ($db->num_rows($resql) > 0) {
1060 $object->error = $langs->trans(
'ErrorResourcesAlreadyInUse').
' : ';
1061 while ($obj = $db->fetch_object($resql)) {
1062 $object->error .=
'<br> - '.$langs->trans(
'ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.
' ['.$obj->ac_id.
']');
1064 $object->errors[] = $object->error;
1077 $result = $object->update($user);
1087 if (!empty($backtopage)) {
1088 header(
"Location: ".$backtopage,
true, 307);
1097$permissiontoadd = ($user->hasRight(
'agenda',
'allactions',
'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'read')));
1098if (empty($reshook)) {
1099 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
1107$form =
new Form($db);
1110$arrayrecurrulefreq = array(
1111 'no'=>$langs->trans(
"OnceOnly"),
1112 'MONTHLY'=>$langs->trans(
"EveryMonth"),
1113 'WEEKLY'=>$langs->trans(
"EveryWeek")
1118$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
1119llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
1121if ($action ==
'create') {
1124 $socpeopleassigned =
GETPOST(
"socpeopleassigned",
'array');
1125 if (!empty($socpeopleassigned[0])) {
1126 $result = $contact->fetch($socpeopleassigned[0]);
1134 if (!empty($conf->use_javascript_ajax)) {
1135 print
"\n".
'<script type="text/javascript">';
1136 print
'$(document).ready(function () {
1137 function setdatefields()
1139 if ($("#fullday:checked").val() == null) {
1140 $(".fulldaystarthour").removeAttr("disabled");
1141 $(".fulldaystartmin").removeAttr("disabled");
1142 $(".fulldayendhour").removeAttr("disabled");
1143 $(".fulldayendmin").removeAttr("disabled");
1144 $("#p2").removeAttr("disabled");
1146 $(".fulldaystarthour").prop("disabled", true).val("00");
1147 $(".fulldaystartmin").prop("disabled", true).val("00");
1148 $(".fulldayendhour").prop("disabled", true).val("23");
1149 $(".fulldayendmin").prop("disabled", true).val("59");
1150 $("#p2").removeAttr("disabled");
1153 $("#fullday").change(function() {
1154 console.log("setdatefields");
1158 $("#selectcomplete").change(function() {
1159 console.log("we change the complete status - set the doneby");
1160 if ($("#selectcomplete").val() == 100) {
1161 if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).
'\');
1163 if ($(
"#selectcomplete").val() == 0) {
1164 $(
"#doneby").val(-1);
1168 $(
"#actioncode").change(
function() {
1169 if ($(
"#actioncode").val() == \
'AC_RDV\') $("#dateend").addClass("fieldrequired");
1170 else $("#dateend").removeClass("fieldrequired");
1172 $("#aphour,#apmin").change(function() {
1173 if ($("#actioncode").val() == \'AC_RDV\') {
1174 console.log("Start date was changed, we modify end date "+(parseInt($("#aphour").val()))+" "+$("#apmin").val()+" -> "+("00" + (parseInt($("#aphour").val()) + 1)).substr(-2,2));
1175 $("#p2hour").val(("00" + (parseInt($("#aphour").val()) + 1)).substr(-2,2));
1176 $("#p2min").val($("#apmin").val());
1177 $("#p2day").val($("#apday").val());
1178 $("#p2month").val($("#apmonth").val());
1179 $("#p2year").val($("#apyear").val());
1180 $("#p2").val($("#ap").val());
1183 if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
1184 else $("#dateend").removeClass("fieldrequired");
1187 print
'</script>'.
"\n";
1190 print
'<form name="formaction" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1191 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1192 print
'<input type="hidden" name="action" value="add">';
1193 print
'<input type="hidden" name="donotclearsession" value="1">';
1194 print
'<input type="hidden" name="page_y" value="">';
1196 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage :
'').
'">';
1198 if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
1199 print
'<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db,
'AC_OTH',
'c_actioncomm').
'">';
1202 if (
GETPOST(
"actioncode",
'aZ09') ==
'AC_RDV') {
1203 print
load_fiche_titre($langs->trans(
"AddActionRendezVous"),
'',
'title_agenda');
1210 print
'<table class="border centpercent">';
1213 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
1214 print
'<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Type").
'</span></b></td><td>';
1216 print
img_picto($langs->trans(
"ActionType"),
'square',
'class="fawidth30 inline-block" style="color: #ddd;"');
1217 $selectedvalue = GETPOSTISSET(
"actioncode") ?
GETPOST(
"actioncode",
'aZ09') : ($object->type_code ? $object->type_code : $default);
1218 print
$formactions->select_type_actions($selectedvalue,
"actioncode",
"systemauto", 0, -1, 0, 1);
1223 print
'<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ?
' class="fieldrequired titlefieldcreate"' :
'').
'>'.$langs->trans(
"Label").
'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.
GETPOST(
'label').
'"></td></tr>';
1226 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Date").
'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(
GETPOST(
'fullday') ?
' checked' :
'').
'><label for="fullday">'.$langs->trans(
"EventOnFullDay").
'</label>';
1229 $userepeatevent = (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') >= 1 ? 1 : 0);
1230 if ($userepeatevent) {
1233 print
' <div class="opacitymedium inline-block">';
1234 print
img_picto($langs->trans(
"Recurrence"),
'recurring',
'class="paddingright2"');
1235 print
'<input type="hidden" name="recurid" value="'.(empty($object->recurid) ?
'' : $object->recurid).
'">';
1237 $selectedrecurrulefreq =
'no';
1238 $selectedrecurrulebymonthday =
'';
1239 $selectedrecurrulebyday =
'';
1240 $object->recurrule = GETPOSTISSET(
'recurrulefreq') ?
"FREQ=".GETPOST(
'recurrulefreq',
'alpha') :
"";
1241 $object->recurrule .= GETPOSTISSET(
'BYMONTHDAY') ?
"_BYMONTHDAY".GETPOST(
'BYMONTHDAY',
'alpha') :
"";
1242 $object->recurrule .= GETPOSTISSET(
'BYDAY') ?
"_BYDAY".GETPOST(
'BYDAY',
'alpha') :
"";
1246 if ($object->recurrule && preg_match(
'/FREQ=([A-Z]+)/i', $object->recurrule, $reg)) {
1247 $selectedrecurrulefreq = $reg[1];
1249 if ($object->recurrule && preg_match(
'/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg)) {
1250 $selectedrecurrulebymonthday = $reg[1];
1252 if ($object->recurrule && preg_match(
'/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg)) {
1253 $selectedrecurrulebyday = $reg[1];
1256 print $form->selectarray(
'recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq, 0, 0, 0,
'', 0, 0, 0,
'',
'marginrightonly');
1262 print
'<div class="hidden marginrightonly inline-block repeateventBYMONTHDAY">';
1263 print $langs->trans(
"DayOfMonth").
': <input type="input" size="2" name="BYMONTHDAY" value="'.$selectedrecurrulebymonthday.
'">';
1266 print
'<div class="hidden marginrightonly inline-block repeateventBYDAY">';
1267 print $langs->trans(
"DayOfWeek").
': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.
'">';
1270 $repeateventlimitdate = !empty($repeateventlimitdate) ? $repeateventlimitdate :
'';
1271 print
'<div class="hidden marginrightonly inline-block repeateventlimitdate">';
1272 print $langs->trans(
"Until").
" ";
1273 print $form->selectDate($repeateventlimitdate,
'limit', 0, 0, 0,
"action", 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzuserrel');
1276 print
'<script type="text/javascript">
1277 jQuery(document).ready(function() {
1278 function init_repeat()
1280 console.log("recurrule: " + "'.$object->recurrule.
'");
1281 console.log("reg1: " + "'.$selectedrecurrulefreq.
'");
1282 console.log("reg2: " + "'.$selectedrecurrulebymonthday.
'");
1283 console.log("reg3: " + "'.$selectedrecurrulebyday.
'");
1284 console.log("selectedrulefreq: " + "'.$selectedrecurrulefreq.
'");
1285 if (jQuery("#recurrulefreq").val() == \'MONTHLY\')
1287 jQuery(".repeateventBYMONTHDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
1288 jQuery(".repeateventlimitdate").css("display", "inline-block");
1289 jQuery(".repeateventBYDAY").hide();
1291 else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
1293 jQuery(".repeateventBYMONTHDAY").hide();
1294 jQuery(".repeateventBYDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
1295 jQuery(".repeateventlimitdate").css("display", "inline-block");
1299 jQuery(".repeateventBYMONTHDAY").hide();
1300 jQuery(".repeateventBYDAY").hide();
1301 jQuery(".repeateventlimitdate").hide();
1305 jQuery("#recurrulefreq").change(function() {
1316 $datep = ($datep ? $datep : (is_null($object->datep) ?
'' : $object->datep));
1317 if (
GETPOST(
'datep',
'int', 1)) {
1320 $datef = ($datef ? $datef : $object->datef);
1321 if (
GETPOST(
'datef',
'int', 1)) {
1324 if (empty($datef) && !empty($datep)) {
1325 if (
GETPOST(
"actioncode",
'aZ09') ==
'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
1326 $datef =
dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS),
'h');
1331 print
'<tr><td class="nowrap">';
1334 print $form->selectDate($datep,
'ap', 1, 1, 0,
"action", 1, 2, 0,
'fulldaystart',
'',
'',
'', 1,
'',
'',
'tzuserrel');
1336 print $form->selectDate($datep,
'ap', 1, 1, 1,
"action", 1, 2, 0,
'fulldaystart',
'',
'',
'', 1,
'',
'',
'tzuserrel');
1338 print
' <span class="hideonsmartphone"> - </span> ';
1340 print $form->selectDate($datef,
'p2', 1, 1, 1,
"action", 1, 0, 0,
'fulldayend',
'',
'',
'', 1,
'',
'',
'tzuserrel');
1342 print $form->selectDate($datef,
'p2', 1, 1, 1,
"action", 1, 0, 0,
'fulldayend',
'',
'',
'', 1,
'',
'',
'tzuserrel');
1346 print
'<tr><td class=""> </td><td></td></tr>';
1349 print
'<tr><td class="tdtop nowrap"><span class="fieldrequired">'.$langs->trans(
"ActionAffectedTo").
'</span></td><td>';
1350 $listofuserid = array();
1351 $listofcontactid = array();
1352 $listofotherid = array();
1354 if (empty($donotclearsession)) {
1355 $assignedtouser =
GETPOST(
"assignedtouser") ?
GETPOST(
"assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
1356 if ($assignedtouser) {
1357 $listofuserid[$assignedtouser] = array(
'id'=>$assignedtouser,
'mandatory'=>0);
1360 $listofuserid[$assignedtouser][
'transparency'] = (GETPOSTISSET(
'transparency') ?
GETPOST(
'transparency',
'alpha') : 1);
1361 $_SESSION[
'assignedtouser'] = json_encode($listofuserid);
1363 if (!empty($_SESSION[
'assignedtouser'])) {
1364 $listofuserid = json_decode($_SESSION[
'assignedtouser'],
true);
1366 $firstelem = reset($listofuserid);
1367 if (isset($listofuserid[$firstelem[
'id']])) {
1368 $listofuserid[$firstelem[
'id']][
'transparency'] = (GETPOSTISSET(
'transparency') ?
GETPOST(
'transparency',
'alpha') : 0);
1371 print
'<div class="assignedtouser">';
1372 print $form->select_dolusers_forevent(($action ==
'create' ?
'add' :
'update'),
'assignedtouser', 1,
'', 0,
'',
'', 0, 0, 0,
'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
1377 if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) {
1378 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionDoneBy").
'</td><td>';
1379 print $form->select_dolusers(GETPOSTISSET(
"doneby") ?
GETPOST(
"doneby",
'int') : (!empty($object->userdoneid) && $percent == 100 ? $object->userdoneid : 0),
'doneby', 1);
1384 if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
1385 print
'<tr><td>'.$langs->trans(
"Location").
'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(
GETPOST(
'location') ?
GETPOST(
'location') : $object->location).
'"></td></tr>';
1389 print
'<tr><td>'.$langs->trans(
"Status").
' / '.$langs->trans(
"Percentage").
'</td>';
1391 $percent = $complete !==
'' ? $complete : -1;
1392 if (GETPOSTISSET(
'status')) {
1394 } elseif (GETPOSTISSET(
'percentage')) {
1395 $percent =
GETPOST(
'percentage',
'int');
1397 if ($complete ==
'0' ||
GETPOST(
"afaire") == 1) {
1399 } elseif ($complete == 100 ||
GETPOST(
"afaire") == 2) {
1403 $formactions->form_select_status_action(
'formaction', $percent, 1,
'complete', 0, 0,
'maxwidth200');
1406 if (isModEnabled(
'categorie')) {
1408 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1409 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM,
'',
'parent', 64, 0, 1);
1410 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo,
GETPOST(
'categories',
'array'),
'', 0,
'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0);
1417 print
'<br><hr><br>';
1420 print
'<table class="border centpercent">';
1422 if (isModEnabled(
"societe")) {
1424 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"ActionOnCompany").
'</td><td>';
1425 if (
GETPOST(
'socid',
'int') > 0) {
1427 $societe->fetch(
GETPOST(
'socid',
'int'));
1428 print $societe->getNomUrl(1);
1429 print
'<input type="hidden" id="socid" name="socid" value="'.GETPOST(
'socid',
'int').
'">';
1432 $events[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1', 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
1434 if (!empty($user->socid)) {
1435 print
img_picto(
'',
'company',
'class="paddingrightonly"').$form->select_company($user->socid,
'socid',
'', 1, 1, 0, $events, 0,
'minwidth300');
1437 print
img_picto(
'',
'company',
'class="paddingrightonly"').$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, $events, 0,
'minwidth300');
1443 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionOnContact").
'</td><td>';
1444 $preselectedids =
GETPOST(
'socpeopleassigned',
'array');
1445 if (
GETPOST(
'contactid',
'int')) {
1446 $preselectedids[
GETPOST(
'contactid',
'int')] =
GETPOST(
'contactid',
'int');
1448 if ($origin==
'contact') $preselectedids[
GETPOST(
'originid',
'int')] =
GETPOST(
'originid',
'int');
1451 $select_contact_default = 0;
1453 $select_contact_default = -1;
1455 print
img_picto(
'',
'contact',
'class="paddingrightonly"');
1456 print $form->selectcontacts(GETPOSTISSET(
'socid') ?
GETPOSTINT(
'socid') : $select_contact_default, $preselectedids,
'socpeopleassigned[]', 1,
'',
'', 0,
'minwidth300 quatrevingtpercent', false, 0, array(), false,
'multiple',
'contactid');
1461 if (isModEnabled(
'project')) {
1462 $langs->load(
"projects");
1464 $projectid =
GETPOST(
'projectid',
'int');
1466 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Project").
'</td><td id="project-input-container">';
1467 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1468 print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500 widthcentpercentminusxx');
1470 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.(empty($societe->id) ?
'' : $societe->id).
'&action=create&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create').
'">';
1471 print
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProject").
'"></span></a>';
1472 $urloption =
'?action=create&donotclearsession=1';
1476 print
"\n".
'<script type="text/javascript">';
1477 print
'$(document).ready(function () {
1478 $("#projectid").change(function () {
1479 var url = "'.DOL_URL_ROOT.
'/projet/ajax/projects.php?mode=gettasks&socid="+$("#search_socid").val()+"&projectid="+$("#projectid").val();
1480 console.log("Call url to get new list of tasks: "+url);
1481 $.get(url, function(data) {
1483 if (data) $("#taskid").html(data).select2();
1487 print
'</script>'.
"\n";
1492 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Task").
'</td><td id="project-task-input-container" >';
1493 print
img_picto(
'',
'projecttask',
'class="paddingrightonly"');
1494 $projectsListId =
false;
1495 if (!empty($projectid)) {
1496 $projectsListId = $projectid;
1499 $tid = GETPOSTISSET(
"projecttaskid") ?
GETPOST(
"projecttaskid",
'int') : (GETPOSTISSET(
"taskid") ?
GETPOST(
"taskid",
'int') :
'');
1501 $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid,
'taskid', 24, 0,
'1', 1, 0, 0,
'maxwidth500 widthcentpercentminusxx', $projectsListId);
1506 if (!empty($origin) && !empty($originid)) {
1507 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1509 $hasPermissionOnLinkedObject = 0;
1510 if ($user->hasRight($origin,
'read')) {
1511 $hasPermissionOnLinkedObject = 1;
1515 if (! in_array($origin, array(
'societe',
'project',
'task',
'user'))) {
1517 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"LinkedObject").
'</td>';
1518 print
'<td colspan="3">';
1519 if ($hasPermissionOnLinkedObject) {
1521 print
'<input type="hidden" name="fk_element" value="'.$originid.
'">';
1522 print
'<input type="hidden" name="elementtype" value="'.$origin.
'">';
1523 print
'<input type="hidden" name="originid" value="'.$originid.
'">';
1524 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
1526 print
'<!-- no permission on object to link '.$origin.
' id '.$originid.
' -->';
1533 if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) {
1534 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"Priority").
'</td><td colspan="3">';
1535 print
'<input type="text" name="priority" value="'.(GETPOSTISSET(
'priority') ?
GETPOST(
'priority',
'int') : ($object->priority ? $object->priority :
'')).
'" size="5">';
1540 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
1541 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1542 $doleditor =
new DolEditor(
'note', (GETPOSTISSET(
'note') ?
GETPOST(
'note',
'restricthtml') : $object->note_private),
'', 120,
'dolibarr_notes',
'In', true, true, isModEnabled(
'fckeditor'), ROWS_4,
'90%');
1543 $doleditor->Create();
1547 $parameters = array();
1548 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1549 print $hookmanager->resPrint;
1550 if (empty($reshook)) {
1551 print $object->showOptionals($extrafields,
'create', $parameters);
1561 print
'<label for="addreminder">'.img_picto(
'',
'bell',
'class="pictofixedwidth"').$langs->trans(
"AddReminder").
'</label> <input type="checkbox" id="addreminder" name="addreminder"><br><br>';
1563 print
'<div class="reminderparameters" style="display: none;">';
1565 print
'<table class="border centpercent">';
1568 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"ReminderTime").
'</td><td colspan="3">';
1569 print
'<input class="width50" type="number" name="offsetvalue" value="'.(GETPOSTISSET(
'offsetvalue') ?
GETPOST(
'offsetvalue',
'int') :
getDolGlobalInt(
'AGENDA_REMINDER_DEFAULT_OFFSET', 30)).
'"> ';
1570 print $form->selectTypeDuration(
'offsetunit',
'i', array(
'y',
'm'));
1574 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"ReminderType").
'</td><td colspan="3">';
1575 print $form->selectarray(
'selectremindertype', $TRemindTypes,
'', 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200 maxwidth500', 1);
1580 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"EMailTemplates").
'</td><td colspan="3">';
1581 print $form->selectModelMail(
'actioncommsend',
'actioncomm_send', 1, 1);
1588 print
"\n".
'<script type="text/javascript">';
1589 print
'$(document).ready(function () {
1590 $("#addreminder").click(function(){
1591 console.log("Click on addreminder");
1593 $(".reminderparameters").show();
1595 $(".reminderparameters").hide();
1597 $("#selectremindertype").select2("destroy");
1598 $("#selectremindertype").select2();
1599 $("#select_offsetunittype_duration").select2("destroy");
1600 $("#select_offsetunittype_duration").select2();
1601 selectremindertype();
1604 $("#selectremindertype").change(function(){
1605 selectremindertype();
1608 function selectremindertype() {
1609 console.log("Call selectremindertype");
1610 var selected_option = $("#selectremindertype option:selected").val();
1611 if(selected_option == "email") {
1612 $("#select_actioncommsendmodel_mail").closest("tr").show();
1614 $("#select_actioncommsendmodel_mail").closest("tr").hide();
1619 print
'</script>'.
"\n";
1624 print $form->buttonsSaveCancel(
"Add");
1631 $result1 = $object->fetch($id);
1632 if ($result1 <= 0) {
1633 $langs->load(
"errors");
1634 print $langs->trans(
"ErrorRecordNotFound");
1640 $result2 = $object->fetch_thirdparty();
1641 $result2 = $object->fetch_projet();
1642 $result3 = $object->fetch_contact();
1643 $result4 = $object->fetch_userassigned();
1644 $result5 = $object->fetch_optionals();
1646 if ($listUserAssignedUpdated || $donotclearsession) {
1647 $percentage = in_array(
GETPOST(
'status'), array(-1, 100)) ?
GETPOST(
'status') : (in_array($complete, array(-1, 100)) ? $complete :
GETPOST(
"percentage",
'int'));
1649 $datep =
dol_mktime($fulldayevent ?
'00' : $aphour, $fulldayevent ?
'00' : $apmin, 0,
GETPOST(
"apmonth",
'int'),
GETPOST(
"apday",
'int'),
GETPOST(
"apyear",
'int'),
'tzuser');
1650 $datef =
dol_mktime($fulldayevent ?
'23' : $p2hour, $fulldayevent ?
'59' : $p2min, $fulldayevent ?
'59' :
'0',
GETPOST(
"p2month",
'int'),
GETPOST(
"p2day",
'int'),
GETPOST(
"p2year",
'int'),
'tzuser');
1653 $object->label =
GETPOST(
"label",
"alphanohtml");
1654 $object->datep = $datep;
1655 $object->datef = $datef;
1656 $object->percentage = $percentage;
1657 $object->priority =
GETPOST(
"priority",
"alphanohtml");
1658 $object->fulldayevent =
GETPOST(
"fullday") ? 1 : 0;
1659 $object->location =
GETPOST(
'location',
"alpanohtml");
1660 $object->socid =
GETPOST(
"socid",
"int");
1661 $socpeopleassigned =
GETPOST(
"socpeopleassigned",
'array');
1662 foreach ($socpeopleassigned as $tmpid) {
1663 $object->socpeopleassigned[$id] = array(
'id' => $tmpid);
1665 $object->contact_id =
GETPOST(
"contactid",
'int');
1666 $object->fk_project =
GETPOST(
"projectid",
'int');
1668 $object->note_private =
GETPOST(
"note",
'restricthtml');
1671 if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) {
1676 if ($object->authorid > 0) {
1677 $tmpuser =
new User($db); $res = $tmpuser->fetch($object->authorid); $object->author = $tmpuser;
1679 if ($object->usermodid > 0) {
1680 $tmpuser =
new User($db); $res = $tmpuser->fetch($object->usermodid); $object->usermod = $tmpuser;
1691 $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
1695 if ($action ==
'delete') {
1696 print $form->formconfirm(
"card.php?id=".urlencode($id), $langs->trans(
"DeleteAction"), $langs->trans(
"ConfirmDeleteAction"),
"confirm_delete",
'',
'', 1);
1699 if ($action ==
'edit') {
1700 if (!empty($conf->use_javascript_ajax)) {
1701 print
"\n".
'<script type="text/javascript">';
1702 print
'$(document).ready(function () {
1703 function setdatefields()
1705 if ($("#fullday:checked").val() == null) {
1706 $(".fulldaystarthour").removeAttr("disabled");
1707 $(".fulldaystartmin").removeAttr("disabled");
1708 $(".fulldayendhour").removeAttr("disabled");
1709 $(".fulldayendmin").removeAttr("disabled");
1711 $(".fulldaystarthour").prop("disabled", true).val("00");
1712 $(".fulldaystartmin").prop("disabled", true).val("00");
1713 $(".fulldayendhour").prop("disabled", true).val("23");
1714 $(".fulldayendmin").prop("disabled", true).val("59");
1718 $("#fullday").change(function() {
1721 $("#actioncode").change(function() {
1722 if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
1723 else $("#dateend").removeClass("fieldrequired");
1726 print
'</script>'.
"\n";
1729 print
'<form name="formaction" action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
1730 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1731 print
'<input type="hidden" name="action" value="update">';
1732 print
'<input type="hidden" name="id" value="'.$id.
'">';
1733 print
'<input type="hidden" name="ref_ext" value="'.$object->ref_ext.
'">';
1734 print
'<input type="hidden" name="page_y" value="">';
1736 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage :
'').
'">';
1738 if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match(
'/^TICKET_MSG_PRIVATE/', $object->code)) {
1739 print
'<input type="hidden" name="actioncode" value="'.$object->type_code.
'">';
1744 print
'<table class="border tableforfield" width="100%">';
1747 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td colspan="3">'.$object->id.
'</td></tr>';
1750 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype !=
"ticket") {
1751 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td colspan="3">';
1752 if ($object->type_code !=
'AC_OTH_AUTO') {
1753 print
img_picto($langs->trans(
"ActionType"),
'square',
'class="fawidth30 inline-block" style="color: #ddd;"');
1754 print
$formactions->select_type_actions(
GETPOST(
"actioncode",
'aZ09') ?
GETPOST(
"actioncode",
'aZ09') : $object->type_code,
"actioncode",
"systemauto", 0, 0, 0, 1);
1756 print
'<input type="hidden" name="actioncode" value="'.$object->type_code.
'">';
1757 print $object->getTypePicto();
1758 print $langs->trans(
"Action".$object->type_code);
1764 if ($object->elementtype ==
'ticket') {
1765 print
'<tr><td>'.$langs->trans(
"MarkMessageAsPrivate");
1766 print
' '.$form->textwithpicto(
'', $langs->trans(
"TicketMessagePrivateHelp"), 1,
'help');
1767 print
'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match(
'/^TICKET_MSG_PRIVATE/', $object->code) ?
' checked' :
'').
'></td></tr>';
1771 print
'<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ?
' class="fieldrequired titlefieldcreate"' :
'').
'>'.$langs->trans(
"Title").
'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.
'"></td></tr>';
1774 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Date").
'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ?
' checked' :
'').
'>';
1775 print
'<label for="fullday">'.$langs->trans(
"EventOnFullDay").
'</label>';
1838 print
'<tr><td class="nowrap">';
1843 print
'</td><td td colspan="3">';
1846 print $form->selectDate($datep ? $datep : $object->datep,
'ap', 1, 1, 0,
"action", 1, 1, 0,
'fulldaystart',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1847 } elseif (
GETPOST(
"afaire") == 2) {
1848 print $form->selectDate($datep ? $datep : $object->datep,
'ap', 1, 1, 1,
"action", 1, 1, 0,
'fulldaystart',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1850 print $form->selectDate($datep ? $datep : $object->datep,
'ap', 1, 1, 1,
"action", 1, 1, 0,
'fulldaystart',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1852 print
' <span class="hideonsmartphone"> - </span> ';
1854 print $form->selectDate($datef ? $datef : $object->datef,
'p2', 1, 1, 1,
"action", 1, 0, 0,
'fulldayend',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1855 } elseif (
GETPOST(
"afaire") == 2) {
1856 print $form->selectDate($datef ? $datef : $object->datef,
'p2', 1, 1, 1,
"action", 1, 0, 0,
'fulldayend',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1858 print $form->selectDate($datef ? $datef : $object->datef,
'p2', 1, 1, 1,
"action", 1, 0, 0,
'fulldayend',
'',
'',
'', 1,
'',
'', $object->fulldayevent ? ($tzforfullday ? $tzforfullday :
'tzuserrel') :
'tzuserrel');
1862 print
'<tr><td class=""> </td><td></td></tr>';
1865 $listofuserid = array();
1866 if (empty($donotclearsession)) {
1867 if ($object->userownerid > 0) {
1868 $listofuserid[$object->userownerid] = array(
1869 'id'=>$object->userownerid,
1872 'transparency'=>$object->transparency,
1873 'answer_status'=>$object->userassigned[$object->userownerid][
'answer_status'],
1874 'mandatory'=>$object->userassigned[$object->userownerid][
'mandatory']
1877 if (!empty($object->userassigned)) {
1879 $tmplist1 = $object->userassigned;
1880 foreach ($tmplist1 as $key => $val) {
1881 if ($val[
'id'] && $val[
'id'] != $object->userownerid) {
1882 $listofuserid[$val[
'id']] = $val;
1886 $_SESSION[
'assignedtouser'] = json_encode($listofuserid);
1888 if (!empty($_SESSION[
'assignedtouser'])) {
1889 $listofuserid = json_decode($_SESSION[
'assignedtouser'],
true);
1892 $listofcontactid = $object->socpeopleassigned;
1893 $listofotherid = $object->otherassigned;
1895 print
'<tr><td class="tdtop nowrap fieldrequired">'.$langs->trans(
"ActionAssignedTo").
'</td><td colspan="3">';
1896 print
'<div class="assignedtouser">';
1897 print $form->select_dolusers_forevent(($action ==
'create' ?
'add' :
'update'),
'assignedtouser', 1,
'', 0,
'',
'', 0, 0, 0,
'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
1908 if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) {
1909 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionDoneBy").
'</td><td colspan="3">';
1910 print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1,
'doneby', 1);
1915 if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
1916 print
'<tr><td>'.$langs->trans(
"Location").
'</td><td colspan="3"><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.$object->location.
'"></td></tr>';
1920 print
'<tr><td class="nowrap">'.$langs->trans(
"Status").
' / '.$langs->trans(
"Percentage").
'</td><td colspan="3">';
1921 $percent = GETPOSTISSET(
"percentage") ?
GETPOST(
"percentage",
"int") : $object->percentage;
1922 $formactions->form_select_status_action(
'formaction', $percent, 1,
'complete', 0, 0,
'maxwidth200');
1926 if (isModEnabled(
'categorie')) {
1927 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1928 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM,
'',
'parent', 64, 0, 1);
1930 $cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM);
1931 $arrayselected = array();
1932 foreach ($cats as $cat) {
1933 $arrayselected[] = $cat->id;
1935 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1942 print
'<br><hr><br>';
1945 print
'<table class="border tableforfield centpercent">';
1947 if (isModEnabled(
"societe")) {
1949 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ActionOnCompany").
'</td>';
1951 print
'<div class="maxwidth200onsmartphone">';
1953 $events[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1', 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
1956 print
img_picto(
'',
'company',
'class="paddingrightonly"').$form->select_company($object->socid,
'socid',
'',
'SelectThirdParty', 1, 0, $events, 0,
'minwidth200');
1961 print
'<tr><td>'.$langs->trans(
"ActionOnContact").
'</td><td>';
1962 print
'<div class="maxwidth200onsmartphone">';
1963 print
img_picto(
'',
'contact',
'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned),
'socpeopleassigned[]', 1,
'',
'', 1,
'quatrevingtpercent', false, 0, 0, array(),
'multiple',
'contactid');
1970 if (isModEnabled(
'project')) {
1971 $langs->load(
"projects");
1973 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Project").
'</td><td>';
1974 print
img_picto(
'',
'project',
'class="paddingrightonly"');
1975 $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth500');
1976 if ($numprojet == 0) {
1977 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$object->socid.
'&action=create&token='.newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProject").
'"></span></a>';
1983 if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) {
1984 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"Priority").
'</td><td>';
1985 print
'<input type="text" name="priority" value="'.($object->priority ? $object->priority :
'').
'" size="5">';
1990 if (!empty($object->fk_element) && !empty($object->elementtype)) {
1991 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1993 print
'<td>'.$langs->trans(
"LinkedObject").
'</td>';
1995 if ($object->elementtype ==
'task' && isModEnabled(
'project')) {
1996 print
'<td id="project-task-input-container" >';
1998 $urloption =
'?action=create&donotclearsession=1';
1999 $url = DOL_URL_ROOT.
'/comm/action/card.php'.$urloption;
2002 print
"\n".
'<script type="text/javascript" >';
2003 print
'$(document).ready(function () {
2004 $("#projectid").change(function () {
2005 var url = "'.$url.
'&projectid="+$("#projectid").val();
2006 $.get(url, function(data) {
2007 console.log($( data ).find("#fk_element").html());
2008 if (data) $("#fk_element").html( $( data ).find("#taskid").html() ).select2();
2012 print
'</script>'.
"\n";
2014 $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $object->fk_element,
'fk_element', 24, 0, 0, 1, 0, 0,
'maxwidth500', $object->fk_project);
2015 print
'<input type="hidden" name="elementtype" value="'.$object->elementtype.
'">';
2021 print
'<input type="hidden" name="fk_element" value="'.$object->fk_element.
'">';
2022 print
'<input type="hidden" name="elementtype" value="'.$object->elementtype.
'">';
2030 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
2032 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2033 $doleditor =
new DolEditor(
'note', $object->note_private,
'', 120,
'dolibarr_notes',
'In',
true,
true, isModEnabled(
'fckeditor'), ROWS_4,
'90%');
2034 $doleditor->Create();
2038 $parameters = array();
2039 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
2040 print $hookmanager->resPrint;
2041 if (empty($reshook)) {
2042 print $object->showOptionals($extrafields,
'edit', $parameters);
2049 $filteruserid = $user->id;
2050 if ($user->rights->agenda->allactions->read) {
2053 $object->loadReminders(
'', $filteruserid,
false);
2057 if (count($object->reminders) > 0) {
2058 $checked =
'checked';
2059 $keys = array_keys($object->reminders);
2060 $firstreminderId = array_shift($keys);
2062 $actionCommReminder = $object->reminders[$firstreminderId];
2066 $actionCommReminder->offsetvalue =
getDolGlobalInt(
'AGENDA_REMINDER_DEFAULT_OFFSET', 30);
2067 $actionCommReminder->offsetunit =
'i';
2068 $actionCommReminder->typeremind =
'email';
2071 if ($object->datep <
dol_now()) {
2075 print
'<label for="addreminder">'.img_picto(
'',
'bell',
'class="pictofixedwidth"').$langs->trans(
"AddReminder").
'</label> <input type="checkbox" id="addreminder" name="addreminder"'.($checked ?
' '.$checked :
'').($disabled ?
' '.$disabled :
'').
'><br>';
2077 print
'<div class="reminderparameters" '.(empty($checked) ?
'style="display: none;"' :
'').
'>';
2081 print
'<table class="border centpercent">';
2084 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"ReminderTime").
'</td><td colspan="3">';
2085 print
'<input type="number" name="offsetvalue" class="width50" value="'.$actionCommReminder->offsetvalue.
'"> ';
2086 print $form->selectTypeDuration(
'offsetunit', $actionCommReminder->offsetunit, array(
'y',
'm'));
2090 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"ReminderType").
'</td><td colspan="3">';
2091 print $form->selectarray(
'selectremindertype', $TRemindTypes, $actionCommReminder->typeremind, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200', 1);
2095 if ($actionCommReminder->typeremind ==
'browser') {
2096 $hide =
'style="display:none;"';
2101 print
'<tr '.$hide.
'><td class="titlefieldcreate nowrap">'.$langs->trans(
"EMailTemplates").
'</td><td colspan="3">';
2102 print $form->selectModelMail(
'actioncommsend',
'actioncomm_send', 1, 1);
2108 print
"\n".
'<script type="text/javascript">';
2109 print
'$(document).ready(function () {
2110 $("#addreminder").click(function(){
2112 $(".reminderparameters").show();
2114 $(".reminderparameters").hide();
2118 $("#selectremindertype").change(function(){
2119 var selected_option = $("#selectremindertype option:selected").val();
2120 if(selected_option == "email") {
2121 $("#select_actioncommsendmodel_mail").closest("tr").show();
2123 $("#select_actioncommsendmodel_mail").closest("tr").hide();
2128 print
'</script>'.
"\n";
2135 print $form->buttonsSaveCancel();
2144 if ($action ==
'clone') {
2145 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
GETPOST(
'id'), $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneEvent', $object->label),
'confirm_clone', array(),
'yes', 1);
2149 $parameters = array();
2150 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
2151 if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
2152 elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
2159 $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">';
2160 $linkback .=
img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
2161 $linkback .= '<span class="hideonsmartphone">'.$langs->trans("BackToList").'</span>';
2162 $linkback .= '</a>';
2163 $linkback .= '</li>';
2164 $linkback .= '<li class="noborder litext">';
2165 $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.
dol_print_date($object->datep, '%Y').'&month='.
dol_print_date($object->datep, '%m').'&day='.
dol_print_date($object->datep, '%d').'">';
2166 $linkback .=
img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"');
2167 $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewCal").'</span>';
2168 $linkback .= '</a>';
2169 $linkback .= '</li>';
2170 $linkback .= '<li class="noborder litext">';
2171 $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.
dol_print_date($object->datep, '%Y').'&month='.
dol_print_date($object->datep, '%m').'&day='.
dol_print_date($object->datep, '%d').'">';
2172 $linkback .=
img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"');
2173 $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewWeek").'</span>';
2174 $linkback .= '</a>';
2175 $linkback .= '</li>';
2176 $linkback .= '<li class="noborder litext">';
2177 $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.
dol_print_date($object->datep, '%Y').'&month='.
dol_print_date($object->datep, '%m').'&day='.
dol_print_date($object->datep, '%d').'">';
2178 $linkback .=
img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"');
2179 $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewDay").'</span>';
2180 $linkback .= '</a>';
2181 $linkback .= '</li>';
2182 $linkback .= '<li class="noborder litext">';
2183 $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.
dol_print_date($object->datep, '%Y').'&month='.
dol_print_date($object->datep, '%m').'&day='.
dol_print_date($object->datep, '%d').'">';
2184 $linkback .=
img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"');
2185 $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
2186 $linkback .= '</a>';
2189 $parameters = array();
2190 $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
2191 if (empty($reshook)) {
2192 $linkback .= $hookmanager->resPrint;
2193 } elseif ($reshook > 1) {
2194 $linkback = $hookmanager->resPrint;
2199 $morehtmlref =
'<div class="refidno">';
2203 if (isModEnabled(
'project')) {
2204 $langs->load(
"projects");
2206 if ($usercancreate) {
2207 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
2208 if ($action !=
'classify') {
2209 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
2211 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
2213 if (!empty($object->fk_project)) {
2215 $proj->fetch($object->fk_project);
2216 $morehtmlref .= $proj->getNomUrl(1);
2218 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
2223 $morehtmlref .=
'</div>';
2226 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'id',
'ref', $morehtmlref);
2228 print
'<div class="fichecenter">';
2229 print
'<div class="fichehalfleft">';
2231 print
'<div class="underbanner clearboth"></div>';
2234 print
'<table class="border tableforfield" width="100%">';
2237 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
2238 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
2239 print $object->getTypePicto();
2240 print $langs->trans(
"Action".$object->type_code);
2245 print
'<tr><td class="titlefield">'.$langs->trans(
"EventOnFullDay").
'</td><td>'.
yn($object->fulldayevent ? 1 : 0, 3).
'</td></tr>';
2248 if ($object->recurid) {
2249 print
'<tr><td class="titlefield">'.$langs->trans(
"EventIntoASerie").
'</td><td>'.
dol_escape_htmltag($object->recurid).
'</td></tr>';
2253 if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
2258 print
'<tr><td>'.$langs->trans(
"DateActionStart").
'</td><td>';
2263 if (empty($object->fulldayevent)) {
2267 print
dol_print_date($object->datep,
'day', ($tzforfullday ? $tzforfullday :
'tzuserrel'));
2269 if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
2276 print
'<tr><td>'.$langs->trans(
"DateActionEnd").
'</td><td>';
2277 if (empty($object->fulldayevent)) {
2281 print
dol_print_date($object->datef,
'day', ($tzforfullday ? $tzforfullday :
'tzuserrel'));
2283 if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
2289 if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
2290 print
'<tr><td>'.$langs->trans(
"Location").
'</td><td>'.$object->location.
'</td></tr>';
2294 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionAssignedTo").
'</td><td>';
2295 $listofuserid = array();
2296 if (empty($donotclearsession)) {
2297 if ($object->userownerid > 0) {
2298 $listofuserid[$object->userownerid] = array(
2299 'id'=>$object->userownerid,
2300 'transparency'=>$object->transparency,
2301 'answer_status'=>$object->userassigned[$object->userownerid][
'answer_status'],
2302 'mandatory'=>$object->userassigned[$object->userownerid][
'mandatory']
2305 if (!empty($object->userassigned)) {
2307 $tmplist1 = $object->userassigned;
2308 foreach ($tmplist1 as $key => $val) {
2309 if ($val[
'id'] && $val[
'id'] != $object->userownerid) {
2310 $listofuserid[$val[
'id']] = $val;
2314 $_SESSION[
'assignedtouser'] = json_encode($listofuserid);
2316 if (!empty($_SESSION[
'assignedtouser'])) {
2317 $listofuserid = json_decode($_SESSION[
'assignedtouser'],
true);
2321 $listofcontactid = array();
2322 $listofotherid = array();
2323 print
'<div class="assignedtouser">';
2324 print $form->select_dolusers_forevent(
'view',
'assignedtouser', 1,
'', 0,
'',
'', 0, 0, 0,
'', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
2334 print
' </td></tr>';
2337 if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) {
2338 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionDoneBy").
'</td><td>';
2339 if ($object->userdoneid > 0) {
2340 $tmpuser =
new User($db);
2341 $tmpuser->fetch($object->userdoneid);
2342 print $tmpuser->getNomUrl(1);
2348 if (isModEnabled(
'categorie')) {
2349 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
2350 print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
2358 print
'<div class="fichehalfright">';
2360 print
'<div class="underbanner clearboth"></div>';
2361 print
'<table class="border tableforfield centpercent">';
2363 if (isModEnabled(
"societe")) {
2365 print
'<tr><td class="titlefield">'.$langs->trans(
"ActionOnCompany").
'</td>';
2366 print
'<td>'.(is_object($object->thirdparty) && $object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : (
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>'));
2367 if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code ==
'AC_TEL') {
2368 if ($object->thirdparty->fetch($object->thirdparty->id)) {
2369 print
"<br>".dol_print_phone($object->thirdparty->phone);
2375 print
'<tr><td>'.$langs->trans(
"ActionOnContact").
'</td>';
2378 if (!empty($object->socpeopleassigned)) {
2379 foreach ($object->socpeopleassigned as $cid => $Tab) {
2381 $result = $contact->fetch($cid);
2388 print $contact->getNomUrl(1);
2389 if ($object->type_code ==
'AC_TEL') {
2390 if (!empty($contact->phone_pro)) {
2391 print
'('.dol_print_phone($contact->phone_pro).
')';
2394 print
'<div class="paddingright"></div>';
2398 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
2404 print
'<tr><td class="nowrap" class="titlefield">'.$langs->trans(
"Priority").
'</td><td>';
2405 print ($object->priority ? $object->priority :
'');
2410 if (!empty($object->fk_element) && !empty($object->elementtype) && !in_array($object->elementtype, array(
'societe',
'contact',
'project'))) {
2411 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2412 print
'<tr><td>'.$langs->trans(
"LinkedObject").
'</td>';
2416 print
'<span class="opacitymedium">'.$langs->trans(
"ObjectDeleted").
'</span>';
2424 if (!empty($object->email_msgid)) {
2425 print
'<tr><td>'.$langs->trans(
'MailTopic').
'</td>';
2426 print
'<td>'.dol_escape_htmltag($object->email_subject).
'</td></tr>';
2427 print
'<tr><td>'.$langs->trans(
'MailFrom').
'</td>';
2428 print
'<td>'.dol_escape_htmltag($object->email_from).
'</td></tr>';
2429 print
'<tr><td>'.$langs->trans(
'MailTo').
'</td>';
2430 print
'<td>'.dol_escape_htmltag($object->email_to).
'</td></tr>';
2431 if (!empty($object->email_tocc)) {
2432 print
'<tr><td>'.$langs->trans(
'MailCC').
'</td>';
2433 print
'<td>'.dol_escape_htmltag($object->email_tocc).
'</td></tr>';
2438 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak sensiblehtmlcontent">';
2443 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2446 if (!empty($conf->global->AGENDA_REMINDER_EMAIL) || !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
2447 $filteruserid = $user->id;
2448 if ($user->rights->agenda->allactions->read) {
2451 $object->loadReminders(
'', $filteruserid,
false);
2453 print
'<tr><td class="titlefieldcreate nowrap">'.$langs->trans(
"Reminders").
'</td><td>';
2455 if (count($object->reminders) > 0) {
2456 $tmpuserstatic =
new User($db);
2458 foreach ($object->reminders as $actioncommreminderid => $actioncommreminder) {
2459 print $TRemindTypes[$actioncommreminder->typeremind][
'label'];
2460 if ($actioncommreminder->fk_user > 0) {
2461 $tmpuserstatic->fetch($actioncommreminder->fk_user);
2462 print
' ('.$tmpuserstatic->getNomUrl(0,
'', 0, 0, 16).
')';
2464 print
' - '.$actioncommreminder->offsetvalue.
' '.$TDurationTypes[$actioncommreminder->offsetunit];
2466 if ($actioncommreminder->status == $actioncommreminder::STATUS_TODO) {
2467 print
' - <span class="opacitymedium">';
2468 print $langs->trans(
"NotSent");
2470 } elseif ($actioncommreminder->status == $actioncommreminder::STATUS_DONE) {
2471 print
' - <span class="opacitymedium">';
2472 print $langs->trans(
"Done");
2474 } elseif ($actioncommreminder->status == $actioncommreminder::STATUS_ERROR) {
2475 print
' - <span class="opacitymedium">';
2476 print $form->textwithpicto($langs->trans(
"Error"), $actioncommreminder->lasterror);
2490 print
'<div class="clearboth"></div>';
2499 print
'<div class="tabsAction">';
2501 $parameters = array();
2502 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2503 if (empty($reshook)) {
2504 if ($action !=
'edit') {
2505 if ($user->hasRight(
'agenda',
'allactions',
'create') ||
2506 (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'create'))) {
2507 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a></div>';
2509 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Modify").
'</a></div>';
2512 if ($user->hasRight(
'agenda',
'allactions',
'create') ||
2513 (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'create'))) {
2514 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?action=clone&object='.$object->element.
'&id='.$object->id.
'">'.$langs->trans(
"ToClone").
'</a></div>';
2516 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ToClone").
'</a></div>';
2519 if ($user->rights->agenda->allactions->delete ||
2520 (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'delete'))) {
2521 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a></div>';
2523 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Delete").
'</a></div>';
2530 if ($action !=
'edit') {
2531 if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) {
2532 print
'<div class="clearboth"></div><div class="fichecenter"><div class="fichehalfleft">';
2533 print
'<a name="builddoc"></a>';
2539 $filedir = $conf->agenda->multidir_output[$conf->entity].
'/'.$object->id;
2540 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2542 $genallowed = $user->hasRight(
'agenda',
'myactions',
'read');
2543 $delallowed = $user->hasRight(
'agenda',
'myactions',
'create');
2546 print $formfile->showdocuments(
'actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed,
'', 0, 0, 0, 0, 0,
'',
'',
'', $langs->getDefaultLang());
2548 print
'</div><div class="fichehalfright">';
2551 print
'</div></div>';
actions_prepare_head($object)
Prepare array with list of tabs.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage agenda events (actions)
Class for ActionCommReminder.
Class to manage different types of events.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
num_between_day($timestampStart, $timestampEnd, $lastday=0)
Function to return number of days between two dates (date must be UTC date !) Example: 2012-01-01 201...
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dolGetElementUrl($objectid, $objecttype, $withpicto=0, $option='')
Return link url to an object.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0)
Clean a string to keep only desirable HTML tags.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.