conferenceorboothattendee.class.php 39 KB

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