recruitmentcandidature.class.php 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. <?php
  2. /* Copyright (C) 2020 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 class/recruitmentcandidature.class.php
  19. * \ingroup recruitment
  20. * \brief This file is a CRUD class file for RecruitmentCandidature (Create/Read/Update/Delete)
  21. */
  22. // Put here all includes required by your class file
  23. require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
  24. //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
  25. //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
  26. /**
  27. * Class for RecruitmentCandidature
  28. */
  29. class RecruitmentCandidature extends CommonObject
  30. {
  31. /**
  32. * @var string ID of module.
  33. */
  34. public $module = 'recruitment';
  35. /**
  36. * @var string ID to identify managed object.
  37. */
  38. public $element = 'recruitmentcandidature';
  39. /**
  40. * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
  41. */
  42. public $table_element = 'recruitment_recruitmentcandidature';
  43. /**
  44. * @var int Does this object support multicompany module ?
  45. * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
  46. */
  47. public $ismultientitymanaged = 0;
  48. /**
  49. * @var int Does object support extrafields ? 0=No, 1=Yes
  50. */
  51. public $isextrafieldmanaged = 1;
  52. /**
  53. * @var string String with name of icon for recruitmentcandidature. Must be the part after the 'object_' into object_recruitmentcandidature.png
  54. */
  55. public $picto = 'recruitmentcandidature';
  56. /**
  57. * @var int Do not exploit fields email_xxx into triggers.
  58. */
  59. public $email_fields_no_propagate_in_actioncomm;
  60. const STATUS_DRAFT = 0;
  61. const STATUS_VALIDATED = 1;
  62. //const STATUS_INTERVIEW_SCHEDULED = 2;
  63. const STATUS_CONTRACT_PROPOSED = 3;
  64. const STATUS_CONTRACT_SIGNED = 5;
  65. const STATUS_CONTRACT_REFUSED = 6;
  66. const STATUS_REFUSED = 8;
  67. const STATUS_CANCELED = 9;
  68. /**
  69. * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
  70. * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
  71. * 'label' the translation key.
  72. * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
  73. * 'position' is the sort order of field.
  74. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
  75. * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
  76. * 'noteditable' says if field is not editable (1 or 0)
  77. * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
  78. * 'index' if we want an index in database.
  79. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
  80. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
  81. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
  82. * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
  83. * 'help' is a string visible as a tooltip on field
  84. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
  85. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
  86. * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
  87. * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
  88. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
  89. *
  90. * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
  91. */
  92. // BEGIN MODULEBUILDER PROPERTIES
  93. /**
  94. * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
  95. */
  96. public $fields = array(
  97. 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"),
  98. 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
  99. 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of candidature"),
  100. 'fk_recruitmentjobposition' => array('type'=>'integer:RecruitmentJobPosition:recruitment/class/recruitmentjobposition.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'picto'=>'recruitmentjobposition', 'css'=>'maxwidth500', 'csslist'=>'minwidth125'),
  101. 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
  102. 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
  103. 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
  104. 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
  105. 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
  106. 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
  107. 'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1,),
  108. 'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,),
  109. 'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email'),
  110. 'phone' => array('type'=>'phone', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'picto'=>'phone'),
  111. 'date_birth' => array('type'=>'date', 'label'=>'DateOfBirth', 'enabled'=>'1', 'position'=>70, 'visible'=>-1,),
  112. 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
  113. //'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1),
  114. 'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,),
  115. 'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,),
  116. 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>500, 'notnull'=>0, 'visible'=>3,),
  117. 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
  118. 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
  119. 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'default'=>0, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Received', '3'=>'ContractProposed', '5'=>'ContractSigned', '8'=>'Refused', '9'=>'Canceled')),
  120. );
  121. public $rowid;
  122. public $entity;
  123. public $ref;
  124. public $fk_recruitmentjobposition;
  125. public $description;
  126. public $note_public;
  127. public $note_private;
  128. public $date_creation;
  129. public $tms;
  130. public $fk_user_creat;
  131. public $fk_user_modif;
  132. public $lastname;
  133. public $firstname;
  134. public $email;
  135. public $phone;
  136. public $date_birth;
  137. public $email_msgid;
  138. public $remuneration_requested;
  139. public $remuneration_proposed;
  140. public $fk_recruitment_origin;
  141. public $import_key;
  142. public $model_pdf;
  143. public $status;
  144. // END MODULEBUILDER PROPERTIES
  145. /**
  146. * Constructor
  147. *
  148. * @param DoliDb $db Database handler
  149. */
  150. public function __construct(DoliDB $db)
  151. {
  152. global $conf, $langs;
  153. $this->db = $db;
  154. if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
  155. $this->fields['rowid']['visible'] = 0;
  156. }
  157. if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
  158. $this->fields['entity']['enabled'] = 0;
  159. }
  160. // Example to show how to set values of fields definition dynamically
  161. /*if ($user->rights->recruitment->recruitmentcandidature->read) {
  162. $this->fields['myfield']['visible'] = 1;
  163. $this->fields['myfield']['noteditable'] = 0;
  164. }*/
  165. // Unset fields that are disabled
  166. foreach ($this->fields as $key => $val) {
  167. if (isset($val['enabled']) && empty($val['enabled'])) {
  168. unset($this->fields[$key]);
  169. }
  170. }
  171. // Translate some data of arrayofkeyval
  172. if (is_object($langs)) {
  173. foreach ($this->fields as $key => $val) {
  174. if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
  175. foreach ($val['arrayofkeyval'] as $key2 => $val2) {
  176. $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
  177. }
  178. }
  179. }
  180. }
  181. }
  182. /**
  183. * Create object into database
  184. *
  185. * @param User $user User that creates
  186. * @param bool $notrigger false=launch triggers after, true=disable triggers
  187. * @return int <0 if KO, Id of created object if OK
  188. */
  189. public function create(User $user, $notrigger = false)
  190. {
  191. return $this->createCommon($user, $notrigger);
  192. }
  193. /**
  194. * Clone an object into another one
  195. *
  196. * @param User $user User that creates
  197. * @param int $fromid Id of object to clone
  198. * @return mixed New object created, <0 if KO
  199. */
  200. public function createFromClone(User $user, $fromid)
  201. {
  202. global $langs, $extrafields;
  203. $error = 0;
  204. dol_syslog(__METHOD__, LOG_DEBUG);
  205. $object = new self($this->db);
  206. $this->db->begin();
  207. // Load source object
  208. $result = $object->fetchCommon($fromid);
  209. if ($result > 0 && !empty($object->table_element_line)) {
  210. $object->fetchLines();
  211. }
  212. // get lines so they will be clone
  213. //foreach($this->lines as $line)
  214. // $line->fetch_optionals();
  215. // Reset some properties
  216. unset($object->id);
  217. unset($object->fk_user_creat);
  218. unset($object->import_key);
  219. // Clear fields
  220. if (property_exists($object, 'ref')) {
  221. $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
  222. }
  223. if (property_exists($object, 'label')) {
  224. $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
  225. }
  226. if (property_exists($object, 'status')) {
  227. $object->status = self::STATUS_DRAFT;
  228. }
  229. if (property_exists($object, 'date_creation')) {
  230. $object->date_creation = dol_now();
  231. }
  232. if (property_exists($object, 'date_modification')) {
  233. $object->date_modification = null;
  234. }
  235. // ...
  236. // Clear extrafields that are unique
  237. if (is_array($object->array_options) && count($object->array_options) > 0) {
  238. $extrafields->fetch_name_optionals_label($this->table_element);
  239. foreach ($object->array_options as $key => $option) {
  240. $shortkey = preg_replace('/options_/', '', $key);
  241. if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) {
  242. //var_dump($key);
  243. //var_dump($clonedObj->array_options[$key]); exit;
  244. unset($object->array_options[$key]);
  245. }
  246. }
  247. }
  248. // Create clone
  249. $object->context['createfromclone'] = 'createfromclone';
  250. $result = $object->createCommon($user);
  251. if ($result < 0) {
  252. $error++;
  253. $this->error = $object->error;
  254. $this->errors = $object->errors;
  255. }
  256. if (!$error) {
  257. // copy internal contacts
  258. if ($this->copy_linked_contact($object, 'internal') < 0) {
  259. $error++;
  260. }
  261. }
  262. if (!$error) {
  263. // copy external contacts if same company
  264. if (property_exists($this, 'socid') && $this->socid == $object->socid) {
  265. if ($this->copy_linked_contact($object, 'external') < 0) {
  266. $error++;
  267. }
  268. }
  269. }
  270. unset($object->context['createfromclone']);
  271. // End
  272. if (!$error) {
  273. $this->db->commit();
  274. return $object;
  275. } else {
  276. $this->db->rollback();
  277. return -1;
  278. }
  279. }
  280. /**
  281. * Load object in memory from the database
  282. *
  283. * @param int $id Id object
  284. * @param string $ref Ref
  285. * @param string $email_msgid Email msgid
  286. * @return int <0 if KO, 0 if not found, >0 if OK
  287. */
  288. public function fetch($id, $ref = null, $email_msgid = '')
  289. {
  290. $morewhere = '';
  291. if ($email_msgid) {
  292. $morewhere = " AND email_msgid = '".$this->db->escape($email_msgid)."'";
  293. }
  294. $result = $this->fetchCommon($id, $ref, $morewhere);
  295. if ($result > 0 && !empty($this->table_element_line)) {
  296. $this->fetchLines();
  297. }
  298. return $result;
  299. }
  300. /**
  301. * Load object lines in memory from the database
  302. *
  303. * @return int <0 if KO, 0 if not found, >0 if OK
  304. */
  305. public function fetchLines()
  306. {
  307. $this->lines = array();
  308. $result = $this->fetchLinesCommon();
  309. return $result;
  310. }
  311. /**
  312. * Load list of objects in memory from the database.
  313. *
  314. * @param string $sortorder Sort Order
  315. * @param string $sortfield Sort field
  316. * @param int $limit limit
  317. * @param int $offset Offset
  318. * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
  319. * @param string $filtermode Filter mode (AND or OR)
  320. * @return array|int int <0 if KO, array of pages if OK
  321. */
  322. public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
  323. {
  324. global $conf;
  325. dol_syslog(__METHOD__, LOG_DEBUG);
  326. $records = array();
  327. $sql = 'SELECT ';
  328. $sql .= $this->getFieldList();
  329. $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
  330. if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
  331. $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
  332. } else {
  333. $sql .= ' WHERE 1 = 1';
  334. }
  335. // Manage filter
  336. $sqlwhere = array();
  337. if (count($filter) > 0) {
  338. foreach ($filter as $key => $value) {
  339. if ($key == 't.rowid') {
  340. $sqlwhere[] = $key." = ".((int) $value);
  341. } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
  342. $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
  343. } elseif ($key == 'customsql') {
  344. $sqlwhere[] = $value;
  345. } elseif (strpos($value, '%') === false) {
  346. $sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
  347. } else {
  348. $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
  349. }
  350. }
  351. }
  352. if (count($sqlwhere) > 0) {
  353. $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
  354. }
  355. if (!empty($sortfield)) {
  356. $sql .= $this->db->order($sortfield, $sortorder);
  357. }
  358. if (!empty($limit)) {
  359. $sql .= $this->db->plimit($limit, $offset);
  360. }
  361. $resql = $this->db->query($sql);
  362. if ($resql) {
  363. $num = $this->db->num_rows($resql);
  364. $i = 0;
  365. while ($i < ($limit ? min($limit, $num) : $num)) {
  366. $obj = $this->db->fetch_object($resql);
  367. $record = new self($this->db);
  368. $record->setVarsFromFetchObj($obj);
  369. $records[$record->id] = $record;
  370. $i++;
  371. }
  372. $this->db->free($resql);
  373. return $records;
  374. } else {
  375. $this->errors[] = 'Error '.$this->db->lasterror();
  376. dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
  377. return -1;
  378. }
  379. }
  380. /**
  381. * Update object into database
  382. *
  383. * @param User $user User that modifies
  384. * @param bool $notrigger false=launch triggers after, true=disable triggers
  385. * @return int <0 if KO, >0 if OK
  386. */
  387. public function update(User $user, $notrigger = false)
  388. {
  389. return $this->updateCommon($user, $notrigger);
  390. }
  391. /**
  392. * Delete object in database
  393. *
  394. * @param User $user User that deletes
  395. * @param bool $notrigger false=launch triggers after, true=disable triggers
  396. * @return int <0 if KO, >0 if OK
  397. */
  398. public function delete(User $user, $notrigger = false)
  399. {
  400. return $this->deleteCommon($user, $notrigger);
  401. //return $this->deleteCommon($user, $notrigger, 1);
  402. }
  403. /**
  404. * Delete a line of object in database
  405. *
  406. * @param User $user User that delete
  407. * @param int $idline Id of line to delete
  408. * @param bool $notrigger false=launch triggers after, true=disable triggers
  409. * @return int >0 if OK, <0 if KO
  410. */
  411. public function deleteLine(User $user, $idline, $notrigger = false)
  412. {
  413. if ($this->status < 0) {
  414. $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
  415. return -2;
  416. }
  417. return $this->deleteLineCommon($user, $idline, $notrigger);
  418. }
  419. /**
  420. * Validate object
  421. *
  422. * @param User $user User making status change
  423. * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
  424. * @return int <=0 if OK, 0=Nothing done, >0 if KO
  425. */
  426. public function validate($user, $notrigger = 0)
  427. {
  428. global $conf, $langs;
  429. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  430. $error = 0;
  431. // Protection
  432. if ($this->status == self::STATUS_VALIDATED) {
  433. dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
  434. return 0;
  435. }
  436. /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->recruitmentcandidature->write))
  437. || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->recruitmentcandidature->recruitmentcandidature_advance->validate))))
  438. {
  439. $this->error='NotEnoughPermissions';
  440. dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
  441. return -1;
  442. }*/
  443. $now = dol_now();
  444. $this->db->begin();
  445. // Define new ref
  446. if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
  447. $num = $this->getNextNumRef();
  448. } else {
  449. $num = $this->ref;
  450. }
  451. $this->newref = $num;
  452. if (!empty($num)) {
  453. // Validate
  454. $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
  455. $sql .= " SET ref = '".$this->db->escape($num)."',";
  456. $sql .= " status = ".self::STATUS_VALIDATED;
  457. if (!empty($this->fields['date_validation'])) {
  458. $sql .= ", date_validation = '".$this->db->idate($now)."',";
  459. }
  460. if (!empty($this->fields['fk_user_valid'])) {
  461. $sql .= ", fk_user_valid = ".$user->id;
  462. }
  463. $sql .= " WHERE rowid = ".((int) $this->id);
  464. dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
  465. $resql = $this->db->query($sql);
  466. if (!$resql) {
  467. dol_print_error($this->db);
  468. $this->error = $this->db->lasterror();
  469. $error++;
  470. }
  471. if (!$error && !$notrigger) {
  472. // Call trigger
  473. $result = $this->call_trigger('RECRUITMENTCANDIDATURE_VALIDATE', $user);
  474. if ($result < 0) {
  475. $error++;
  476. }
  477. // End call triggers
  478. }
  479. }
  480. if (!$error) {
  481. $this->oldref = $this->ref;
  482. // Rename directory if dir was a temporary ref
  483. if (preg_match('/^[\(]?PROV/i', $this->ref)) {
  484. // Now we rename also files into index
  485. $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'recruitmentcandidature/".$this->db->escape($this->newref)."'";
  486. $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'recruitmentcandidature/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
  487. $resql = $this->db->query($sql);
  488. if (!$resql) {
  489. $error++; $this->error = $this->db->lasterror();
  490. }
  491. // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
  492. $oldref = dol_sanitizeFileName($this->ref);
  493. $newref = dol_sanitizeFileName($num);
  494. $dirsource = $conf->recruitment->dir_output.'/recruitmentcandidature/'.$oldref;
  495. $dirdest = $conf->recruitment->dir_output.'/recruitmentcandidature/'.$newref;
  496. if (!$error && file_exists($dirsource)) {
  497. dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
  498. if (@rename($dirsource, $dirdest)) {
  499. dol_syslog("Rename ok");
  500. // Rename docs starting with $oldref with $newref
  501. $listoffiles = dol_dir_list($conf->recruitment->dir_output.'/recruitmentcandidature/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
  502. foreach ($listoffiles as $fileentry) {
  503. $dirsource = $fileentry['name'];
  504. $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
  505. $dirsource = $fileentry['path'].'/'.$dirsource;
  506. $dirdest = $fileentry['path'].'/'.$dirdest;
  507. @rename($dirsource, $dirdest);
  508. }
  509. }
  510. }
  511. }
  512. }
  513. // Set new ref and current status
  514. if (!$error) {
  515. $this->ref = $num;
  516. $this->status = self::STATUS_VALIDATED;
  517. }
  518. if (!$error) {
  519. $this->db->commit();
  520. return 1;
  521. } else {
  522. $this->db->rollback();
  523. return -1;
  524. }
  525. }
  526. /**
  527. * Set draft status
  528. *
  529. * @param User $user Object user that modify
  530. * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
  531. * @return int <0 if KO, >0 if OK
  532. */
  533. public function setDraft($user, $notrigger = 0)
  534. {
  535. // Protection
  536. if ($this->status <= self::STATUS_DRAFT) {
  537. return 0;
  538. }
  539. /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->write))
  540. || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->recruitment_advance->validate))))
  541. {
  542. $this->error='Permission denied';
  543. return -1;
  544. }*/
  545. return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'RECRUITMENTCANDIDATURE_UNVALIDATE');
  546. }
  547. /**
  548. * Set cancel status
  549. *
  550. * @param User $user Object user that modify
  551. * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
  552. * @return int <0 if KO, 0=Nothing done, >0 if OK
  553. */
  554. public function cancel($user, $notrigger = 0)
  555. {
  556. // Protection
  557. if ($this->status != self::STATUS_VALIDATED) {
  558. return 0;
  559. }
  560. /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->write))
  561. || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->recruitment_advance->validate))))
  562. {
  563. $this->error='Permission denied';
  564. return -1;
  565. }*/
  566. return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'RECRUITMENTCANDIDATURE_CLOSE');
  567. }
  568. /**
  569. * Set back to validated status
  570. *
  571. * @param User $user Object user that modify
  572. * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
  573. * @return int <0 if KO, 0=Nothing done, >0 if OK
  574. */
  575. public function reopen($user, $notrigger = 0)
  576. {
  577. // Protection
  578. if ($this->status != self::STATUS_REFUSED && $this->status != self::STATUS_CANCELED && $this->status != self::STATUS_CONTRACT_REFUSED) {
  579. return 0;
  580. }
  581. /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->write))
  582. || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->recruitment->recruitment_advance->validate))))
  583. {
  584. $this->error='Permission denied';
  585. return -1;
  586. }*/
  587. return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'RECRUITMENTCANDIDATURE_REOPEN');
  588. }
  589. /**
  590. * Return a link to the object card (with optionaly the picto)
  591. *
  592. * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
  593. * @param string $option On what the link point to ('nolink', ...)
  594. * @param int $notooltip 1=Disable tooltip
  595. * @param string $morecss Add more css on link
  596. * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
  597. * @return string String with URL
  598. */
  599. public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
  600. {
  601. global $conf, $langs, $hookmanager;
  602. if (!empty($conf->dol_no_mouse_hover)) {
  603. $notooltip = 1; // Force disable tooltips
  604. }
  605. $result = '';
  606. $label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("RecruitmentCandidature").'</u>';
  607. if (isset($this->status)) {
  608. $label .= ' '.$this->getLibStatut(5);
  609. }
  610. $label .= '<br>';
  611. $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
  612. $label .= '<br><b>'.$langs->trans('Email').':</b> '.$this->email;
  613. $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
  614. $url = dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.$this->id;
  615. if ($option != 'nolink') {
  616. // Add param to save lastsearch_values or not
  617. $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
  618. if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
  619. $add_save_lastsearch_values = 1;
  620. }
  621. if ($add_save_lastsearch_values) {
  622. $url .= '&save_lastsearch_values=1';
  623. }
  624. }
  625. $linkclose = '';
  626. if (empty($notooltip)) {
  627. if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
  628. $label = $langs->trans("ShowRecruitmentCandidature");
  629. $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
  630. }
  631. $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
  632. $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
  633. } else {
  634. $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
  635. }
  636. $linkstart = '<a href="'.$url.'"';
  637. $linkstart .= $linkclose.'>';
  638. $linkend = '</a>';
  639. $result .= $linkstart;
  640. if (empty($this->showphoto_on_popup)) {
  641. if ($withpicto) {
  642. $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
  643. }
  644. } else {
  645. if ($withpicto) {
  646. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  647. list($class, $module) = explode('@', $this->picto);
  648. $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
  649. $filearray = dol_dir_list($upload_dir, "files");
  650. $filename = $filearray[0]['name'];
  651. if (!empty($filename)) {
  652. $pospoint = strpos($filearray[0]['name'], '.');
  653. $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
  654. if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
  655. $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
  656. } else {
  657. $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
  658. }
  659. $result .= '</div>';
  660. } else {
  661. $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
  662. }
  663. }
  664. }
  665. if ($withpicto != 2) {
  666. $result .= $this->ref;
  667. }
  668. $result .= $linkend;
  669. //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
  670. global $action, $hookmanager;
  671. $hookmanager->initHooks(array('recruitmentcandidaturedao'));
  672. $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
  673. $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
  674. if ($reshook > 0) {
  675. $result = $hookmanager->resPrint;
  676. } else {
  677. $result .= $hookmanager->resPrint;
  678. }
  679. return $result;
  680. }
  681. /**
  682. * Return label of the status
  683. *
  684. * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
  685. * @return string Label of status
  686. */
  687. public function getLibStatut($mode = 0)
  688. {
  689. return $this->LibStatut($this->status, $mode);
  690. }
  691. // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
  692. /**
  693. * Return the status
  694. *
  695. * @param int $status Id status
  696. * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
  697. * @return string Label of status
  698. */
  699. public function LibStatut($status, $mode = 0)
  700. {
  701. // phpcs:enable
  702. if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
  703. global $langs;
  704. //$langs->load("recruitment@recruitment");
  705. $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
  706. $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Received').' ('.$langs->transnoentitiesnoconv("InterviewToDo").')';
  707. $this->labelStatus[self::STATUS_CONTRACT_PROPOSED] = $langs->transnoentitiesnoconv('ContractProposed');
  708. $this->labelStatus[self::STATUS_CONTRACT_SIGNED] = $langs->transnoentitiesnoconv('ContractSigned');
  709. $this->labelStatus[self::STATUS_CONTRACT_REFUSED] = $langs->transnoentitiesnoconv('ContractRefused');
  710. $this->labelStatus[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused');
  711. $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
  712. $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
  713. $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Received');
  714. $this->labelStatusShort[self::STATUS_CONTRACT_PROPOSED] = $langs->transnoentitiesnoconv('ContractProposed');
  715. $this->labelStatusShort[self::STATUS_CONTRACT_SIGNED] = $langs->transnoentitiesnoconv('ContractSigned');
  716. $this->labelStatusShort[self::STATUS_CONTRACT_REFUSED] = $langs->transnoentitiesnoconv('ContractRefused');
  717. $this->labelStatusShort[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused');
  718. $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
  719. }
  720. $statusType = 'status'.$status;
  721. //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
  722. if ($status == self::STATUS_CANCELED) {
  723. $statusType = 'status6';
  724. }
  725. if ($status == self::STATUS_REFUSED) {
  726. $statusType = 'status10';
  727. }
  728. return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
  729. }
  730. /**
  731. * Load the info information in the object
  732. *
  733. * @param int $id Id of object
  734. * @return void
  735. */
  736. public function info($id)
  737. {
  738. $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
  739. $sql .= ' fk_user_creat, fk_user_modif';
  740. $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
  741. $sql .= ' WHERE t.rowid = '.((int) $id);
  742. $result = $this->db->query($sql);
  743. if ($result) {
  744. if ($this->db->num_rows($result)) {
  745. $obj = $this->db->fetch_object($result);
  746. $this->id = $obj->rowid;
  747. if ($obj->fk_user_author) {
  748. $cuser = new User($this->db);
  749. $cuser->fetch($obj->fk_user_author);
  750. $this->user_creation = $cuser;
  751. }
  752. if ($obj->fk_user_valid) {
  753. $vuser = new User($this->db);
  754. $vuser->fetch($obj->fk_user_valid);
  755. $this->user_validation = $vuser;
  756. }
  757. if ($obj->fk_user_cloture) {
  758. $cluser = new User($this->db);
  759. $cluser->fetch($obj->fk_user_cloture);
  760. $this->user_cloture = $cluser;
  761. }
  762. $this->date_creation = $this->db->jdate($obj->datec);
  763. $this->date_modification = $this->db->jdate($obj->datem);
  764. $this->date_validation = $this->db->jdate($obj->datev);
  765. }
  766. $this->db->free($result);
  767. } else {
  768. dol_print_error($this->db);
  769. }
  770. }
  771. /**
  772. * Initialise object with example values
  773. * Id must be 0 if object instance is a specimen
  774. *
  775. * @return void
  776. */
  777. public function initAsSpecimen()
  778. {
  779. $this->initAsSpecimenCommon();
  780. }
  781. /**
  782. * Create an array of lines
  783. *
  784. * @return array|int array of lines if OK, <0 if KO
  785. */
  786. public function getLinesArray()
  787. {
  788. $this->lines = array();
  789. $objectline = new RecruitmentCandidatureLine($this->db);
  790. $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_recruitmentcandidature = '.((int) $this->id)));
  791. if (is_numeric($result)) {
  792. $this->error = $this->error;
  793. $this->errors = $this->errors;
  794. return $result;
  795. } else {
  796. $this->lines = $result;
  797. return $this->lines;
  798. }
  799. }
  800. /**
  801. * Returns the reference to the following non used object depending on the active numbering module.
  802. *
  803. * @return string Object free reference
  804. */
  805. public function getNextNumRef()
  806. {
  807. global $langs, $conf;
  808. $langs->load("recruitment@recruitment");
  809. if (empty($conf->global->RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON)) {
  810. $conf->global->RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON = 'mod_recruitmentcandidature_standard';
  811. }
  812. if (!empty($conf->global->RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON)) {
  813. $mybool = false;
  814. $file = $conf->global->RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON.".php";
  815. $classname = $conf->global->RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON;
  816. // Include file with class
  817. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  818. foreach ($dirmodels as $reldir) {
  819. $dir = dol_buildpath($reldir."core/modules/recruitment/");
  820. // Load file with numbering class (if found)
  821. $mybool |= @include_once $dir.$file;
  822. }
  823. if ($mybool === false) {
  824. dol_print_error('', "Failed to include file ".$file);
  825. return '';
  826. }
  827. if (class_exists($classname)) {
  828. $obj = new $classname();
  829. $numref = $obj->getNextValue($this);
  830. if ($numref != '' && $numref != '-1') {
  831. return $numref;
  832. } else {
  833. $this->error = $obj->error;
  834. //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
  835. return "";
  836. }
  837. } else {
  838. print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname;
  839. return "";
  840. }
  841. } else {
  842. print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
  843. return "";
  844. }
  845. }
  846. /**
  847. * Create a document onto disk according to template module.
  848. *
  849. * @param string $modele Force template to use ('' to not force)
  850. * @param Translate $outputlangs objet lang a utiliser pour traduction
  851. * @param int $hidedetails Hide details of lines
  852. * @param int $hidedesc Hide description
  853. * @param int $hideref Hide ref
  854. * @param null|array $moreparams Array to provide more information
  855. * @return int 0 if KO, 1 if OK
  856. */
  857. public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
  858. {
  859. global $conf, $langs;
  860. $result = 0;
  861. $includedocgeneration = 0;
  862. $langs->load("recruitment@recruitment");
  863. if (!dol_strlen($modele)) {
  864. if (!empty($conf->global->RECRUITMENTCANDIDATURE_ADDON_PDF)) {
  865. $modele = $conf->global->RECRUITMENTCANDIDATURE_ADDON_PDF;
  866. } else {
  867. $modele = ''; // No default value. For job application, we allow to disable all PDF generation
  868. }
  869. }
  870. $modelpath = "core/modules/recruitment/doc/";
  871. if ($includedocgeneration && !empty($modele)) {
  872. $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
  873. }
  874. return $result;
  875. }
  876. /**
  877. * Action executed by scheduler
  878. * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
  879. * Use public function doScheduledJob($param1, $param2, ...) to get parameters
  880. *
  881. * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
  882. */
  883. public function doScheduledJob()
  884. {
  885. global $conf, $langs;
  886. //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
  887. $error = 0;
  888. $this->output = '';
  889. $this->error = '';
  890. dol_syslog(__METHOD__, LOG_DEBUG);
  891. $now = dol_now();
  892. $this->db->begin();
  893. // ...
  894. $this->db->commit();
  895. return $error;
  896. }
  897. }
  898. require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
  899. /**
  900. * Class RecruitmentCandidatureLine. You can also remove this and generate a CRUD class for lines objects.
  901. */
  902. class RecruitmentCandidatureLine extends CommonObjectLine
  903. {
  904. // To complete with content of an object RecruitmentCandidatureLine
  905. // We should have a field rowid, fk_recruitmentcandidature and position
  906. /**
  907. * Constructor
  908. *
  909. * @param DoliDb $db Database handler
  910. */
  911. public function __construct(DoliDB $db)
  912. {
  913. $this->db = $db;
  914. }
  915. }