card.php 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/projet/card.php
  21. * \ingroup projet
  22. * \brief Project card
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  32. $langs->load("projects");
  33. $langs->load('companies');
  34. $id=GETPOST('id','int');
  35. $ref=GETPOST('ref','alpha');
  36. $action=GETPOST('action','alpha');
  37. $backtopage=GETPOST('backtopage','alpha');
  38. $cancel=GETPOST('cancel','alpha');
  39. $status=GETPOST('status','int');
  40. $opp_status=GETPOST('opp_status','int');
  41. $opp_percent=price2num(GETPOST('opp_percent','alpha'));
  42. if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
  43. $mine = GETPOST('mode')=='mine' ? 1 : 0;
  44. //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
  45. // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
  46. $hookmanager->initHooks(array('projectcard','globalcard'));
  47. $object = new Project($db);
  48. $extrafields = new ExtraFields($db);
  49. // Load object
  50. //include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Can't use generic include because when creating a project, ref is defined and we dont want error if fetch fails from ref.
  51. if ($id > 0 || ! empty($ref))
  52. {
  53. $ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
  54. if ($ret > 0) {
  55. $object->fetch_thirdparty();
  56. $id=$object->id;
  57. }
  58. }
  59. // Security check
  60. $socid=GETPOST('socid');
  61. if ($user->societe_id > 0) $socid=$user->societe_id;
  62. $result = restrictedArea($user, 'projet', $object->id,'projet&project');
  63. // fetch optionals attributes and labels
  64. $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
  65. $date_start=dol_mktime(0,0,0,GETPOST('projectstartmonth','int'),GETPOST('projectstartday','int'),GETPOST('projectstartyear','int'));
  66. $date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendday','int'),GETPOST('projectendyear','int'));
  67. /*
  68. * Actions
  69. */
  70. $parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
  71. $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  72. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  73. if (empty($reshook))
  74. {
  75. // Cancel
  76. if ($cancel)
  77. {
  78. if (GETPOST("comefromclone")==1)
  79. {
  80. $result=$object->delete($user);
  81. if ($result > 0)
  82. {
  83. header("Location: index.php");
  84. exit;
  85. }
  86. else
  87. {
  88. dol_syslog($object->error,LOG_DEBUG);
  89. setEventMessages($langs->trans("CantRemoveProject"), null, 'errors');
  90. }
  91. }
  92. if ($backtopage)
  93. {
  94. header("Location: ".$backtopage);
  95. exit;
  96. }
  97. $action = '';
  98. }
  99. if ($action == 'add' && $user->rights->projet->creer)
  100. {
  101. $error=0;
  102. if (empty($_POST["ref"]))
  103. {
  104. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
  105. $error++;
  106. }
  107. if (empty($_POST["title"]))
  108. {
  109. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
  110. $error++;
  111. }
  112. if (! $error)
  113. {
  114. $error=0;
  115. $db->begin();
  116. $object->ref = GETPOST('ref','alpha');
  117. $object->title = GETPOST('title'); // Do not use 'alpha' here, we want field as it is
  118. $object->socid = GETPOST('socid','int');
  119. $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is
  120. $object->public = GETPOST('public','alpha');
  121. $object->opp_amount = price2num(GETPOST('opp_amount'));
  122. $object->budget_amount = price2num(GETPOST('budget_amount'));
  123. $object->datec=dol_now();
  124. $object->date_start=$date_start;
  125. $object->date_end=$date_end;
  126. $object->statuts = $status;
  127. $object->opp_status = $opp_status;
  128. $object->opp_percent = $opp_percent;
  129. // Fill array 'array_options' with data from add form
  130. $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
  131. if ($ret < 0) $error++;
  132. $result = $object->create($user);
  133. if (! $error && $result > 0)
  134. {
  135. // Add myself as project leader
  136. $result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
  137. if ($result < 0)
  138. {
  139. $langs->load("errors");
  140. setEventMessages($langs->trans($object->error), null, 'errors');
  141. $error++;
  142. }
  143. }
  144. else
  145. {
  146. $langs->load("errors");
  147. setEventMessages($langs->trans($object->error), null, 'errors');
  148. $error++;
  149. }
  150. if (! $error)
  151. {
  152. $db->commit();
  153. if ($backtopage)
  154. {
  155. header("Location: ".$backtopage.'&projectid='.$object->id);
  156. exit;
  157. }
  158. else
  159. {
  160. header("Location:card.php?id=".$object->id);
  161. exit;
  162. }
  163. }
  164. else
  165. {
  166. $db->rollback();
  167. $action = 'create';
  168. }
  169. }
  170. else
  171. {
  172. $action = 'create';
  173. }
  174. }
  175. if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
  176. {
  177. $error=0;
  178. if (empty($ref))
  179. {
  180. $error++;
  181. //$_GET["id"]=$_POST["id"]; // We return on the project card
  182. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
  183. }
  184. if (empty($_POST["title"]))
  185. {
  186. $error++;
  187. //$_GET["id"]=$_POST["id"]; // We return on the project card
  188. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
  189. }
  190. $db->begin();
  191. if (! $error)
  192. {
  193. $object->oldcopy = clone $object;
  194. $old_start_date = $object->date_start;
  195. $object->ref = GETPOST('ref','alpha');
  196. $object->title = GETPOST('title'); // Do not use 'alpha' here, we want field as it is
  197. $object->socid = GETPOST('socid','int');
  198. $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is
  199. $object->public = GETPOST('public','alpha');
  200. $object->date_start = empty($_POST["projectstart"])?'':$date_start;
  201. $object->date_end = empty($_POST["projectend"])?'':$date_end;
  202. if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount'));
  203. if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount'));
  204. if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
  205. if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent;
  206. // Fill array 'array_options' with data from add form
  207. $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
  208. if ($ret < 0) $error++;
  209. }
  210. if ($object->opp_amount && ($object->opp_status <= 0))
  211. {
  212. $error++;
  213. setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
  214. }
  215. if (! $error)
  216. {
  217. $result=$object->update($user);
  218. if ($result < 0)
  219. {
  220. $error++;
  221. setEventMessages($object->error, $object->errors,'errors');
  222. }
  223. }
  224. if (! $error)
  225. {
  226. if (GETPOST("reportdate") && ($object->date_start!=$old_start_date))
  227. {
  228. $result=$object->shiftTaskDate($old_start_date);
  229. if ($result < 0)
  230. {
  231. $error++;
  232. setEventMessages($langs->trans("ErrorShiftTaskDate").':'.$object->error, $langs->trans("ErrorShiftTaskDate").':'.$object->errors, 'errors');
  233. }
  234. }
  235. }
  236. if ($error)
  237. {
  238. $db->rollback();
  239. $action='edit';
  240. }
  241. else
  242. {
  243. $db->commit();
  244. if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int'));
  245. else unset($object->thirdparty);
  246. }
  247. }
  248. // Build doc
  249. if ($action == 'builddoc' && $user->rights->projet->creer)
  250. {
  251. // Save last template used to generate document
  252. if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
  253. $outputlangs = $langs;
  254. if (GETPOST('lang_id'))
  255. {
  256. $outputlangs = new Translate("",$conf);
  257. $outputlangs->setDefaultLang(GETPOST('lang_id'));
  258. }
  259. $result= $object->generateDocument($object->modelpdf, $outputlangs);
  260. if ($result <= 0)
  261. {
  262. setEventMessages($object->error, $object->errors, 'errors');
  263. $action='';
  264. }
  265. }
  266. // Delete file in doc form
  267. if ($action == 'remove_file' && $user->rights->projet->creer)
  268. {
  269. if ($object->id > 0)
  270. {
  271. require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
  272. $langs->load("other");
  273. $upload_dir = $conf->projet->dir_output;
  274. $file = $upload_dir . '/' . GETPOST('file');
  275. $ret = dol_delete_file($file, 0, 0, 0, $object);
  276. if ($ret)
  277. setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
  278. else
  279. setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
  280. $action = '';
  281. }
  282. }
  283. if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes')
  284. {
  285. $result = $object->setValid($user);
  286. if ($result <= 0)
  287. {
  288. setEventMessages($object->error, $object->errors, 'errors');
  289. }
  290. }
  291. if ($action == 'confirm_close' && GETPOST('confirm') == 'yes')
  292. {
  293. $result = $object->setClose($user);
  294. if ($result <= 0)
  295. {
  296. setEventMessages($object->error, $object->errors, 'errors');
  297. }
  298. }
  299. if ($action == 'confirm_reopen' && GETPOST('confirm') == 'yes')
  300. {
  301. $result = $object->setValid($user);
  302. if ($result <= 0)
  303. {
  304. setEventMessages($object->error, $object->errors, 'errors');
  305. }
  306. }
  307. if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->projet->supprimer)
  308. {
  309. $object->fetch($id);
  310. $result=$object->delete($user);
  311. if ($result > 0)
  312. {
  313. setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
  314. header("Location: index.php");
  315. exit;
  316. }
  317. else
  318. {
  319. dol_syslog($object->error,LOG_DEBUG);
  320. setEventMessages($object->error, $object->errors, 'errors');
  321. }
  322. }
  323. if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confirm') == 'yes')
  324. {
  325. $clone_contacts=GETPOST('clone_contacts')?1:0;
  326. $clone_tasks=GETPOST('clone_tasks')?1:0;
  327. $clone_project_files = GETPOST('clone_project_files') ? 1 : 0;
  328. $clone_task_files = GETPOST('clone_task_files') ? 1 : 0;
  329. $clone_notes=GETPOST('clone_notes')?1:0;
  330. $move_date=GETPOST('move_date')?1:0;
  331. $clone_thirdparty=GETPOST('socid','int')?GETPOST('socid','int'):0;
  332. $result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes,$move_date,0,$clone_thirdparty);
  333. if ($result <= 0)
  334. {
  335. setEventMessages($object->error, $object->errors, 'errors');
  336. }
  337. else
  338. {
  339. // Load new object
  340. $newobject=new Project($db);
  341. $newobject->fetch($result);
  342. $newobject->fetch_optionals();
  343. $newobject->fetch_thirdparty(); // Load new object
  344. $object=$newobject;
  345. $action='edit';
  346. $comefromclone=true;
  347. }
  348. }
  349. }
  350. /*
  351. * View
  352. */
  353. $form = new Form($db);
  354. $formfile = new FormFile($db);
  355. $formproject = new FormProjets($db);
  356. $userstatic = new User($db);
  357. $title=$langs->trans("Project").' - '.$object->ref.($object->thirdparty->name?' - '.$object->thirdparty->name:'').($object->title?' - '.$object->title:'');
  358. if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE)) $title=$object->ref.($object->thirdparty->name?' - '.$object->thirdparty->name:'').($object->title?' - '.$object->title:'');
  359. $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  360. llxHeader("",$title,$help_url);
  361. if ($action == 'create' && $user->rights->projet->creer)
  362. {
  363. /*
  364. * Create
  365. */
  366. $thirdparty=new Societe($db);
  367. if ($socid > 0) $thirdparty->fetch($socid);
  368. print load_fiche_titre($langs->trans("NewProject"), '', 'title_project');
  369. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  370. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  371. print '<input type="hidden" name="action" value="add">';
  372. print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
  373. dol_fiche_head();
  374. print '<table class="border" width="100%">';
  375. $defaultref='';
  376. $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
  377. // Search template files
  378. $file=''; $classname=''; $filefound=0;
  379. $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
  380. foreach($dirmodels as $reldir)
  381. {
  382. $file=dol_buildpath($reldir."core/modules/project/".$modele.'.php',0);
  383. if (file_exists($file))
  384. {
  385. $filefound=1;
  386. $classname = $modele;
  387. break;
  388. }
  389. }
  390. if ($filefound)
  391. {
  392. $result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
  393. $modProject = new $classname;
  394. $defaultref = $modProject->getNextValue($thirdparty,$object);
  395. }
  396. if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
  397. // Ref
  398. $suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref);
  399. print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.$suggestedref.'">';
  400. print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
  401. print '</td></tr>';
  402. // Label
  403. print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.GETPOST("title").'"></td></tr>';
  404. // Thirdparty
  405. if ($conf->societe->enabled)
  406. {
  407. print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
  408. $filteronlist='';
  409. if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
  410. $text=$form->select_thirdparty_list(GETPOST('socid','int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
  411. if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
  412. {
  413. $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
  414. print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
  415. }
  416. else print $text;
  417. print ' <a href="'.DOL_URL_ROOT.'/societe/soc.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
  418. print '</td></tr>';
  419. }
  420. // Status
  421. if ($status != '')
  422. {
  423. print '<tr><td>'.$langs->trans("Status").'</td><td>';
  424. print '<input type="hidden" name="status" value="'.$status.'">';
  425. print $object->LibStatut($status, 4);
  426. print '</td></tr>';
  427. }
  428. // Public
  429. print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
  430. $array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
  431. print $form->selectarray('public',$array,$object->public);
  432. print '</td></tr>';
  433. // Date start
  434. print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
  435. print $form->select_date(($date_start?$date_start:''),'projectstart',0,0,0,'',1,0,1);
  436. print '</td></tr>';
  437. // Date end
  438. print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
  439. print $form->select_date(($date_end?$date_end:-1),'projectend',0,0,0,'',1,0,1);
  440. print '</td></tr>';
  441. if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
  442. {
  443. // Opportunity status
  444. print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>';
  445. print '<td>';
  446. print $formproject->selectOpportunityStatus('opp_status',$object->opp_status);
  447. print '</tr>';
  448. // Opportunity probability
  449. print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
  450. print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(GETPOST('opp_percent')!=''?price(GETPOST('opp_percent')):'').'"> %';
  451. print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="'.(GETPOST('opp_percent')!=''?'0':'1').'">';
  452. print '</td>';
  453. print '</tr>';
  454. // Opportunity amount
  455. print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
  456. print '<td><input size="5" type="text" name="opp_amount" value="'.(GETPOST('opp_amount')!=''?price(GETPOST('opp_amount')):'').'"></td>';
  457. print '</tr>';
  458. }
  459. // Budget
  460. print '<tr><td>'.$langs->trans("Budget").'</td>';
  461. print '<td><input size="5" type="text" name="budget_amount" value="'.(GETPOST('budget_amount')!=''?price(GETPOST('budget_amount')):'').'"></td>';
  462. print '</tr>';
  463. // Description
  464. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
  465. print '<td>';
  466. print '<textarea name="description" wrap="soft" class="centpercent" rows="'.ROWS_3.'">'.$_POST["description"].'</textarea>';
  467. print '</td></tr>';
  468. // Other options
  469. $parameters=array();
  470. $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
  471. if (empty($reshook) && ! empty($extrafields->attribute_label))
  472. {
  473. print $object->showOptionals($extrafields,'edit');
  474. }
  475. print '</table>';
  476. dol_fiche_end();
  477. print '<div class="center">';
  478. print '<input type="submit" class="button" value="'.$langs->trans("CreateDraft").'">';
  479. if (! empty($backtopage))
  480. {
  481. print ' &nbsp; &nbsp; ';
  482. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  483. }
  484. print '</div>';
  485. print '</form>';
  486. // Change probability from status
  487. print '<script type="text/javascript" language="javascript">
  488. jQuery(document).ready(function() {
  489. function change_percent()
  490. {
  491. var element = jQuery("#opp_status option:selected");
  492. var defaultpercent = element.attr("defaultpercent");
  493. /*if (jQuery("#opp_percent_not_set").val() == "") */
  494. jQuery("#opp_percent").val(defaultpercent);
  495. }
  496. /*init_myfunc();*/
  497. jQuery("#opp_status").change(function() {
  498. change_percent();
  499. });
  500. });
  501. </script>';
  502. }
  503. else
  504. {
  505. /*
  506. * Show or edit
  507. */
  508. $res=$object->fetch_optionals($object->id,$extralabels);
  509. // To verify role of users
  510. $userAccess = $object->restrictedProjectArea($user,'read');
  511. $userWrite = $object->restrictedProjectArea($user,'write');
  512. $userDelete = $object->restrictedProjectArea($user,'delete');
  513. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  514. // Confirmation validation
  515. if ($action == 'validate')
  516. {
  517. print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
  518. }
  519. // Confirmation close
  520. if ($action == 'close')
  521. {
  522. print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1);
  523. }
  524. // Confirmation reopen
  525. if ($action == 'reopen')
  526. {
  527. print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1);
  528. }
  529. // Confirmation delete
  530. if ($action == 'delete')
  531. {
  532. $text=$langs->trans("ConfirmDeleteAProject");
  533. $task=new Task($db);
  534. $taskarray=$task->getTasksArray(0,0,$object->id,0,0);
  535. $nboftask=count($taskarray);
  536. if ($nboftask) $text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks",$nboftask);
  537. print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
  538. }
  539. // Clone confirmation
  540. if ($action == 'clone')
  541. {
  542. $formquestion=array(
  543. 'text' => $langs->trans("ConfirmClone"),
  544. array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int')>0?GETPOST('socid', 'int'):$object->socid, 'socid', '', "None")),
  545. array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
  546. array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
  547. array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
  548. array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true),
  549. array('type' => 'checkbox', 'name' => 'clone_project_files','label' => $langs->trans("CloneProjectFiles"), 'value' => false),
  550. array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
  551. );
  552. print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 300);
  553. }
  554. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  555. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  556. print '<input type="hidden" name="action" value="update">';
  557. print '<input type="hidden" name="id" value="'.$object->id.'">';
  558. print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">';
  559. $head=project_prepare_head($object);
  560. dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project'));
  561. if ($action == 'edit' && $userWrite > 0)
  562. {
  563. print '<table class="border" width="100%">';
  564. // Ref
  565. $suggestedref=$object->ref;
  566. print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Ref").'</td>';
  567. print '<td><input size="12" name="ref" value="'.$suggestedref.'">';
  568. print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
  569. print '</td></tr>';
  570. // Label
  571. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
  572. print '<td><input size="80" name="title" value="'.$object->title.'"></td></tr>';
  573. // Thirdparty
  574. if ($conf->societe->enabled)
  575. {
  576. print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
  577. $filteronlist='';
  578. if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
  579. $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
  580. if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
  581. {
  582. $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
  583. print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
  584. }
  585. else print $text;
  586. print '</td></tr>';
  587. }
  588. // Visibility
  589. print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
  590. $array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
  591. print $form->selectarray('public',$array,$object->public);
  592. print '</td></tr>';
  593. // Status
  594. print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
  595. // Date start
  596. print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
  597. print $form->select_date($object->date_start?$object->date_start:-1,'projectstart',0,0,0,'',1,0,1);
  598. print ' &nbsp; &nbsp; <input type="checkbox" name="reportdate" value="yes" ';
  599. if ($comefromclone){print ' checked ';}
  600. print '/> '. $langs->trans("ProjectReportDate");
  601. print '</td></tr>';
  602. // Date end
  603. print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
  604. print $form->select_date($object->date_end?$object->date_end:-1,'projectend',0,0,0,'',1,0,1);
  605. print '</td></tr>';
  606. if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
  607. {
  608. // Opportunity status
  609. print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>';
  610. print '<td>';
  611. print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1);
  612. print '</td>';
  613. print '</tr>';
  614. // Opportunity probability
  615. print '<tr><td>'.$langs->trans("OpportunityProbability").'</td>';
  616. print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="'.(isset($_POST['opp_percent'])?GETPOST('opp_percent'):(strcmp($object->opp_percent,'')?price($object->opp_percent,0,$langs,1,0):'')).'"> %';
  617. print '<span id="oldopppercent"></span>';
  618. print '</td>';
  619. print '</tr>';
  620. // Opportunity amount
  621. print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
  622. print '<td><input size="5" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount,0,$langs,1,0):'')).'"></td>';
  623. print '</tr>';
  624. }
  625. // Budget
  626. print '<tr><td>'.$langs->trans("Budget").'</td>';
  627. print '<td><input size="5" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount,0,$langs,1,0):'')).'"></td>';
  628. print '</tr>';
  629. // Description
  630. print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
  631. print '<td>';
  632. print '<textarea name="description" wrap="soft" class="centpercent" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
  633. print '</td></tr>';
  634. // Other options
  635. $parameters=array();
  636. $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
  637. if (empty($reshook) && ! empty($extrafields->attribute_label))
  638. {
  639. print $object->showOptionals($extrafields,'edit');
  640. }
  641. print '</table>';
  642. }
  643. else
  644. {
  645. print '<table class="border" width="100%">';
  646. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
  647. // Ref
  648. print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
  649. // Define a complementary filter for search of next/prev ref.
  650. if (! $user->rights->projet->all->lire)
  651. {
  652. $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
  653. $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
  654. }
  655. print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
  656. print '</td></tr>';
  657. // Label
  658. print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
  659. // Third party
  660. print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
  661. if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
  662. else print'&nbsp;';
  663. print '</td></tr>';
  664. // Visibility
  665. print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
  666. if ($object->public) print $langs->trans('SharedProject');
  667. else print $langs->trans('PrivateProject');
  668. print '</td></tr>';
  669. // Statut
  670. print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
  671. // Date start
  672. print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
  673. print dol_print_date($object->date_start,'day');
  674. print '</td></tr>';
  675. // Date end
  676. print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
  677. print dol_print_date($object->date_end,'day');
  678. print '</td></tr>';
  679. if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
  680. {
  681. // Opportunity status
  682. print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
  683. $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
  684. if ($code) print $langs->trans("OppStatus".$code);
  685. print '</td></tr>';
  686. // Opportunity percent
  687. print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
  688. if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
  689. print '</td></tr>';
  690. // Opportunity Amount
  691. print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
  692. if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency);
  693. print '</td></tr>';
  694. }
  695. // Budget
  696. print '<tr><td>'.$langs->trans("Budget").'</td><td>';
  697. if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
  698. print '</td></tr>';
  699. // Description
  700. print '<td class="tdtop">'.$langs->trans("Description").'</td><td>';
  701. print nl2br($object->description);
  702. print '</td></tr>';
  703. // Other options
  704. $parameters=array();
  705. $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
  706. if (empty($reshook) && ! empty($extrafields->attribute_label))
  707. {
  708. print $object->showOptionals($extrafields);
  709. }
  710. print '</table>';
  711. }
  712. dol_fiche_end();
  713. if ($action == 'edit' && $userWrite > 0)
  714. {
  715. print '<div align="center">';
  716. print '<input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'">&nbsp; &nbsp; &nbsp;';
  717. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  718. print '</div>';
  719. }
  720. print '</form>';
  721. // Change probability from status
  722. if (! empty($conf->use_javascript_ajax))
  723. {
  724. print '<script type="text/javascript" language="javascript">
  725. jQuery(document).ready(function() {
  726. function change_percent()
  727. {
  728. var element = jQuery("#opp_status option:selected");
  729. var defaultpercent = element.attr("defaultpercent");
  730. var elemcode = element.attr("elemcode");
  731. /* Change percent of default percent of new status is higher */
  732. if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent))
  733. {
  734. if (jQuery("#opp_percent").val() != \'\' && ! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->trans("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\');
  735. jQuery("#opp_percent").val(defaultpercent);
  736. }
  737. }
  738. /*init_myfunc();*/
  739. jQuery("#opp_status").change(function() {
  740. change_percent();
  741. });
  742. });
  743. </script>';
  744. }
  745. /*
  746. * Boutons actions
  747. */
  748. print '<div class="tabsAction">';
  749. $parameters = array();
  750. $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
  751. // modified by hook
  752. if (empty($reshook))
  753. {
  754. if ($action != "edit" )
  755. {
  756. // Modify
  757. if ($object->statut != 2 && $user->rights->projet->creer)
  758. {
  759. if ($userWrite > 0)
  760. {
  761. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>';
  762. }
  763. else
  764. {
  765. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a></div>';
  766. }
  767. }
  768. // Validate
  769. if ($object->statut == 0 && $user->rights->projet->creer)
  770. {
  771. if ($userWrite > 0)
  772. {
  773. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a></div>';
  774. }
  775. else
  776. {
  777. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a></div>';
  778. }
  779. }
  780. // Close
  781. if ($object->statut == 1 && $user->rights->projet->creer)
  782. {
  783. if ($userWrite > 0)
  784. {
  785. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=close">'.$langs->trans("Close").'</a></div>';
  786. }
  787. else
  788. {
  789. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Close').'</a></div>';
  790. }
  791. }
  792. // Reopen
  793. if ($object->statut == 2 && $user->rights->projet->creer)
  794. {
  795. if ($userWrite > 0)
  796. {
  797. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a></div>';
  798. }
  799. else
  800. {
  801. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ReOpen').'</a></div>';
  802. }
  803. }
  804. // Add button to create objects from project
  805. if (! empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON))
  806. {
  807. if (! empty($conf->propal->enabled) && $user->rights->propal->creer)
  808. {
  809. $langs->load("propal");
  810. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
  811. }
  812. if (! empty($conf->commande->enabled) && $user->rights->commande->creer)
  813. {
  814. $langs->load("orders");
  815. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateOrder").'</a></div>';
  816. }
  817. if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
  818. {
  819. $langs->load("bills");
  820. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>';
  821. }
  822. if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer)
  823. {
  824. $langs->load("supplier_proposal");
  825. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierProposal").'</a></div>';
  826. }
  827. if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer)
  828. {
  829. $langs->load("suppliers");
  830. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierOrder").'</a></div>';
  831. }
  832. if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer)
  833. {
  834. $langs->load("suppliers");
  835. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierInvoice").'</a></div>';
  836. }
  837. if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer)
  838. {
  839. $langs->load("interventions");
  840. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a></div>';
  841. }
  842. if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer)
  843. {
  844. $langs->load("contracts");
  845. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddContract").'</a></div>';
  846. }
  847. if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer)
  848. {
  849. $langs->load("trips");
  850. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddTrip").'</a></div>';
  851. }
  852. if (! empty($conf->don->enabled) && $user->rights->don->creer)
  853. {
  854. $langs->load("donations");
  855. print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddDonation").'</a></div>';
  856. }
  857. }
  858. // Clone
  859. if ($user->rights->projet->creer)
  860. {
  861. if ($userWrite > 0)
  862. {
  863. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=clone">'.$langs->trans('ToClone').'</a></div>';
  864. }
  865. else
  866. {
  867. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ToClone').'</a></div>';
  868. }
  869. }
  870. // Delete
  871. if ($user->rights->projet->supprimer || ($object->statut == 0 && $user->rights->projet->creer))
  872. {
  873. if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer))
  874. {
  875. print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a></div>';
  876. }
  877. else
  878. {
  879. print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Delete').'</a></div>';
  880. }
  881. }
  882. }
  883. }
  884. print "</div>";
  885. if ($action != 'presend')
  886. {
  887. print '<div class="fichecenter"><div class="fichehalfleft">';
  888. print '<a name="builddoc"></a>'; // ancre
  889. /*
  890. * Documents generes
  891. */
  892. $filename=dol_sanitizeFileName($object->ref);
  893. $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
  894. $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
  895. $genallowed=($user->rights->projet->lire && $userAccess > 0);
  896. $delallowed=($user->rights->projet->creer && $userWrite > 0);
  897. $var=true;
  898. $somethingshown=$formfile->show_documents('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
  899. print '</div><div class="fichehalfright"><div class="ficheaddleft">';
  900. if (!empty($object->id))
  901. {
  902. // List of actions on element
  903. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
  904. $formactions=new FormActions($db);
  905. $somethingshown=$formactions->showactions($object,'project',$socid);
  906. }
  907. print '</div></div></div>';
  908. }
  909. // Hook to add more things on page
  910. $parameters=array();
  911. $reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
  912. }
  913. llxFooter();
  914. $db->close();