conferenceorboothattendee_list.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. <?php
  2. /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file conferenceorboothattendee_list.php
  20. * \ingroup eventorganization
  21. * \brief List page for conferenceorboothattendee
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
  32. if ($conf->categorie->enabled) {
  33. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  34. }
  35. global $dolibarr_main_url_root;
  36. // for other modules
  37. //dol_include_once('/othermodule/class/otherobject.class.php');
  38. // Load translation files required by the page
  39. $langs->loadLangs(array("eventorganization", "other", "projects"));
  40. $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  41. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  42. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  43. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  44. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  45. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  46. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search
  47. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  48. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  49. $id = GETPOST('id', 'int');
  50. $conf_or_booth_id = GETPOST('conforboothid', 'int');
  51. $withproject = GETPOST('withproject', 'int');
  52. $fk_project = GETPOST('fk_project', 'int') ? GETPOST('fk_project', 'int') : GETPOST('projectid', 'int');
  53. $withProjectUrl='';
  54. // Load variable for pagination
  55. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  56. $sortfield = GETPOST('sortfield', 'aZ09comma');
  57. $sortorder = GETPOST('sortorder', 'aZ09comma');
  58. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  59. if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  60. $page = 0;
  61. } // If $page is not defined, or '' or -1 or if we click on clear filters
  62. $offset = $limit * $page;
  63. $pageprev = $page - 1;
  64. $pagenext = $page + 1;
  65. // Initialize technical objects
  66. $object = new ConferenceOrBoothAttendee($db);
  67. $extrafields = new ExtraFields($db);
  68. $projectstatic = new Project($db);
  69. $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
  70. $hookmanager->initHooks(array('conferenceorboothattendeelist')); // Note that conf->hooks_modules contains array
  71. // Fetch optionals attributes and labels
  72. $extrafields->fetch_name_optionals_label($object->table_element);
  73. //$extrafields->fetch_name_optionals_label($object->table_element_line);
  74. $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  75. // Default sort order (if not yet defined by previous GETPOST)
  76. if (!$sortfield) {
  77. reset($object->fields); // Reset is required to avoid key() to return null.
  78. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
  79. }
  80. if (!$sortorder) {
  81. $sortorder = "ASC";
  82. }
  83. // Initialize array of search criterias
  84. $search_all = GETPOST('search_all', 'alphanohtml');
  85. $search = array();
  86. foreach ($object->fields as $key => $val) {
  87. if (GETPOST('search_'.$key, 'alpha') !== '') {
  88. $search[$key] = GETPOST('search_'.$key, 'alpha');
  89. }
  90. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  91. $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
  92. $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
  93. }
  94. }
  95. // List of fields to search into when doing a "search in all"
  96. $fieldstosearchall = array();
  97. foreach ($object->fields as $key => $val) {
  98. if (!empty($val['searchall'])) {
  99. $fieldstosearchall['t.'.$key] = $val['label'];
  100. }
  101. }
  102. // Definition of array of fields for columns
  103. $arrayfields = array();
  104. foreach ($object->fields as $key => $val) {
  105. // If $val['visible']==0, then we never show the field
  106. if (!empty($val['visible'])) {
  107. $visible = (int) dol_eval($val['visible'], 1, 1, '1');
  108. $arrayfields['t.'.$key] = array(
  109. 'label'=>$val['label'],
  110. 'checked'=>(($visible < 0) ? 0 : 1),
  111. 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
  112. 'position'=>$val['position'],
  113. 'help'=> isset($val['help']) ? $val['help'] : ''
  114. );
  115. }
  116. }
  117. // Extra fields
  118. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
  119. $object->fields = dol_sort_array($object->fields, 'position');
  120. $arrayfields = dol_sort_array($arrayfields, 'position');
  121. $permissiontoread = $user->rights->eventorganization->read;
  122. $permissiontoadd = $user->rights->eventorganization->write;
  123. $permissiontodelete = $user->rights->eventorganization->delete;
  124. // Security check
  125. if (empty($conf->eventorganization->enabled)) {
  126. accessforbidden('Module not enabled');
  127. }
  128. $socid = 0;
  129. if ($user->socid > 0) { // Protection if external user
  130. //$socid = $user->socid;
  131. accessforbidden();
  132. }
  133. $result = restrictedArea($user, 'eventorganization');
  134. if (!$permissiontoread) accessforbidden();
  135. /*
  136. * Actions
  137. */
  138. if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
  139. $project = new Project($db);
  140. //If "set" fields keys is in projects fields
  141. $project_attr=preg_replace('/^set/', '', $action);
  142. if (array_key_exists($project_attr, $project->fields)) {
  143. $result = $project->fetch($projectid);
  144. if ($result < 0) {
  145. setEventMessages(null, $project->errors, 'errors');
  146. } else {
  147. $project->{$project_attr}=GETPOST($project_attr);
  148. $result=$project->update($user);
  149. if ($result < 0) {
  150. setEventMessages(null, $project->errors, 'errors');
  151. }
  152. }
  153. }
  154. }
  155. if (GETPOST('cancel', 'alpha')) {
  156. $action = 'list';
  157. $massaction = '';
  158. }
  159. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend'
  160. && $massaction != 'presend'
  161. && $massaction != 'confirm_presend') {
  162. $massaction = '';
  163. }
  164. $parameters = array();
  165. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  166. if ($reshook < 0) {
  167. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  168. }
  169. if (empty($reshook)) {
  170. // Selection of new fields
  171. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  172. // Purge search criteria
  173. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  174. foreach ($object->fields as $key => $val) {
  175. $search[$key] = '';
  176. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  177. $search[$key.'_dtstart'] = '';
  178. $search[$key.'_dtend'] = '';
  179. }
  180. }
  181. $toselect = array();
  182. $search_array_options = array();
  183. }
  184. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
  185. || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
  186. $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  187. }
  188. // Mass actions
  189. $objectclass = 'ConferenceOrBoothAttendee';
  190. $objectlabel = 'ConferenceOrBoothAttendee';
  191. $uploaddir = $conf->eventorganization->dir_output;
  192. include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
  193. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  194. }
  195. /*
  196. * View
  197. */
  198. $form = new Form($db);
  199. $now = dol_now();
  200. //$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
  201. $help_url = '';
  202. if ($confOrBooth->id > 0) {
  203. $title = $langs->trans('ListOfAttendeesPerConference');
  204. } else {
  205. $title = $langs->trans('ListOfAttendeesOfEvent');
  206. }
  207. $morejs = array();
  208. $morecss = array();
  209. $confOrBooth = new ConferenceOrBooth($db);
  210. if ($conf_or_booth_id > 0) {
  211. $result = $confOrBooth->fetch($conf_or_booth_id);
  212. if ($result < 0) {
  213. setEventMessages(null, $confOrBooth->errors, 'errors');
  214. } else {
  215. $fk_project = $confOrBooth->fk_project;
  216. }
  217. }
  218. if ($fk_project > 0) {
  219. $result = $projectstatic->fetch($fk_project);
  220. if ($result < 0) {
  221. setEventMessages(null, $projectstatic->errors, 'errors');
  222. }
  223. }
  224. // Build and execute select
  225. // --------------------------------------------------------------------
  226. $sql = 'SELECT ';
  227. $sql .= $object->getFieldList('t');
  228. // Add fields from extrafields
  229. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  230. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  231. $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
  232. }
  233. }
  234. // Add fields from hooks
  235. $parameters = array();
  236. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
  237. $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
  238. $sql = preg_replace('/,\s*$/', '', $sql);
  239. $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
  240. if (!empty($confOrBooth->id)) {
  241. $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
  242. }
  243. if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
  244. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
  245. }
  246. // Add table from hooks
  247. $parameters = array();
  248. $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
  249. $sql .= $hookmanager->resPrint;
  250. if ($object->ismultientitymanaged == 1) {
  251. $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
  252. } else {
  253. $sql .= " WHERE 1 = 1";
  254. }
  255. if (!empty($projectstatic->id)) {
  256. $sql .= " AND t.fk_project=".((int) $projectstatic->id);
  257. }
  258. foreach ($search as $key => $val) {
  259. if (array_key_exists($key, $object->fields)) {
  260. if ($key == 'status' && $search[$key] == -1) {
  261. continue;
  262. }
  263. $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
  264. if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
  265. if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
  266. $search[$key] = '';
  267. }
  268. $mode_search = 2;
  269. }
  270. if ($search[$key] != '') {
  271. $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
  272. }
  273. } else {
  274. if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
  275. $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
  276. if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
  277. if (preg_match('/_dtstart$/', $key)) {
  278. $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
  279. }
  280. if (preg_match('/_dtend$/', $key)) {
  281. $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
  282. }
  283. }
  284. }
  285. }
  286. }
  287. if ($search_all) {
  288. $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
  289. }
  290. //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
  291. // Add where from extra fields
  292. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  293. // Add where from hooks
  294. $parameters = array();
  295. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
  296. $sql .= $hookmanager->resPrint;
  297. $sql .= $db->order($sortfield, $sortorder);
  298. // Count total nb of records
  299. $nbtotalofrecords = '';
  300. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
  301. $resql = $db->query($sql);
  302. $nbtotalofrecords = $db->num_rows($resql);
  303. if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
  304. $page = 0;
  305. $offset = 0;
  306. }
  307. }
  308. // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
  309. if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
  310. $num = $nbtotalofrecords;
  311. } else {
  312. if ($limit) {
  313. $sql .= $db->plimit($limit + 1, $offset);
  314. }
  315. $resql = $db->query($sql);
  316. if (!$resql) {
  317. dol_print_error($db);
  318. exit;
  319. }
  320. $num = $db->num_rows($resql);
  321. }
  322. // Direct jump if only one record found
  323. if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
  324. $obj = $db->fetch_object($resql);
  325. $id = $obj->rowid;
  326. header("Location: ".dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.$id);
  327. exit;
  328. }
  329. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
  330. if ($projectstatic->id > 0 || $confOrBooth > 0) {
  331. if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
  332. $projectstatic->fetchComments();
  333. }
  334. if (!empty($projectstatic->socid)) {
  335. $projectstatic->fetch_thirdparty();
  336. }
  337. $withProjectUrl='';
  338. $object->project = clone $projectstatic;
  339. if (!empty($withproject)) {
  340. // Tabs for project
  341. $tab = 'eventorganisation';
  342. $withProjectUrl = "&withproject=1";
  343. $head = project_prepare_head($projectstatic);
  344. print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
  345. $param = ($mode == 'mine' ? '&mode=mine' : '');
  346. // Project card
  347. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  348. $morehtmlref = '<div class="refidno">';
  349. // Title
  350. $morehtmlref .= $projectstatic->title;
  351. // Thirdparty
  352. if ($projectstatic->thirdparty->id > 0) {
  353. $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
  354. }
  355. $morehtmlref .= '</div>';
  356. // Define a complementary filter for search of next/prev ref.
  357. if (empty($user->rights->projet->all->lire)) {
  358. $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
  359. $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
  360. }
  361. dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  362. print '<div class="fichecenter">';
  363. print '<div class="fichehalfleft">';
  364. print '<div class="underbanner clearboth"></div>';
  365. print '<table class="border tableforfield centpercent">';
  366. // Usage
  367. if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
  368. print '<tr><td class="tdtop">';
  369. print $langs->trans("Usage");
  370. print '</td>';
  371. print '<td>';
  372. if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
  373. print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
  374. $htmltext = $langs->trans("ProjectFollowOpportunity");
  375. print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
  376. print '<br>';
  377. }
  378. if (empty($conf->global->PROJECT_HIDE_TASKS)) {
  379. print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
  380. $htmltext = $langs->trans("ProjectFollowTasks");
  381. print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
  382. print '<br>';
  383. }
  384. if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
  385. print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
  386. $htmltext = $langs->trans("ProjectBillTimeDescription");
  387. print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
  388. print '<br>';
  389. }
  390. if (!empty($conf->eventorganization->enabled)) {
  391. print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
  392. $htmltext = $langs->trans("EventOrganizationDescriptionLong");
  393. print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
  394. }
  395. print '</td></tr>';
  396. }
  397. // Visibility
  398. print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
  399. if ($projectstatic->public) {
  400. print $langs->trans('SharedProject');
  401. } else {
  402. print $langs->trans('PrivateProject');
  403. }
  404. print '</td></tr>';
  405. // Date start - end
  406. print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
  407. $start = dol_print_date($projectstatic->date_start, 'day');
  408. print ($start ? $start : '?');
  409. $end = dol_print_date($projectstatic->date_end, 'day');
  410. print ' - ';
  411. print ($end ? $end : '?');
  412. if ($projectstatic->hasDelay()) {
  413. print img_warning("Late");
  414. }
  415. print '</td></tr>';
  416. // Budget
  417. print '<tr><td>'.$langs->trans("Budget").'</td><td>';
  418. if (strcmp($projectstatic->budget_amount, '')) {
  419. print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
  420. }
  421. print '</td></tr>';
  422. // Other attributes
  423. $cols = 2;
  424. $objectconf = $object;
  425. $object = $projectstatic;
  426. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  427. $object = $objectconf;
  428. print '</table>';
  429. print '</div>';
  430. print '<div class="fichehalfright">';
  431. print '<div class="underbanner clearboth"></div>';
  432. print '<table class="border tableforfield centpercent">';
  433. // Description
  434. print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
  435. print nl2br($projectstatic->description);
  436. print '</td></tr>';
  437. // Categories
  438. if ($conf->categorie->enabled) {
  439. print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
  440. print $form->showCategories($projectstatic->id, 'project', 1);
  441. print "</td></tr>";
  442. }
  443. print '<tr><td class="nowrap">';
  444. $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
  445. $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
  446. print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
  447. print '</td><td>';
  448. print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
  449. print "</td></tr>";
  450. print '<tr><td>';
  451. $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
  452. $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
  453. print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
  454. print '</td><td>';
  455. print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
  456. print "</td></tr>";
  457. print '<tr><td>';
  458. print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
  459. print '</td><td>';
  460. print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
  461. print "</td></tr>";
  462. print '<tr><td>';
  463. print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
  464. print '</td><td>';
  465. print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
  466. print "</td></tr>";
  467. print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
  468. // Define $urlwithroot
  469. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  470. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
  471. // Show message
  472. $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
  473. $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
  474. $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
  475. print $message;
  476. print "</td></tr>";
  477. // Link to the submit vote/register page
  478. print '<tr><td>';
  479. //print '<span class="opacitymedium">';
  480. print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
  481. //print '</span>';
  482. print '</td><td>';
  483. $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
  484. $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
  485. $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
  486. //print '<div class="urllink">';
  487. //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
  488. print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
  489. print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
  490. //print '</div>';
  491. //print ajax_autoselect("linkregister");
  492. print '</td></tr>';
  493. // Link to the subscribe
  494. print '<tr><td>';
  495. //print '<span class="opacitymedium">';
  496. print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
  497. //print '</span>';
  498. print '</td><td>';
  499. $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
  500. $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
  501. $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
  502. //print '<div class="urllink">';
  503. //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
  504. print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
  505. print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
  506. //print '</div>';
  507. //print ajax_autoselect("linkregister");
  508. print '</td></tr>';
  509. print '</table>';
  510. print '</div>';
  511. print '</div>';
  512. print '<div class="clearboth"></div>';
  513. print dol_get_fiche_end();
  514. if (empty($confOrBooth->id)) {
  515. $head = conferenceorboothProjectPrepareHead($projectstatic);
  516. $tab = 'attendees';
  517. print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
  518. }
  519. }
  520. if ($confOrBooth->id > 0) {
  521. $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
  522. print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
  523. $object_evt = $object;
  524. $object = $confOrBooth;
  525. dol_banner_tab($object, 'ref', '', 0);
  526. print '<div class="fichecenter">';
  527. print '<div class="fichehalfleft">';
  528. print '<div class="underbanner clearboth"></div>';
  529. print '<table class="border centpercent tableforfield">' . "\n";
  530. include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
  531. // Other attributes. Fields from hook formObjectOptions and Extrafields.
  532. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
  533. $object = $object_evt;
  534. print '</table>';
  535. print '</div>';
  536. print '</div>';
  537. print '<div class="clearboth"></div>';
  538. print dol_get_fiche_end();
  539. }
  540. }
  541. $arrayofselected = is_array($toselect) ? $toselect : array();
  542. $param = '';
  543. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  544. $param .= '&contextpage='.urlencode($contextpage);
  545. }
  546. if ($limit > 0 && $limit != $conf->liste_limit) {
  547. $param .= '&limit='.urlencode($limit);
  548. }
  549. foreach ($search as $key => $val) {
  550. if (is_array($search[$key]) && count($search[$key])) {
  551. foreach ($search[$key] as $skey) {
  552. if ($skey != '') {
  553. $param .= '&search_'.$key.'[]='.urlencode($skey);
  554. }
  555. }
  556. } elseif ($search[$key] != '') {
  557. $param .= '&search_'.$key.'='.urlencode($search[$key]);
  558. }
  559. }
  560. if ($confOrBooth->id > 0) {
  561. $param .= '&conforboothid='.urlencode($confOrBooth->id);
  562. }
  563. if ($projectstatic->id > 0) {
  564. $param .= '&fk_project='.urlencode($projectstatic->id);
  565. }
  566. $param .= $withProjectUrl;
  567. if ($optioncss != '') {
  568. $param .= '&optioncss='.urlencode($optioncss);
  569. }
  570. // Add $param from extra fields
  571. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  572. // Add $param from hooks
  573. $parameters = array();
  574. $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
  575. $param .= $hookmanager->resPrint;
  576. // List of mass actions available
  577. $arrayofmassactions = array(
  578. //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
  579. //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
  580. //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
  581. 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
  582. );
  583. if ($permissiontodelete) {
  584. $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
  585. }
  586. if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
  587. $arrayofmassactions = array();
  588. }
  589. $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
  590. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($conf_or_booth_id)?'?conforboothid='.$conf_or_booth_id:'').'">'."\n";
  591. if ($optioncss != '') {
  592. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  593. }
  594. print '<input type="hidden" name="token" value="'.newToken().'">';
  595. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  596. print '<input type="hidden" name="action" value="list">';
  597. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  598. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  599. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  600. print '<input type="hidden" name="withproject" value="'.$withproject.'">';
  601. print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
  602. print '<input type="hidden" name="page_y" value="">';
  603. $params = array('morecss'=>'reposition');
  604. $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params);
  605. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
  606. // Add code for pre mass action (confirmation or email presend form)
  607. $topicmail = $projectstatic->title;
  608. $modelmail = "conferenceorbooth";
  609. $objecttmp = new ConferenceOrBoothAttendee($db);
  610. $trackid = 'conferenceorbooth_'.$object->id;
  611. $withmaindocfilemail = 0;
  612. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  613. if ($search_all) {
  614. foreach ($fieldstosearchall as $key => $val) {
  615. $fieldstosearchall[$key] = $langs->trans($val);
  616. }
  617. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
  618. }
  619. $moreforfilter = '';
  620. /*$moreforfilter.='<div class="divsearchfield">';
  621. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  622. $moreforfilter.= '</div>';*/
  623. $parameters = array();
  624. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  625. if (empty($reshook)) {
  626. $moreforfilter .= $hookmanager->resPrint;
  627. } else {
  628. $moreforfilter = $hookmanager->resPrint;
  629. }
  630. if (!empty($moreforfilter)) {
  631. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  632. print $moreforfilter;
  633. print '</div>';
  634. }
  635. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  636. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  637. $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  638. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  639. print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  640. // Fields title search
  641. // --------------------------------------------------------------------
  642. print '<tr class="liste_titre">';
  643. foreach ($object->fields as $key => $val) {
  644. $cssforfield = (empty($val['css']) ? '' : $val['css']);
  645. if ($key == 'status') {
  646. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  647. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  648. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  649. } elseif (in_array($val['type'], array('timestamp'))) {
  650. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  651. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
  652. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  653. }
  654. if (!empty($arrayfields['t.'.$key]['checked'])) {
  655. print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
  656. if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
  657. print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
  658. } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
  659. print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
  660. } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  661. print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
  662. } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  663. print '<div class="nowrap">';
  664. print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
  665. print '</div>';
  666. print '<div class="nowrap">';
  667. print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
  668. print '</div>';
  669. }
  670. print '</td>';
  671. }
  672. }
  673. // Extra fields
  674. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  675. // Fields from hook
  676. $parameters = array('arrayfields'=>$arrayfields);
  677. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
  678. print $hookmanager->resPrint;
  679. // Action column
  680. print '<td class="liste_titre maxwidthsearch">';
  681. $searchpicto = $form->showFilterButtons();
  682. print $searchpicto;
  683. print '</td>';
  684. print '</tr>'."\n";
  685. // Fields title label
  686. // --------------------------------------------------------------------
  687. print '<tr class="liste_titre">';
  688. foreach ($object->fields as $key => $val) {
  689. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  690. if ($key == 'status') {
  691. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  692. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  693. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  694. } elseif (in_array($val['type'], array('timestamp'))) {
  695. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  696. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
  697. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  698. }
  699. if (!empty($arrayfields['t.'.$key]['checked'])) {
  700. print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
  701. }
  702. }
  703. // Extra fields
  704. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  705. // Hook fields
  706. $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
  707. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  708. print $hookmanager->resPrint;
  709. // Action column
  710. print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
  711. print '</tr>'."\n";
  712. // Detect if we need a fetch on each output line
  713. $needToFetchEachLine = 0;
  714. if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
  715. foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
  716. if (preg_match('/\$object/', $val)) {
  717. $needToFetchEachLine++; // There is at least one compute field that use $object
  718. }
  719. }
  720. }
  721. // Loop on record
  722. // --------------------------------------------------------------------
  723. $i = 0;
  724. $totalarray = array();
  725. while ($i < ($limit ? min($num, $limit) : $num)) {
  726. $obj = $db->fetch_object($resql);
  727. if (empty($obj)) {
  728. break; // Should not happen
  729. }
  730. // Store properties in $object
  731. $object->setVarsFromFetchObj($obj);
  732. // Show here line of result
  733. print '<tr class="oddeven">';
  734. foreach ($object->fields as $key => $val) {
  735. $cssforfield = (empty($val['css']) ? '' : $val['css']);
  736. if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  737. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  738. } elseif ($key == 'status') {
  739. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  740. }
  741. if (in_array($val['type'], array('timestamp'))) {
  742. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left';
  743. } elseif ($key == 'ref') {
  744. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  745. }
  746. if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) {
  747. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  748. }
  749. //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
  750. if (!empty($arrayfields['t.'.$key]['checked'])) {
  751. print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
  752. if ($key == 'status') {
  753. print $object->getLibStatut(5);
  754. } elseif ($key == 'ref') {
  755. $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
  756. if (empty($confOrBooth->id)) {
  757. $optionLink='projectid';
  758. }
  759. print $object->getNomUrl(1, $optionLink);
  760. } else {
  761. print $object->showOutputField($val, $key, $object->$key, '');
  762. }
  763. print '</td>';
  764. if (!$i) {
  765. $totalarray['nbfield']++;
  766. }
  767. if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
  768. if (!$i) {
  769. $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
  770. }
  771. if (!isset($totalarray['val'])) {
  772. $totalarray['val'] = array();
  773. }
  774. if (!isset($totalarray['val']['t.'.$key])) {
  775. $totalarray['val']['t.'.$key] = 0;
  776. }
  777. $totalarray['val']['t.'.$key] += $object->$key;
  778. }
  779. }
  780. }
  781. // Extra fields
  782. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  783. // Fields from hook
  784. $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
  785. $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
  786. print $hookmanager->resPrint;
  787. // Action column
  788. print '<td class="nowrap center">';
  789. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  790. $selected = 0;
  791. if (in_array($object->id, $arrayofselected)) {
  792. $selected = 1;
  793. }
  794. print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  795. }
  796. print '</td>';
  797. if (!$i) {
  798. $totalarray['nbfield']++;
  799. }
  800. print '</tr>'."\n";
  801. $i++;
  802. }
  803. // Show total line
  804. include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
  805. // If no record found
  806. if ($num == 0) {
  807. $colspan = 1;
  808. foreach ($arrayfields as $key => $val) {
  809. if (!empty($val['checked'])) {
  810. $colspan++;
  811. }
  812. }
  813. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  814. }
  815. $db->free($resql);
  816. $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
  817. $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
  818. print $hookmanager->resPrint;
  819. print '</table>'."\n";
  820. print '</div>'."\n";
  821. print '</form>'."\n";
  822. if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
  823. $hidegeneratedfilelistifempty = 1;
  824. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
  825. $hidegeneratedfilelistifempty = 0;
  826. }
  827. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  828. $formfile = new FormFile($db);
  829. // Show list of available documents
  830. $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
  831. $urlsource .= str_replace('&amp;', '&', $param);
  832. $filedir = $diroutputmassaction;
  833. $genallowed = $permissiontoread;
  834. $delallowed = $permissiontoadd;
  835. print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
  836. }
  837. // End of page
  838. llxFooter();
  839. $db->close();