PageRenderTime 58ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/htdocs/planning/fiche.php

https://bitbucket.org/speedealing/speedealing
PHP | 1355 lines | 897 code | 178 blank | 280 comment | 225 complexity | 4bf5e0b9d93cb3f42e23a3965b9ab514 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
  6. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  7. * Copyright (C) 2010-2011 Herve Prot <herve.prot@symeos.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. require("../main.inc.php");
  23. require_once(DOL_DOCUMENT_ROOT . "/agenda/lib/agenda.lib.php");
  24. require_once(DOL_DOCUMENT_ROOT . "/core/lib/project.lib.php");
  25. require_once(DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php");
  26. require_once(DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php");
  27. require_once(DOL_DOCUMENT_ROOT . "/user/class/user.class.php");
  28. require_once(DOL_DOCUMENT_ROOT . "/agenda/class/agenda.class.php");
  29. require_once(DOL_DOCUMENT_ROOT . "/core/class/html.formactions.class.php");
  30. require_once(DOL_DOCUMENT_ROOT . '/propal/class/propal.class.php');
  31. require_once(DOL_DOCUMENT_ROOT . "/projet/class/project.class.php");
  32. require_once(DOL_DOCUMENT_ROOT . "/core/lib/project.lib.php");
  33. if (! empty($conf->lead->enabled)) {
  34. dol_include_once("/lead/class/lead.class.php");
  35. dol_include_once("/lead/lib/lead.lib.php");
  36. }
  37. $langs->load("companies");
  38. $langs->load("commercial");
  39. $langs->load("other");
  40. $langs->load("bills");
  41. $langs->load("orders");
  42. $langs->load("agenda");
  43. $action = GETPOST('action', 'alpha');
  44. $cancel = GETPOST('cancel', 'alpha');
  45. $backtopage = GETPOST('backtopage', 'alpha');
  46. $contactid = GETPOST('contactid', 'alpha');
  47. // Security check
  48. $socid = GETPOST('socid', 'alpha');
  49. $id = GETPOST('id', 'alpha');
  50. if ($user->societe_id)
  51. $socid = $user->societe_id;
  52. $result = restrictedArea($user, 'agenda', $id, 'actioncomm', 'myactions', '', 'id');
  53. $error = GETPOST("error");
  54. $mesg = '';
  55. $object = new Agenda($db);
  56. $contact = new Contact($db);
  57. //var_dump($_POST);
  58. /*
  59. * Action creation de l'action
  60. */
  61. if ($action == 'add_action') {
  62. $error = 0;
  63. if (empty($backtopage)) {
  64. $backtopage = DOL_URL_ROOT . '/agenda/index.php';
  65. }
  66. if ($contactid) {
  67. $result = $contact->fetch($contactid);
  68. }
  69. if ($cancel) {
  70. header("Location: " . $backtopage);
  71. exit;
  72. }
  73. $fulldayevent = $_POST["fullday"];
  74. // Clean parameters
  75. $datep = dol_mktime($fulldayevent ? '00' : $_POST["aphour"], $fulldayevent ? '00' : $_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
  76. $datef = dol_mktime($fulldayevent ? '23' : $_POST["p2hour"], $fulldayevent ? '59' : $_POST["p2min"], $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
  77. /*
  78. echo '<pre>'.print_r($datep, true).'</pre>';
  79. echo '<pre>'.print_r($datef, true).'</pre>';
  80. die();
  81. */
  82. // Check parameters
  83. if (!$datef && $_POST["percentage"] == 100) {
  84. $error++;
  85. $action = 'create';
  86. $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("DateEnd")) . '</div>';
  87. }
  88. // Initialisation objet cactioncomm
  89. if (!$_POST["actioncode"]) {
  90. $error++;
  91. $action = 'create';
  92. $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Type")) . '</div>';
  93. } else {
  94. //$result = $cactioncomm->fetch($_POST["actioncode"]);
  95. $object->type_code = $_POST["actioncode"];
  96. }
  97. /*
  98. if ($cactioncomm->type == 2) { //ACTION
  99. if ($_POST["percentage"] == 100)
  100. $datef = dol_now();
  101. else
  102. $datef = '';
  103. } */
  104. // Check parameters
  105. if (!$datef && $_POST["percentage"] == 100) {
  106. $error = 1;
  107. $action = 'create';
  108. $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("DateEnd")) . '</div>';
  109. }
  110. // Initialisation objet actioncomm
  111. $object->type_id = null;
  112. $object->type_code = $_POST["actioncode"];
  113. $object->fulldayevent = $_POST["fullday"] ? 1 : 0;
  114. $object->location = isset($_POST["location"]) ? $_POST["location"] : '';
  115. $object->label = trim($_POST["label"]);
  116. if (!$_POST["label"]) {
  117. if ($_POST["actioncode"] == 'AC_RDV' && $contact->getFullName($langs)) {
  118. $object->label = $langs->transnoentitiesnoconv("TaskRDVWith", $contact->getFullName($langs));
  119. } else {
  120. if ($langs->trans("Action" . $object->type_code) != "Action" . $object->type_code) {
  121. $object->label = $langs->transnoentitiesnoconv("Action" . $object->type_code) . "\n";
  122. }
  123. else
  124. $object->label = $cactioncomm->libelle;
  125. }
  126. }
  127. $object->fk_project = isset($_POST["projectid"]) ? $_POST["projectid"] : 0;
  128. $object->fk_lead = isset($_POST["leadid"]) ? $_POST["leadid"] : 0;
  129. $object->propalrowid = isset($_POST["propalid"]) ? $_POST["propalid"] : 0;
  130. $object->type = $cactioncomm->type;
  131. $object->fk_task = isset($_POST["fk_task"]) ? $_POST["fk_task"] : 0;
  132. $object->datep = $datep;
  133. $object->datef = $datef;
  134. $object->Status = GETPOST('status');
  135. if ($object->type_code == "AC_RDV") //ACTION
  136. $object->durationp = $object->datef - $object->datep;
  137. else {
  138. $object->durationp = $_POST["durationhour"] * 3600 + $_POST["durationmin"] * 60;
  139. $object->datef = $object->datep + $object->durationp;
  140. }
  141. /*
  142. if ($cactioncomm->type == 1) { //RDV
  143. // RDV
  144. if ($object->datef && $object->datef < dol_now('tzref')) {
  145. $object->percentage = 100;
  146. } else {
  147. $object->percentage = 0;
  148. }
  149. } else {
  150. $object->percentage = isset($_POST["percentage"]) ? $_POST["percentage"] : 0;
  151. }
  152. $object->duree = (($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
  153. */
  154. $object->author->id = $user->id;
  155. $object->author->name = $user->login;
  156. $object->usermod = null;
  157. if (strlen($_POST["affectedto"]) > 0)
  158. $object->usertodo->id = GETPOST("affectedto");
  159. /*
  160. $userdone = new User($db);
  161. if ($_POST["doneby"] > 0) {
  162. $userdone->fetch($_POST["doneby"]);
  163. }
  164. $object->userdone = $userdone;
  165. *
  166. */
  167. if (strlen($_POST["doneby"]) > 0)
  168. $object->userdone->id = GETPOST("doneby");
  169. $object->notes = trim($_POST["note"]);
  170. if (isset($_POST["contactid"]))
  171. $object->contact = $contact;
  172. if (!empty($socid)) {
  173. $societe = new Societe($db);
  174. $societe->fetch($socid);
  175. $object->societe->id = $societe->id;
  176. $object->societe->name = $societe->name;
  177. }
  178. // Special for module webcal and phenix
  179. if ($_POST["add_webcal"] == 'on' && $conf->webcalendar->enabled)
  180. $object->use_webcal = 1;
  181. if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled)
  182. $object->use_phenix = 1;
  183. // Check parameters
  184. if ($cactioncomm->type == 1 && ($datef == '')) { //RDV
  185. $error++;
  186. $action = 'create';
  187. $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")) . '</div>';
  188. }
  189. /*
  190. if ($datea && $_POST["percentage"] == 0) {
  191. $error++;
  192. $action = 'create';
  193. $mesg = '<div class="error">' . $langs->trans("ErrorStatusCantBeZeroIfStarted") . '</div>';
  194. }
  195. */
  196. if (!$_POST["apyear"] && !$_POST["adyear"]) {
  197. $error++;
  198. $action = 'create';
  199. $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")) . '</div>';
  200. }
  201. //echo '<pre>'.print_r($_POST, true).'</pre>';
  202. //echo '<pre>'.print_r($object, true).'</pre>';
  203. //die();
  204. if (!$error) {
  205. // On cree l'action
  206. $idaction = $object->add($user);
  207. if ($idaction > 0) {
  208. if (!$object->error) {
  209. $db->commit();
  210. if (!empty($backtopage)) {
  211. dol_syslog("Back to " . $backtopage);
  212. Header("Location: " . $backtopage);
  213. } elseif ($idaction) {
  214. Header("Location: " . DOL_URL_ROOT . '/agenda/fiche.php?id=' . $idaction);
  215. } else {
  216. Header("Location: " . DOL_URL_ROOT . '/agenda/index.php');
  217. }
  218. exit;
  219. } else {
  220. // Si erreur
  221. $db->rollback();
  222. $id = $idaction;
  223. $langs->load("errors");
  224. $error = $langs->trans($object->error);
  225. }
  226. } else {
  227. $db->rollback();
  228. $id = $idaction;
  229. $langs->load("errors");
  230. $error = $langs->trans($object->error);
  231. }
  232. }
  233. }
  234. /*
  235. * Action cloturer l'action
  236. */
  237. if (GETPOST("action") == 'close') {
  238. $object->load($id);
  239. if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
  240. $object->Status = "DONE";
  241. $object->percentage = 100;
  242. $object->record();
  243. Header("Location: " . DOL_URL_ROOT . '/agenda/fiche.php?id=' . $id);
  244. exit;
  245. }
  246. }
  247. /*
  248. * Action suppression de l'action
  249. */
  250. if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') {
  251. $object->fetch($id);
  252. if ($user->rights->agenda->myactions->delete
  253. || $user->rights->agenda->allactions->delete) {
  254. $result = $object->delete();
  255. if ($result >= 0) {
  256. Header("Location: /agenda/listactions.php");
  257. exit;
  258. } else {
  259. $mesg = $object->error;
  260. }
  261. }
  262. }
  263. /*
  264. * Action mise a jour de l'action
  265. */
  266. if ($action == 'update') {
  267. if (!$_POST["cancel"]) {
  268. $fulldayevent = $_POST["fullday"];
  269. // Clean parameters
  270. if ($_POST["aphour"] == -1)
  271. $_POST["aphour"] = '0';
  272. if ($_POST["apmin"] == -1)
  273. $_POST["apmin"] = '0';
  274. if ($_POST["p2hour"] == -1)
  275. $_POST["p2hour"] = '0';
  276. if ($_POST["p2min"] == -1)
  277. $_POST["p2min"] = '0';
  278. //if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
  279. //if ($_POST["admin"] == -1) $_POST["admin"]='0';
  280. $object->fetch($id);
  281. $datep = dol_mktime($fulldayevent ? '00' : $_POST["aphour"], $fulldayevent ? '00' : $_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
  282. $datef = dol_mktime($fulldayevent ? '23' : $_POST["p2hour"], $fulldayevent ? '59' : $_POST["p2min"], $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
  283. $object->label = $_POST["label"];
  284. $object->datep = $datep;
  285. $object->datef = $datef;
  286. //$object->date = $datea;
  287. //$object->dateend = $datea2;
  288. $object->percentage = $_POST["percentage"];
  289. $object->fulldayevent = $_POST["fullday"] ? 1 : 0;
  290. $object->location = isset($_POST["location"]) ? $_POST["location"] : '';
  291. $object->contact->id = $_POST["contactid"];
  292. $object->fk_project = $_POST["projectid"];
  293. $object->fk_lead = $_POST["leadid"];
  294. $object->propalrowid = $_POST["propalid"];
  295. $object->notes = $_POST["note"];
  296. $object->fk_task = $_POST["fk_task"];
  297. //$object->type = $cactioncomm->type;
  298. $object->Status = $_POST["status"];
  299. if ($object->type_code == "AC_RDV") //ACTION
  300. $object->durationp = $object->datef - $object->datep;
  301. else {
  302. $object->durationp = $_POST["durationhour"] * 3600 + $_POST["durationmin"] * 60;
  303. $object->datef = $object->datep + $object->durationp;
  304. }
  305. /*
  306. if ($object->type == 2) //ACTION
  307. $object->durationp = !empty($_POST["duration"]) ? $_POST["duration"] * 3600 : 3600;
  308. if ($object->type == 1 && !$datef && $object->percentage == 100) {
  309. $error = $langs->trans("ErrorFieldRequired", $langs->trans("DateEnd"));
  310. $action = 'edit';
  311. }
  312. */
  313. // Users
  314. $object->usertodo->id = $_POST["affectedto"];
  315. $object->userdone->id = $_POST["doneby"];
  316. if (GETPOST("socid", "alpha")) {
  317. $societe = new Societe($db);
  318. $societe->fetch($_POST["socid"]);
  319. $object->societe->id = $_POST["socid"];
  320. $object->societe->name = $societe->ThirdPartyName;
  321. } else
  322. $object->societe = new stdClass();
  323. //debug($object);
  324. //die();
  325. if (!$error) {
  326. $db->begin();
  327. $result = $object->update($user);
  328. if ($result > 0) {
  329. $db->commit();
  330. } else {
  331. $db->rollback();
  332. $langs->load("errors");
  333. $error = $langs->trans($object->error);
  334. $action = 'edit';
  335. }
  336. }
  337. }
  338. if ($result < 0) {
  339. $langs->load("errors");
  340. $mesg = '<div class="error">' . $langs->trans($object->error) . '</div>';
  341. } else {
  342. if (!empty($backtopage)) {
  343. header("Location: " . $backtopage);
  344. exit;
  345. }
  346. }
  347. }
  348. /*
  349. * View
  350. */
  351. llxHeader('', $langs->trans("Agenda"));
  352. $form = new Form($db);
  353. $htmlactions = new FormActions($db);
  354. if ($action == 'create') {
  355. $contact = new Contact($db);
  356. if (GETPOST("contactid")) {
  357. $result = $contact->fetch(GETPOST("contactid"));
  358. if ($result < 0)
  359. dol_print_error($db, $contact->error);
  360. }
  361. $object->fk_task = GETPOST("fk_task") ? GETPOST("fk_task") : 0;
  362. if (GETPOST("actioncode") == 'AC_RDV')
  363. $title = $langs->trans("AddActionRendezVous");
  364. else
  365. $title = $langs->trans("AddAnAction");
  366. print_fiche_titre($title);
  367. print '<div class="with-padding">';
  368. print '<div class="columns">';
  369. print start_box($title, "twelve", $object->fk_extrafields->ico, false);
  370. if ($conf->use_javascript_ajax) {
  371. print "\n" . '<script type="text/javascript" language="javascript">';
  372. print 'jQuery(document).ready(function () {
  373. function setdatefields()
  374. {
  375. if (jQuery("#fullday:checked").val() == null)
  376. {
  377. jQuery(".fulldaystarthour").attr(\'disabled\', false);
  378. jQuery(".fulldaystartmin").attr(\'disabled\', false);
  379. jQuery(".fulldayendhour").attr(\'disabled\', false);
  380. jQuery(".fulldayendmin").attr(\'disabled\', false);
  381. }
  382. else
  383. {
  384. jQuery(".fulldaystarthour").attr(\'disabled\', true);
  385. jQuery(".fulldaystartmin").attr(\'disabled\', true);
  386. jQuery(".fulldayendhour").attr(\'disabled\', true);
  387. jQuery(".fulldayendmin").attr(\'disabled\', true);
  388. jQuery(".fulldaystarthour").val("00");
  389. jQuery(".fulldaystartmin").val("00");
  390. //jQuery(".fulldayendhour").val("00");
  391. //jQuery(".fulldayendmin").val("00");
  392. jQuery(".fulldayendhour").val("23");
  393. jQuery(".fulldayendmin").val("59");
  394. }
  395. }
  396. setdatefields();
  397. jQuery("#fullday").change(function() {
  398. setdatefields();
  399. });
  400. jQuery("#selectcomplete").change(function() {
  401. if (jQuery("#selectcomplete").val() == 100)
  402. {
  403. if (jQuery("#doneby").val() <= 0) jQuery("#doneby").val(\'' . $user->id . '\');
  404. }
  405. if (jQuery("#selectcomplete").val() == 0)
  406. {
  407. jQuery("#doneby").val(-1);
  408. }
  409. });
  410. jQuery("#actioncode").change(function() {
  411. if (jQuery("#actioncode").val() == \'AC_RDV\') jQuery("#dateend").addClass("fieldrequired");
  412. else jQuery("#dateend").removeClass("fieldrequired");
  413. });
  414. })';
  415. print '</script>' . "\n";
  416. print "\n" . '<script type="text/javascript" language="javascript">';
  417. print 'jQuery(document).ready(function () {
  418. function settype()
  419. {
  420. var typeselected=jQuery("#actioncode option:selected").val();
  421. var type=typeselected.split("_");
  422. if (type[1] == "RDV")
  423. {
  424. $("#jqfullday").css("display","table-row");
  425. $("#jqech").hide();
  426. $("#jqstart").show();
  427. $("#jqend").css("display","table-row");
  428. $("#jqloc").css("display","table-row");
  429. $(".fulldaystarthour").show();
  430. $(".fulldaystartmin").show();
  431. $(".fulldayendhour").show();
  432. $(".fulldayendmin").show();
  433. jQuery(".fulldaystartmin").val("00");
  434. jQuery(".fulldayendmin").val("00");
  435. $("#jqduration").hide();
  436. }
  437. else
  438. {
  439. $("#jqfullday").css("display","none");
  440. $("#jqech").show();
  441. $("#jqstart").hide();
  442. $("#jqend").css("display","none");
  443. $("#jqloc").css("display","none");
  444. $(".fulldayendhour").hide();
  445. $(".fulldayendmin").hide();
  446. jQuery(".fulldaystartmin").val("00");
  447. $("#jqduration").show();
  448. }
  449. }
  450. settype();
  451. jQuery("#actioncode").change(function() {
  452. settype();
  453. });
  454. })';
  455. print '</script>' . "\n";
  456. /* print "\n".'<script type="text/javascript" language="javascript">';
  457. print 'jQuery(document).ready(function () {
  458. function setday()
  459. {
  460. if ($("#ap").val()!="")
  461. {
  462. $("#p2").val($("#ap").val());
  463. }
  464. }
  465. setday();
  466. jQuery("#p2").click(function() {
  467. setday();
  468. });
  469. })';
  470. print '</script>'."\n";
  471. print "\n".'<script type="text/javascript" language="javascript">';
  472. print 'jQuery(document).ready(function () {
  473. function sethour()
  474. {
  475. var hour=parseInt($(".fulldaystarthour option:selected").val());
  476. hour=hour+1;
  477. var strhour=hour.toString(10)
  478. if(strhour.length==1)
  479. $(".fulldayendhour").val(0+strhour);
  480. else
  481. $(".fulldayendhour").val(strhour);
  482. }
  483. sethour();
  484. jQuery(".fulldaystarthour").click(function() {
  485. sethour();
  486. });
  487. })';
  488. print '</script>'."\n"; */
  489. }
  490. print '<form name="formaction" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
  491. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  492. print '<input type="hidden" name="action" value="add_action">';
  493. if ($backtopage)
  494. print '<input type="hidden" name="backtopage" value="' . ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]) . '">';
  495. dol_htmloutput_mesg($mesg);
  496. print '<div class="tabBar">';
  497. print '<table class="border" width="100%">';
  498. // Type d'action actifs
  499. print '<tr><td width="30%"><span class="fieldrequired">' . $langs->trans("Type") . '</span></b></td><td>';
  500. /* if (GETPOST("actioncode"))
  501. {
  502. print '<input type="hidden" name="actioncode" value="'.GETPOST("actioncode").'">'."\n";
  503. $cactioncomm->fetch(GETPOST("actioncode"));
  504. print $cactioncomm->getNomUrl();
  505. $object->type=split("_",$cactioncomm->code);
  506. }
  507. else
  508. { */
  509. //$htmlactions->select_type_actions($object->type_code, "actioncode");
  510. print $object->select_fk_extrafields("type_code", "actioncode");
  511. //}
  512. print '</td></tr>';
  513. // Title
  514. print '<tr id="jqtitle"><td>' . $langs->trans("Title") . '</td><td><input type="text" name="label" size="60" value="' . GETPOST('label') . '"></td></tr>';
  515. // Full day
  516. print '<tr id="jqfullday"><td>' . $langs->trans("EventOnFullDay") . '</td><td><input type="checkbox" id="fullday" name="fullday" ' . (GETPOST('fullday') ? ' checked="checked"' : '') . '></td></tr>';
  517. // Date start
  518. $datep = $object->datep;
  519. if (GETPOST('datep', 'int', 1))
  520. $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
  521. print '<tr><td width="30%" nowrap="nowrap"><span class="fieldrequired" id="jqech">' . $langs->trans("DateEchAction") . '</span><span class="fieldrequired" id="jqstart">' . $langs->trans("DateActionStart") . '</span></td><td>';
  522. if (GETPOST("afaire") == 1)
  523. $form->select_date($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  524. else if (GETPOST("afaire") == 2)
  525. $form->select_date($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  526. // $html->select_date($datep,'ap',0,0,1,"action",1,1,0,0,'fulldaystart');
  527. $form->select_date($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldaystart', array('stepMinutes' => 30));
  528. print '</td></tr>';
  529. // Date end
  530. $datef = $object->datef;
  531. if (GETPOST('datef', 'int', 1))
  532. $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
  533. print '<tr id="jqend"><td>' . $langs->trans("DateActionEnd") . '</td><td>';
  534. if (GETPOST("afaire") == 1)
  535. $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  536. else if (GETPOST("afaire") == 2)
  537. $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  538. else
  539. $form->select_date($datef, 'p2', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  540. print '</td></tr>';
  541. // duration task
  542. print '<tr id="jqduration"><td>' . $langs->trans("Duration") . '</td><td colspan="3">';
  543. //<input type="text" name="duration" size="3" value="' . (empty($object->durationp) ? 1 : $object->durationp / 3600) . '">
  544. $form->select_duration('duration', '', 0, array('stepMinutes' => 30));
  545. print '</td></tr>';
  546. // Status
  547. print '<tr><td width="10%">' . $langs->trans("Status") . ' / ' . $langs->trans("Percentage") . '</td>';
  548. print '<td>';
  549. //$percent=-1;
  550. $percent = 0;
  551. if (isset($_GET['percentage']) || isset($_POST['percentage'])) {
  552. $percent = GETPOST('percentage');
  553. } else {
  554. if (GETPOST("afaire") == 1)
  555. $percent = 0;
  556. if (GETPOST("afaire") == 2)
  557. $percent = 100;
  558. }
  559. print $object->select_fk_extrafields("Status", "status");
  560. print '</td></tr>';
  561. // Location
  562. print '<tr id="jqloc"><td>' . $langs->trans("Location") . '</td><td colspan="3"><input type="text" name="location" size="50" value="' . $object->location . '"></td></tr>';
  563. print '</table>';
  564. print '<br><br>';
  565. print '<table class="border" width="100%">';
  566. // Affected by
  567. $var = false;
  568. print '<tr><td width="30%" nowrap="nowrap">' . $langs->trans("ActionAffectedTo") . '</td><td>';
  569. print $object->select_fk_extrafields("usertodo", 'affectedto');
  570. //$form->select_users(GETPOST("affectedto") ? GETPOST("affectedto") : ($object->usertodo->id > 0 ? $object->usertodo : $user), 'affectedto', 1);
  571. print '</td></tr>';
  572. // Realised by
  573. print '<tr><td nowrap>' . $langs->trans("ActionDoneBy") . '</td><td>';
  574. print $object->select_fk_extrafields("userdone", 'doneby');
  575. //$form->select_users(GETPOST("doneby") ? GETPOST("doneby") : (!empty($object->userdone->id) && $percent == 100 ? $object->userdone->id : 0), 'doneby', 1);
  576. print '</td></tr>';
  577. print '</table>';
  578. print '<br><br>';
  579. print '<table class="border" width="100%">';
  580. // Societe, contact
  581. print '<tr><td width="30%" nowrap="nowrap">' . $langs->trans("ActionOnCompany") . '</td><td>';
  582. if (!empty($socid)) {
  583. $societe = new Societe($db);
  584. $societe->fetch($socid);
  585. if ($societe->class == "Societe")
  586. print $societe->getNomUrl(1);
  587. else { // Is a contact
  588. $object->contact->id = $socid;
  589. $socid = $societe->societe->id;
  590. $societe->fetch($socid);
  591. print $societe->getNomUrl(1);
  592. }
  593. print '<input type="hidden" name="socid" value="' . $socid . '">';
  594. } else {
  595. print $object->select_fk_extrafields("societe", 'socid');
  596. //print $form->select_company('', 'socid', '', 1, 1);
  597. }
  598. print '</td></tr>';
  599. // If company is forced, we propose contacts (may be contact is also forced)
  600. if (!empty($socid)) {
  601. $object->societe->id = $socid;
  602. print '<tr><td nowrap>' . $langs->trans("ActionOnContact") . '</td><td>';
  603. print $object->select_fk_extrafields("contact", 'contactid');
  604. //$form->select_contacts(GETPOST('socid', 'int'), GETPOST('contactid'), 'contactid', 1);
  605. print '</td></tr>';
  606. }
  607. // Lead
  608. if ($conf->lead->enabled && GETPOST("leadid")) {
  609. // Affaire associe
  610. $langs->load("lead");
  611. print '<tr><td valign="top">' . $langs->trans("Lead") . '</td><td>';
  612. $numlead = select_leads($societe->id, GETPOST("leadid") ? GETPOST("leadid") : $leadid, 'leadid');
  613. if ($numlead == 0) {
  614. print ' &nbsp; <a href="../../lead/fiche.php?socid=' . $societe->id . '&action=create">' . $langs->trans("AddLead") . '</a>';
  615. }
  616. print '</td></tr>';
  617. }
  618. // Project
  619. if (!empty($conf->projet->enabled)) {
  620. // Projet associe
  621. $langs->load("project");
  622. print '<tr><td valign="top">' . $langs->trans("Project") . '</td><td>';
  623. $numproject = select_projects((!empty($societe->id) ? $societe->id : 0), GETPOST("projectid") ? GETPOST("projectid") : '', 'projectid');
  624. if ($numproject == 0) {
  625. print ' &nbsp; <a href="' . DOL_DOCUMENT_ROOT . '/projet/fiche.php?socid=' . $societe->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
  626. }
  627. print '</td></tr>';
  628. }
  629. // PropalID
  630. if (GETPOST("propalid")) {
  631. // Object linked
  632. $propal = new Propal($db);
  633. $propal->fetch(GETPOST("propalid"));
  634. print '<tr><td valign="top">' . $langs->trans("LinkedObject") . '</td><td>';
  635. print '<input type="hidden" name="propalid" value="' . $propal->id . '">';
  636. print $propal->getNomUrl(1);
  637. print '</td></tr>';
  638. }
  639. if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) {
  640. $object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]);
  641. }
  642. add_row_for_calendar_link();
  643. // Description
  644. print '<tr><td valign="top">' . $langs->trans("Description") . '</td><td>';
  645. require_once(DOL_DOCUMENT_ROOT . "/core/class/doleditor.class.php");
  646. $doleditor = new DolEditor('note', (GETPOST('note') ? GETPOST('note') : $object->notes), '', 280, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_7, 90);
  647. $doleditor->Create();
  648. print '</td></tr>';
  649. print '</table>';
  650. print '<br><center>';
  651. print '<input type="submit" class="button" value="' . $langs->trans("Add") . '">';
  652. print ' &nbsp; &nbsp; ';
  653. print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
  654. print "</center>";
  655. print "</form>";
  656. print "</div>";
  657. print end_box();
  658. }
  659. // View or edit
  660. if ($id) {
  661. if ($error) {
  662. dol_htmloutput_errors($error);
  663. }
  664. if ($mesg) {
  665. dol_htmloutput_mesg($mesg);
  666. }
  667. $result = $object->fetch($id);
  668. if ($result < 0) {
  669. dol_print_error($db, $object->error);
  670. exit;
  671. }
  672. $societe = new Societe($db);
  673. /* if ($object->societe->id) {
  674. $result = $societe->fetch($object->societe->id);
  675. }
  676. $object->societe = $societe;
  677. if ($object->author->id > 0) {
  678. $tmpuser = new User($db);
  679. $res = $tmpuser->fetch($object->author->id);
  680. $object->author = $tmpuser;
  681. }
  682. if ($object->usermod->id > 0) {
  683. $tmpuser = new User($db);
  684. $res = $tmpuser->fetch($object->usermod->id);
  685. $object->usermod = $tmpuser;
  686. }
  687. if ($object->usertodo->id > 0) {
  688. $tmpuser = new User($db);
  689. $res = $tmpuser->fetch($object->usertodo->id);
  690. $object->usertodo = $tmpuser;
  691. }
  692. if ($object->userdone->id > 0) {
  693. $tmpuser = new User($db);
  694. $res = $tmpuser->fetch($object->userdone->id);
  695. $object->userdone = $tmpuser;
  696. }
  697. */
  698. $contact = new Contact($db);
  699. if ($object->contact->id) {
  700. $result = $contact->fetch($object->contact->id, $user);
  701. }
  702. $object->contact = $contact;
  703. print_fiche_titre($langs->trans("Event") . " " . $object->label);
  704. print '<div class="with-padding">';
  705. print '<div class="columns">';
  706. print start_box($object->print_fk_extrafields("type_code") . " : " . $object->label, "tweleve", "16-Timer.png", false);
  707. /*
  708. * Affichage onglets
  709. */
  710. dol_fiche_head($head, 'card', $langs->trans("Action"), 0, 'action');
  711. $now = dol_now();
  712. $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
  713. // Confirmation suppression action
  714. if ($action == 'delete') {
  715. $ret = $form->form_confirm("/agenda/fiche.php?id=" . $id, $langs->trans("DeleteAction"), $langs->trans("ConfirmDeleteAction"), "confirm_delete", '', '', 1);
  716. if ($ret == 'html')
  717. print '<br>';
  718. }
  719. if ($action == 'edit') {
  720. if ($conf->use_javascript_ajax) {
  721. print "\n" . '<script type="text/javascript" language="javascript">';
  722. print 'jQuery(document).ready(function () {
  723. function setdatefields()
  724. {
  725. if (jQuery("#fullday:checked").val() == null)
  726. {
  727. jQuery(".fulldaystarthour").attr(\'disabled\', false);
  728. jQuery(".fulldaystartmin").attr(\'disabled\', false);
  729. jQuery(".fulldayendhour").attr(\'disabled\', false);
  730. jQuery(".fulldayendmin").attr(\'disabled\', false);
  731. }
  732. else
  733. {
  734. jQuery(".fulldaystarthour").attr(\'disabled\', true);
  735. jQuery(".fulldaystartmin").attr(\'disabled\', true);
  736. jQuery(".fulldayendhour").attr(\'disabled\', true);
  737. jQuery(".fulldayendmin").attr(\'disabled\', true);
  738. jQuery(".fulldaystarthour").val("00");
  739. jQuery(".fulldaystartmin").val("00");
  740. //jQuery(".fulldayendhour").val("00");
  741. //jQuery(".fulldayendmin").val("00");
  742. jQuery(".fulldayendhour").val("23");
  743. jQuery(".fulldayendmin").val("59");
  744. }
  745. }
  746. setdatefields();
  747. jQuery("#fullday").change(function() {
  748. setdatefields();
  749. });
  750. })';
  751. print '</script>' . "\n";
  752. print "\n" . '<script type="text/javascript" language="javascript">';
  753. print 'jQuery(document).ready(function () {
  754. function settype()
  755. {
  756. var typeselected=jQuery("#actioncode").val();
  757. var type=typeselected.split("_");
  758. if (type[1] == "RDV")
  759. {
  760. $("#jqfullday").css("display","table-row");
  761. $("#jqech").hide();
  762. $("#jqstart").show();
  763. $("#jqend").css("display","table-row");
  764. $("#jqloc").css("display","table-row");
  765. $(".fulldaystarthour").show();
  766. $(".fulldaystartmin").show();
  767. $(".fulldayendhour").show();
  768. $(".fulldayendmin").show();
  769. jQuery(".fulldaystartmin").val("00");
  770. jQuery(".fulldayendmin").val("00");
  771. $("#jqduration").hide();
  772. }
  773. else
  774. {
  775. $("#jqfullday").css("display","none");
  776. $("#jqech").show();
  777. $("#jqstart").hide();
  778. $("#jqend").css("display","none");
  779. $("#jqloc").css("display","none");
  780. $(".fulldayendhour").hide();
  781. $(".fulldayendmin").hide();
  782. jQuery(".fulldaystartmin").val("00");
  783. $("#jqduration").show();
  784. }
  785. }
  786. settype();
  787. jQuery("#actioncode").change(function() {
  788. settype();
  789. });
  790. })';
  791. print '</script>' . "\n";
  792. }
  793. // Fiche action en mode edition
  794. print '<form name="formaction" action="' . $_SERVER["PHP_SELF"] . '" method="post">';
  795. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  796. print '<input type="hidden" name="action" value="update">';
  797. print '<input type="hidden" name="id" value="' . $id . '">';
  798. print '<input type="hidden" name="ref_ext" value="' . $object->ref_ext . '">';
  799. print '<input type="hidden" id="actioncode" name="actioncode" value="' . $object->type_code . '">';
  800. if ($backtopage)
  801. print '<input type="hidden" name="backtopage" value="' . ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]) . '">';
  802. print '<table class="border" width="100%">';
  803. // Ref
  804. print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">' . $object->id . '</td></tr>';
  805. // Type
  806. print '<tr><td class="fieldrequired">' . ($object->type == 2 ? $langs->trans("Action") : $langs->trans("Event")) . '</td><td colspan="3">' . $object->print_fk_extrafields("type_code") . '</td></tr>';
  807. // Title
  808. print '<tr><td>' . $langs->trans("Title") . '</td><td colspan="3"><input type="text" name="label" size="50" value="' . $object->label . '"></td></tr>';
  809. // Full day
  810. print '<tr id="jqfullday"><td>' . $langs->trans("EventOnFullDay") . '</td><td><input type="checkbox" id="fullday" name="fullday" ' . (GETPOST('fullday') ? ' checked="checked"' : '') . '></td></tr>';
  811. // Date start
  812. $datep = $object->datep;
  813. if (GETPOST('datep', 'int', 1))
  814. $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
  815. print '<tr><td width="30%" nowrap="nowrap"><span class="fieldrequired" id="jqech">' . $langs->trans("DateEchAction") . '</span><span class="fieldrequired" id="jqstart">' . $langs->trans("DateActionStart") . '</span></td><td>';
  816. if (GETPOST("afaire") == 1)
  817. $form->select_date($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  818. else if (GETPOST("afaire") == 2)
  819. $form->select_date($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  820. // $html->select_date($datep,'ap',0,0,1,"action",1,1,0,0,'fulldaystart');
  821. $form->select_date($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldaystart', array('stepMinutes' => 30));
  822. print '</td></tr>';
  823. // Date end
  824. $datef = $object->datef;
  825. if (GETPOST('datef', 'int', 1))
  826. $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
  827. print '<tr id="jqend"><td>' . $langs->trans("DateActionEnd") . '</td><td>';
  828. if (GETPOST("afaire") == 1)
  829. $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  830. else if (GETPOST("afaire") == 2)
  831. $form->select_date($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  832. else
  833. $form->select_date($datef, 'p2', 1, 1, 0, "action", 1, 1, 0, 0, 'fulldayend', array('stepMinutes' => 30));
  834. print '</td></tr>';
  835. // duration task
  836. print '<tr id="jqduration"><td>' . $langs->trans("Duration") . '</td><td colspan="3">';
  837. //<input type="text" name="duration" size="3" value="' . (empty($object->durationp) ? 1 : $object->durationp / 3600) . '">
  838. $form->select_duration('duration', $object->durationp, 0, array('stepMinutes' => 30));
  839. print '</td></tr>';
  840. // Status
  841. print '<tr><td nowrap>' . $langs->trans("Status") . '</td><td colspan="3">';
  842. print $object->select_fk_extrafields('Status', 'status');
  843. print '</td></tr>';
  844. // Percentage
  845. if ($object->type_code != 'AC_RDV') {
  846. // Status
  847. print '<tr><td nowrap>' . $langs->trans("Percentage") . '</td><td colspan="3" style="height: 60px">';
  848. $percent = GETPOST("percentage") ? GETPOST("percentage") : $object->percentage;
  849. //print $htmlactions->form_select_status_action('formaction', $percent, 1);
  850. print '<p class="inline-medium-label button-height" style="padding-left: 0px; margin-top:10px">';
  851. print '<input type="text" size="2" class="input demo-slider mid-margin-right" value="' . $percent . '" id="demo-slider1" name="percentage">';
  852. print '</p>';
  853. print '</td></tr>';
  854. print '<script type="text/javascript" >
  855. jQuery(document).ready(function(){
  856. jQuery(".demo-slider").slider({
  857. "hideInput": false
  858. });
  859. });
  860. </script>';
  861. }
  862. if ($object->type_code == "AC_RDV") { //RDV
  863. // Location
  864. print '<tr><td>' . $langs->trans("Location") . '</td><td colspan="3"><input type="text" name="location" size="50" value="' . $object->location . '"></td></tr>';
  865. }
  866. print '</table><br><br><table class="border" width="100%">';
  867. // Input by
  868. $var = false;
  869. print '<tr><td width="30%" nowrap="nowrap">' . $langs->trans("ActionAskedBy") . '</td><td colspan="3">';
  870. print $object->print_fk_extrafields("author");
  871. print '</td></tr>';
  872. // Affected to
  873. print '<tr><td nowrap="nowrap">' . $langs->trans("ActionAffectedTo") . '</td><td colspan="3">';
  874. print $object->select_fk_extrafields("usertodo", 'affectedto');
  875. print '</td></tr>';
  876. // Realised by
  877. print '<tr><td nowrap="nowrap">' . $langs->trans("ActionDoneBy") . '</td><td colspan="3">';
  878. print $object->select_fk_extrafields("userdone", 'doneby');
  879. print '</td></tr>';
  880. print '</table><br><br>';
  881. print '<table class="border" width="100%">';
  882. // Company
  883. print '<tr><td width="30%">' . $langs->trans("ActionOnCompany") . '</td>';
  884. print '<td>';
  885. print $object->select_fk_extrafields('societe', 'socid');
  886. print '</td>';
  887. // Contact
  888. print '<td>' . $langs->trans("Contact") . '</td><td width="30%">';
  889. print $object->select_fk_extrafields('contact', 'contactid');
  890. //print $form->selectarray("contactid", (empty($object->societe->id) ? array() : $object->societe->contact_array()), $object->contact->id, 1);
  891. print '</td></tr>';
  892. // Lead
  893. if ($conf->lead->enabled) {
  894. // Lead associe
  895. $langs->load("lead");
  896. print '<tr><td valign="top">' . $langs->trans("Lead") . '</td><td colspan="3">';
  897. $numlead = select_leads($object->societe->id, $object->fk_lead, 'leadid');
  898. if ($numlead == 0) {
  899. print ' &nbsp; <a href="../../lead/fiche.php?socid=' . $object->societe->id . '&action=create">' . $langs->trans("AddLead") . '</a>';
  900. }
  901. print '</td></tr>';
  902. }
  903. // Project
  904. if ($conf->projet->enabled) {
  905. // Projet associe
  906. $langs->load("project");
  907. print '<tr><td valign="top">' . $langs->trans("Project") . '</td><td colspan="3">';
  908. $numprojet = select_projects($object->societe->id, $object->fk_project, 'projectid');
  909. if ($numprojet == 0) {
  910. print ' &nbsp; <a href="../../projet/fiche.php?socid=' . $object->societe->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
  911. }
  912. print '</td></tr>';
  913. }
  914. // Object linked
  915. if (!empty($object->fk_element) && !empty($object->elementtype)) {
  916. print '<tr><td>' . $langs->trans("LinkedObject") . '</td>';
  917. print '<td colspan="3">' . $object->getElementUrl($object->fk_element, $object->elementtype, 1) . '</td></tr>';
  918. }
  919. // Description
  920. print '<tr><td valign="top">' . $langs->trans("Description") . '</td><td colspan="3">';
  921. // Editeur wysiwyg
  922. require_once(DOL_DOCUMENT_ROOT . "/core/class/doleditor.class.php");
  923. $doleditor = new DolEditor('note', $object->notes, '', 240, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, 90);
  924. $doleditor->Create();
  925. print '</td></tr>';
  926. print '</table><br>';
  927. print '<center><input type="submit" class="button" name="edit" value="' . $langs->trans("Save") . '">';
  928. print ' &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
  929. print '</center>';
  930. print '</form>';
  931. print '</div>';
  932. } else {
  933. /**
  934. * Mode View
  935. */
  936. print '<table class="border" width="100%">';
  937. // Ref
  938. print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
  939. print $form->showrefnav($object, 'id', '', ($user->societe_id ? 0 : 1), 'id', 'ref', '');
  940. print '</td></tr>';
  941. // Type
  942. print '<tr><td>' . $langs->trans("Type") . '</td><td colspan="3">' . $object->print_fk_extrafields("type_code") . '</td></tr>';
  943. // Title
  944. print '<tr><td>' . $langs->trans("Title") . '</td><td colspan="3">' . $object->label . '</td></tr>';
  945. // Full day event
  946. print '<tr><td>' . $langs->trans("EventOnFullDay") . '</td><td colspan="3">' . yn($object->fulldayevent) . '</td></tr>';
  947. // Date start
  948. print '<tr><td width="30%">' . $langs->trans("DateActionStart") . '</td><td colspan="2">';
  949. if (!$object->fulldayevent)
  950. print dol_print_date($object->datep, 'dayhour');
  951. else
  952. print dol_print_date($object->datep, 'day');
  953. if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning))
  954. print img_warning($langs->trans("Late"));
  955. print '</td>';
  956. //if($object->type==1) //RDV
  957. //{
  958. print '<td rowspan="4" align="center" valign="middle" width="180">' . "\n";
  959. print '<form name="listactionsfiltermonth" action="' . DOL_URL_ROOT . '/comm/action/index.php" method="POST">';
  960. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  961. print '<input type="hidden" name="action" value="show_month">';
  962. print '<input type="hidden" name="year" value="' . dol_print_date($object->datep, '%Y') . '">';
  963. print '<input type="hidden" name="month" value="' . dol_print_date($object->datep, '%m') . '">';
  964. print '<input type="hidden" name="day" value="' . dol_print_date($object->datep, '%d') . '">';
  965. //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
  966. print img_picto($langs->trans("ViewCal"), 'object_calendar') . ' <input type="submit" style="width: 120px" class="button" name="viewcal" value="' . $langs->trans("ViewCal") . '">';
  967. print '</form>' . "\n";
  968. print '<form name="listactionsfilterweek" action="' . DOL_URL_ROOT . '/comm/action/index.php" method="POST">';
  969. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  970. print '<input type="hidden" name="action" value="show_week">';
  971. print '<input type="hidden" name="year" value="' . dol_print_date($object->datep, '%Y') . '">';
  972. print '<input type="hidden" name="month" value="' . dol_print_date($object->datep, '%m') . '">';
  973. print '<input type="hidden" name="day" value="' . dol_print_date($object->datep, '%d') . '">';
  974. //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
  975. print img_picto($langs->trans("ViewCal"), 'object_calendarweek') . ' <input type="submit" style="width: 120px" class="button" name="viewweek" value="' . $langs->trans("ViewWeek") . '">';
  976. print '</form>' . "\n";
  977. print '<form name="listactionsfilterday" action="' . DOL_URL_ROOT . '/comm/action/index.php" method="POST">';
  978. print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  979. print '<input type="hidden" name="action" value="show_day">';
  980. print '<input type="hidden" name="year" value="' . dol_print_date($object->datep, '%Y') . '">';
  981. print '<input type="hidden" name="month" value="' . dol_print_date($object->datep, '%m') . '">';
  982. print '<input type="hidden" name="day" value="' . dol_print_date($object->datep, '%d') . '">';
  983. //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
  984. print img_picto($langs->trans("ViewCal"), 'object_calendarday') . ' <input type="submit" style="width: 120px" class="button" name="viewday" value="' . $langs->trans("ViewDay") . '">';
  985. print '</form>' . "\n";
  986. print '</td>';
  987. print '</tr>';
  988. $var = !$var;
  989. // Date end
  990. print '<tr><td>' . $langs->trans("DateActionEnd") . '</td><td colspan="2">';
  991. if (!$object->fulldayevent)
  992. print dol_print_date($object->datef, 'dayhour');
  993. else
  994. print dol_print_date($object->datef, 'day');
  995. if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning))
  996. print img_warning($langs->trans("Late"));
  997. print '</td></tr>';
  998. // Status
  999. print '<tr><td nowrap>' . $langs->trans("Status") . ' / ' . $langs->trans("Percentage") . '</td><td colspan="2">';
  1000. print $object->getLibStatus();
  1001. print '</td></tr>';
  1002. // Percentage
  1003. if ($object->type_code != 'AC_RDV') {
  1004. print '<tr><td nowrap>' . $langs->trans("Percentage") . '</td><td colspan="2">';
  1005. print '<span style="width: 100px" class="progress anthracite thin">';
  1006. print '<span style="width: ' . $object->percentage . '%" class="progress-bar"></span>';
  1007. print '</span>';
  1008. print '</td></tr>';
  1009. }
  1010. $var = !$var;
  1011. // Location
  1012. print '<tr><td>' . $langs->trans("Location") . '</td><td colspan="2">' . $object->location . '</td></tr>';
  1013. print '</table><br><br><table class="border" width="100%">';
  1014. // Input by
  1015. $var = false;
  1016. print '<tr><td width="30%" nowrap="nowrap">' . $langs->trans("ActionAskedBy") . '</td><td colspan="3">';
  1017. print $object->print_fk_extrafields('author');
  1018. print '</td></tr>';
  1019. // Affecte a
  1020. print '<tr><td nowrap="nowrap">' . $langs->trans("ActionAffectedTo") . '</td><td colspan="3">';
  1021. print $object->print_fk_extrafields('usertodo');
  1022. print '</td></tr>';
  1023. // Done by
  1024. print '<tr><td nowrap="nowrap">' . $langs->trans("ActionDoneBy") . '</td><td colspan="3">';
  1025. print $object->print_fk_extrafields('userdone');
  1026. print '</td></tr>';
  1027. print '</table><br><br><table class="border" width="100%">';
  1028. // Third party - Contact
  1029. print '<tr><td width="30%">' . $langs->trans("ActionOnCompa…

Large files files are truncated, but you can click here to view the full file