recruitmentcandidature_list.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. <?php
  2. /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file recruitmentcandidature_list.php
  19. * \ingroup recruitment
  20. * \brief List page for recruitmentcandidature
  21. */
  22. // Load Dolibarr environment
  23. require_once '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentjobposition.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
  31. // Load translation files required by the page
  32. $langs->loadLangs(array("recruitment", "other"));
  33. $id = GETPOST('id', 'int');
  34. $ref = GETPOST('ref', 'alpha');
  35. $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  36. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  37. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  38. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  39. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  40. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  41. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : ((empty($id) && empty($ref)) ? 'recruitmentcandidaturelist' : 'recruitmentjobposition_candidature'); // To manage different context of search
  42. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  43. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  44. $mode = GETPOST('mode', 'aZ');
  45. $lineid = GETPOST('lineid', 'int');
  46. // Load variable for pagination
  47. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  48. $sortfield = GETPOST('sortfield', 'aZ09comma');
  49. $sortorder = GETPOST('sortorder', 'aZ09comma');
  50. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  51. if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  52. // If $page is not defined, or '' or -1 or if we click on clear filters
  53. $page = 0;
  54. }
  55. $offset = $limit * $page;
  56. $pageprev = $page - 1;
  57. $pagenext = $page + 1;
  58. // Initialize technical objects
  59. $object = new RecruitmentCandidature($db);
  60. $extrafields = new ExtraFields($db);
  61. $diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id;
  62. $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
  63. // Fetch optionals attributes and labels
  64. $extrafields->fetch_name_optionals_label($object->table_element);
  65. //$extrafields->fetch_name_optionals_label($object->table_element_line);
  66. $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  67. // Default sort order (if not yet defined by previous GETPOST)
  68. if (!$sortfield) {
  69. $sortfield = "t.date_creation"; // Set here default search field. By default 1st field in definition.
  70. }
  71. if (!$sortorder) {
  72. $sortorder = "DESC";
  73. }
  74. // Initialize array of search criterias
  75. $search_all = GETPOST('search_all', 'alphanohtml');
  76. $search = array();
  77. foreach ($object->fields as $key => $val) {
  78. if (GETPOST('search_'.$key, 'alpha') !== '') {
  79. $search[$key] = GETPOST('search_'.$key, 'alpha');
  80. }
  81. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  82. $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
  83. $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
  84. }
  85. }
  86. // List of fields to search into when doing a "search in all"
  87. $fieldstosearchall = array();
  88. foreach ($object->fields as $key => $val) {
  89. if (!empty($val['searchall'])) {
  90. $fieldstosearchall['t.'.$key] = $val['label'];
  91. }
  92. }
  93. /*$parameters = array('fieldstosearchall'=>$fieldstosearchall);
  94. $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  95. if ($reshook > 0) {
  96. $fieldstosearchall = $hookmanager->resArray['fieldstosearchall'];
  97. } elseif ($reshook == 0) {
  98. $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']);
  99. }*/
  100. // Definition of array of fields for columns
  101. $arrayfields = array();
  102. foreach ($object->fields as $key => $val) {
  103. // If $val['visible']==0, then we never show the field
  104. if (!empty($val['visible'])) {
  105. $visible = (int) dol_eval($val['visible'], 1);
  106. $arrayfields['t.'.$key] = array(
  107. 'label'=>$val['label'],
  108. 'checked'=>(($visible < 0) ? 0 : 1),
  109. 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
  110. 'position'=>$val['position'],
  111. 'help'=> isset($val['help']) ? $val['help'] : ''
  112. );
  113. }
  114. }
  115. // Extra fields
  116. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
  117. // Load object
  118. $jobposition = new RecruitmentJobPosition($db);
  119. if ($id > 0 || !empty($ref)) {
  120. $jobposition->fetch($id, $ref);
  121. $id = $jobposition->id;
  122. }
  123. $object->fields = dol_sort_array($object->fields, 'position');
  124. $arrayfields = dol_sort_array($arrayfields, 'position');
  125. $permissiontoread = $user->rights->recruitment->recruitmentjobposition->read;
  126. $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write;
  127. $permissiontodelete = $user->rights->recruitment->recruitmentjobposition->delete;
  128. // Security check - Protection if external user
  129. //if ($user->socid > 0) accessforbidden();
  130. //if ($user->socid > 0) $socid = $user->socid;
  131. //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
  132. if ($jobposition->id > 0) {
  133. $isdraft = (($jobposition->status == $jobposition::STATUS_DRAFT) ? 1 : 0);
  134. $result = restrictedArea($user, 'recruitment', $jobposition->id, 'recruitment_recruitmentjobposition', 'recruitmentjobposition', '', 'rowid', $isdraft);
  135. } else {
  136. $result = restrictedArea($user, 'recruitment', 0, 'recruitment_recruitmentcandidature', 'recruitmentjobposition');
  137. }
  138. /*
  139. * Actions
  140. */
  141. if (GETPOST('cancel', 'alpha')) {
  142. $action = 'list';
  143. $massaction = '';
  144. }
  145. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  146. $massaction = '';
  147. }
  148. $parameters = array();
  149. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  150. if ($reshook < 0) {
  151. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  152. }
  153. if (empty($reshook)) {
  154. // Selection of new fields
  155. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  156. // Purge search criteria
  157. 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
  158. foreach ($object->fields as $key => $val) {
  159. $search[$key] = '';
  160. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  161. $search[$key.'_dtstart'] = '';
  162. $search[$key.'_dtend'] = '';
  163. }
  164. }
  165. $toselect = array();
  166. $search_array_options = array();
  167. }
  168. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
  169. || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
  170. $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  171. }
  172. // Mass actions
  173. $objectclass = 'RecruitmentCandidature';
  174. $objectlabel = 'RecruitmentCandidature';
  175. $uploaddir = $conf->recruitment->dir_output;
  176. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  177. }
  178. /*
  179. * View
  180. */
  181. $form = new Form($db);
  182. $now = dol_now();
  183. //$help_url="EN:Module_RecruitmentCandidature|FR:Module_RecruitmentCandidature_FR|ES:Módulo_RecruitmentCandidature";
  184. $help_url = '';
  185. $title = $langs->trans('RecruitmentCandidatures');
  186. $morejs = array();
  187. $morecss = array();
  188. // Build and execute select
  189. // --------------------------------------------------------------------
  190. $sql = 'SELECT ';
  191. $sql .= $object->getFieldList('t');
  192. // Add fields from extrafields
  193. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  194. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  195. $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
  196. }
  197. }
  198. // Add fields from hooks
  199. $parameters = array();
  200. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
  201. $sql .= $hookmanager->resPrint;
  202. $sql = preg_replace('/,\s*$/', '', $sql);
  203. $sqlfields = $sql; // $sql fields to remove for count total
  204. $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
  205. if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
  206. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
  207. }
  208. // Add table from hooks
  209. $parameters = array();
  210. $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
  211. $sql .= $hookmanager->resPrint;
  212. if ($object->ismultientitymanaged == 1) {
  213. $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
  214. } else {
  215. $sql .= " WHERE 1 = 1";
  216. }
  217. foreach ($search as $key => $val) {
  218. if (array_key_exists($key, $object->fields)) {
  219. if ($key == 'status' && $search[$key] == -1) {
  220. continue;
  221. }
  222. $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
  223. if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
  224. if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
  225. $search[$key] = '';
  226. }
  227. $mode_search = 2;
  228. }
  229. if ($search[$key] != '') {
  230. $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
  231. }
  232. } else {
  233. if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
  234. $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
  235. if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
  236. if (preg_match('/_dtstart$/', $key)) {
  237. $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
  238. }
  239. if (preg_match('/_dtend$/', $key)) {
  240. $sql .= " AND t.".$db->escape($columnName)." <= '" . $db->idate($search[$key])."'";
  241. }
  242. }
  243. }
  244. }
  245. }
  246. if ($search_all) {
  247. $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
  248. }
  249. if (!empty($id)) {
  250. $sql .= " AND t.fk_recruitmentjobposition = ".((int) $id);
  251. }
  252. //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
  253. // Add where from extra fields
  254. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  255. // Add where from hooks
  256. $parameters = array();
  257. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  258. $sql .= $hookmanager->resPrint;
  259. /* If a group by is required
  260. $sql.= " GROUP BY ";
  261. foreach ($object->fields as $key => $val) {
  262. $sql .= "t.".$db->escape($key).", ";
  263. }
  264. // Add fields from extrafields
  265. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  266. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  267. $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
  268. }
  269. }
  270. // Add where from hooks
  271. $parameters=array();
  272. $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
  273. $sql .= $hookmanager->resPrint;
  274. $sql = preg_replace('/,\s*$/', '', $sql);
  275. */
  276. // Count total nb of records
  277. $nbtotalofrecords = '';
  278. if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
  279. /* The fast and low memory method to get and count full list converts the sql into a sql count */
  280. $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
  281. $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
  282. $resql = $db->query($sqlforcount);
  283. if ($resql) {
  284. $objforcount = $db->fetch_object($resql);
  285. $nbtotalofrecords = $objforcount->nbtotalofrecords;
  286. } else {
  287. dol_print_error($db);
  288. }
  289. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
  290. $page = 0;
  291. $offset = 0;
  292. }
  293. $db->free($resql);
  294. }
  295. // Complete request and execute it with limit
  296. $sql .= $db->order($sortfield, $sortorder);
  297. if ($limit) {
  298. $sql .= $db->plimit($limit + 1, $offset);
  299. }
  300. $resql = $db->query($sql);
  301. if (!$resql) {
  302. dol_print_error($db);
  303. exit;
  304. }
  305. $num = $db->num_rows($resql);
  306. // Direct jump if only one record found
  307. if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
  308. $obj = $db->fetch_object($resql);
  309. $id = $obj->rowid;
  310. header("Location: ".DOL_URL_ROOT.'/recruitment/recruitmentcandidature_card.php?id='.$id);
  311. exit;
  312. }
  313. // Output page
  314. // --------------------------------------------------------------------
  315. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
  316. // Part to show record
  317. if ($jobposition->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
  318. $savobject = $object;
  319. $object = $jobposition;
  320. $res = $object->fetch_optionals();
  321. $head = recruitmentjobpositionPrepareHead($object);
  322. print dol_get_fiche_head($head, 'candidatures', $langs->trans("RecruitmentCandidatures"), -1, $object->picto);
  323. $formconfirm = '';
  324. // Confirmation to delete
  325. if ($action == 'delete') {
  326. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRecruitmentJobPosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
  327. }
  328. // Confirmation to delete line
  329. if ($action == 'deleteline') {
  330. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
  331. }
  332. // Clone confirmation
  333. if ($action == 'clone') {
  334. // Create an array for form
  335. $formquestion = array();
  336. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
  337. }
  338. // Confirmation of action xxxx
  339. if ($action == 'xxx') {
  340. $formquestion = array();
  341. /*
  342. $forcecombo=0;
  343. if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
  344. $formquestion = array(
  345. // 'text' => $langs->trans("ConfirmClone"),
  346. // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
  347. // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
  348. // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
  349. );
  350. */
  351. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
  352. }
  353. // Call Hook formConfirm
  354. $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
  355. $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  356. if (empty($reshook)) {
  357. $formconfirm .= $hookmanager->resPrint;
  358. } elseif ($reshook > 0) {
  359. $formconfirm = $hookmanager->resPrint;
  360. }
  361. // Print form confirm
  362. print $formconfirm;
  363. // Object card
  364. // ------------------------------------------------------------
  365. $linkback = '<a href="'.dol_buildpath('/recruitment/recruitmentjobposition_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
  366. $morehtmlref = '<div class="refidno">';
  367. /*
  368. // Ref customer
  369. $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
  370. $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
  371. // Thirdparty
  372. $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
  373. */
  374. // Project
  375. if (isModEnabled('project')) {
  376. $langs->load("projects");
  377. $morehtmlref .= $langs->trans('Project').' ';
  378. if ($permissiontoadd) {
  379. if ($action != 'classify') {
  380. $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
  381. }
  382. $morehtmlref .= ' : ';
  383. if ($action == 'classify') {
  384. //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
  385. $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
  386. $morehtmlref .= '<input type="hidden" name="action" value="classin">';
  387. $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
  388. $morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
  389. $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
  390. $morehtmlref .= '</form>';
  391. } else {
  392. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
  393. }
  394. } else {
  395. if (!empty($object->fk_project)) {
  396. $proj = new Project($db);
  397. $proj->fetch($object->fk_project);
  398. $morehtmlref .= ': '.$proj->getNomUrl();
  399. } else {
  400. $morehtmlref .= '';
  401. }
  402. }
  403. }
  404. $morehtmlref .= '</div>';
  405. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  406. print '<div class="fichecenter">';
  407. print '<div class="fichehalfleft">';
  408. print '<div class="underbanner clearboth"></div>';
  409. print '<table class="border centpercent tableforfield">'."\n";
  410. // Common attributes
  411. $keyforbreak = 'description'; // We change column just after this field
  412. unset($object->fields['fk_project']); // Hide field already shown in banner
  413. //unset($object->fields['fk_soc']); // Hide field already shown in banner
  414. include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
  415. // Other attributes. Fields from hook formObjectOptions and Extrafields.
  416. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  417. print '</table>';
  418. print '</div>';
  419. print '</div>';
  420. print '<div class="clearboth"></div>';
  421. print dol_get_fiche_end();
  422. print '<br>';
  423. $object = $savobject;
  424. }
  425. $arrayofselected = is_array($toselect) ? $toselect : array();
  426. $param = '';
  427. if (!empty($id)) {
  428. $param .= '&id='.urlencode($id);
  429. }
  430. if (!empty($mode)) {
  431. $param .= '&mode='.urlencode($mode);
  432. }
  433. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  434. $param .= '&contextpage='.urlencode($contextpage);
  435. }
  436. if ($limit > 0 && $limit != $conf->liste_limit) {
  437. $param .= '&limit='.((int) $limit);
  438. }
  439. foreach ($search as $key => $val) {
  440. if (is_array($search[$key])) {
  441. foreach ($search[$key] as $skey) {
  442. if ($skey != '') {
  443. $param .= '&search_'.$key.'[]='.urlencode($skey);
  444. }
  445. }
  446. } elseif ($search[$key] != '') {
  447. $param .= '&search_'.$key.'='.urlencode($search[$key]);
  448. }
  449. }
  450. if ($optioncss != '') {
  451. $param .= '&optioncss='.urlencode($optioncss);
  452. }
  453. // Add $param from extra fields
  454. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  455. // Add $param from hooks
  456. $parameters = array();
  457. $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
  458. $param .= $hookmanager->resPrint;
  459. // List of mass actions available
  460. $arrayofmassactions = array(
  461. 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
  462. //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
  463. //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
  464. //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
  465. );
  466. if (!empty($permissiontodelete)) {
  467. $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
  468. }
  469. if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
  470. $arrayofmassactions = array();
  471. }
  472. $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
  473. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
  474. if ($optioncss != '') {
  475. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  476. }
  477. print '<input type="hidden" name="token" value="'.newToken().'">';
  478. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  479. print '<input type="hidden" name="action" value="list">';
  480. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  481. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  482. print '<input type="hidden" name="page" value="'.$page.'">';
  483. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  484. print '<input type="hidden" name="mode" value="'.$mode.'">';
  485. print '<input type="hidden" name="id" value="'.$id.'">';
  486. $newcardbutton = '';
  487. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
  488. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
  489. $newcardbutton .= dolGetButtonTitleSeparator();
  490. $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&fk_recruitmentjobposition='.$id, '', $permissiontoadd);
  491. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
  492. // Add code for pre mass action (confirmation or email presend form)
  493. $topicmail = "SendRecruitmentCandidatureRef";
  494. $modelmail = "recruitmentcandidature";
  495. $objecttmp = new RecruitmentCandidature($db);
  496. $trackid = 'recruitmentapplication'.$object->id;
  497. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  498. if ($search_all) {
  499. $setupstring = '';
  500. foreach ($fieldstosearchall as $key => $val) {
  501. $fieldstosearchall[$key] = $langs->trans($val);
  502. $setupstring .= $key."=".$val.";";
  503. }
  504. print '<!-- Search done like if RECRUITMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
  505. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
  506. }
  507. $moreforfilter = '';
  508. /*$moreforfilter.='<div class="divsearchfield">';
  509. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  510. $moreforfilter.= '</div>';*/
  511. $parameters = array();
  512. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  513. if (empty($reshook)) {
  514. $moreforfilter .= $hookmanager->resPrint;
  515. } else {
  516. $moreforfilter = $hookmanager->resPrint;
  517. }
  518. if (!empty($moreforfilter)) {
  519. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  520. print $moreforfilter;
  521. print '</div>';
  522. }
  523. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  524. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
  525. $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  526. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  527. print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  528. // Fields title search
  529. // --------------------------------------------------------------------
  530. print '<tr class="liste_titre_filter">';
  531. // Action column
  532. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  533. print '<td class="liste_titre maxwidthsearch center">';
  534. $searchpicto = $form->showFilterButtons('left');
  535. print $searchpicto;
  536. print '</td>';
  537. }
  538. foreach ($object->fields as $key => $val) {
  539. $searchkey = empty($search[$key]) ? '' : $search[$key];
  540. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  541. if ($key == 'status') {
  542. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  543. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  544. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  545. } elseif (in_array($val['type'], array('timestamp'))) {
  546. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  547. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  548. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  549. }
  550. if (!empty($arrayfields['t.'.$key]['checked'])) {
  551. print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
  552. if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
  553. print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
  554. } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
  555. print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
  556. } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  557. print '<div class="nowrap">';
  558. print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
  559. print '</div>';
  560. print '<div class="nowrap">';
  561. print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
  562. print '</div>';
  563. } elseif ($key == 'lang') {
  564. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  565. $formadmin = new FormAdmin($db);
  566. print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
  567. } else {
  568. print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
  569. }
  570. print '</td>';
  571. }
  572. }
  573. // Extra fields
  574. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  575. // Fields from hook
  576. $parameters = array('arrayfields'=>$arrayfields);
  577. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  578. print $hookmanager->resPrint;
  579. // Action column
  580. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  581. print '<td class="liste_titre center maxwidthsearch">';
  582. $searchpicto = $form->showFilterButtons();
  583. print $searchpicto;
  584. print '</td>';
  585. }
  586. print '</tr>'."\n";
  587. $totalarray = array();
  588. $totalarray['nbfield'] = 0;
  589. // Fields title label
  590. // --------------------------------------------------------------------
  591. print '<tr class="liste_titre">';
  592. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  593. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
  594. $totalarray['nbfield']++;
  595. }
  596. foreach ($object->fields as $key => $val) {
  597. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  598. if ($key == 'status') {
  599. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  600. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  601. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  602. } elseif (in_array($val['type'], array('timestamp'))) {
  603. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  604. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  605. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  606. }
  607. $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
  608. if (!empty($arrayfields['t.'.$key]['checked'])) {
  609. print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
  610. $totalarray['nbfield']++;
  611. }
  612. }
  613. // Extra fields
  614. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  615. // Hook fields
  616. $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
  617. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  618. print $hookmanager->resPrint;
  619. // Action column
  620. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  621. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
  622. $totalarray['nbfield']++;
  623. }
  624. print '</tr>'."\n";
  625. // Detect if we need a fetch on each output line
  626. $needToFetchEachLine = 0;
  627. if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
  628. foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
  629. if ($val && preg_match('/\$object/', $val)) {
  630. $needToFetchEachLine++; // There is at least one compute field that use $object
  631. }
  632. }
  633. }
  634. // Loop on record
  635. // --------------------------------------------------------------------
  636. $i = 0;
  637. $savnbfield = $totalarray['nbfield'];
  638. $totalarray = array();
  639. $totalarray['nbfield'] = 0;
  640. $imaxinloop = ($limit ? min($num, $limit) : $num);
  641. while ($i < $imaxinloop) {
  642. $obj = $db->fetch_object($resql);
  643. if (empty($obj)) {
  644. break; // Should not happen
  645. }
  646. // Store properties in $object
  647. $object->setVarsFromFetchObj($obj);
  648. if ($mode == 'kanban') {
  649. if ($i == 0) {
  650. print '<tr><td colspan="'.$savnbfield.'">';
  651. print '<div class="box-flex-container kanban">';
  652. }
  653. // TODO Use a cache for $recruitment
  654. $recruitment = new RecruitmentJobPosition($db);
  655. $recruitment->fetch($obj->fk_recruitmentjobposition);
  656. $object->phone = $obj->phone;
  657. if ($massactionbutton || $massaction) {
  658. $selected = 0;
  659. }
  660. // Output Kanban
  661. print $object->getKanbanView('', array('jobpositionlink'=>$recruitment->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
  662. if ($i == ($imaxinloop - 1)) {
  663. print '</div>';
  664. print '</td></tr>';
  665. }
  666. } else {
  667. // Show here line of result
  668. $j = 0;
  669. print '<tr data-rowid="'.$object->id.'" class="oddeven">';
  670. // Action column
  671. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  672. print '<td class="nowrap center">';
  673. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  674. $selected = 0;
  675. if (in_array($object->id, $arrayofselected)) {
  676. $selected = 1;
  677. }
  678. print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  679. }
  680. print '</td>';
  681. if (!$i) {
  682. $totalarray['nbfield']++;
  683. }
  684. }
  685. foreach ($object->fields as $key => $val) {
  686. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  687. if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  688. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  689. } elseif ($key == 'status') {
  690. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  691. }
  692. if (in_array($val['type'], array('timestamp'))) {
  693. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  694. } elseif ($key == 'ref') {
  695. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  696. }
  697. if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
  698. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  699. }
  700. //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
  701. if (!empty($arrayfields['t.'.$key]['checked'])) {
  702. print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
  703. if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
  704. print ' title="'.dol_escape_htmltag($object->$key).'"';
  705. }
  706. print '>';
  707. if ($key == 'status') {
  708. print $object->getLibStatut(5);
  709. } elseif ($key == 'rowid') {
  710. print $object->showOutputField($val, $key, $object->id, '');
  711. } else {
  712. print $object->showOutputField($val, $key, $object->$key, '');
  713. }
  714. print '</td>';
  715. if (!$i) {
  716. $totalarray['nbfield']++;
  717. }
  718. if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
  719. if (!$i) {
  720. $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
  721. }
  722. if (!isset($totalarray['val'])) {
  723. $totalarray['val'] = array();
  724. }
  725. if (!isset($totalarray['val']['t.'.$key])) {
  726. $totalarray['val']['t.'.$key] = 0;
  727. }
  728. $totalarray['val']['t.'.$key] += $object->$key;
  729. }
  730. }
  731. }
  732. // Extra fields
  733. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  734. // Fields from hook
  735. $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
  736. $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  737. print $hookmanager->resPrint;
  738. // Action column
  739. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  740. print '<td class="nowrap center">';
  741. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  742. $selected = 0;
  743. if (in_array($object->id, $arrayofselected)) {
  744. $selected = 1;
  745. }
  746. print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  747. }
  748. print '</td>';
  749. if (!$i) {
  750. $totalarray['nbfield']++;
  751. }
  752. }
  753. print '</tr>'."\n";
  754. }
  755. $i++;
  756. }
  757. // Show total line
  758. include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
  759. // If no record found
  760. if ($num == 0) {
  761. $colspan = 1;
  762. foreach ($arrayfields as $key => $val) {
  763. if (!empty($val['checked'])) {
  764. $colspan++;
  765. }
  766. }
  767. print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
  768. }
  769. $db->free($resql);
  770. $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
  771. $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  772. print $hookmanager->resPrint;
  773. print '</table>'."\n";
  774. print '</div>'."\n";
  775. print '</form>'."\n";
  776. if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
  777. $hidegeneratedfilelistifempty = 1;
  778. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
  779. $hidegeneratedfilelistifempty = 0;
  780. }
  781. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  782. $formfile = new FormFile($db);
  783. // Show list of available documents
  784. $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
  785. $urlsource .= str_replace('&amp;', '&', $param);
  786. $filedir = $diroutputmassaction;
  787. $genallowed = $permissiontoread;
  788. $delallowed = $permissiontoadd;
  789. print $formfile->showdocuments('massfilesarea_recruitment', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
  790. }
  791. // End of page
  792. llxFooter();
  793. $db->close();