dolibarr  17.0.3
conferenceorbooth.class.php
Go to the documentation of this file.
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 
25 // Put here all includes required by your class file
26 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
28 //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
29 
34 {
38  public $module = 'eventorganization';
39 
43  public $element = 'conferenceorbooth';
44 
48  public $table_element = 'actioncomm';
49 
54  public $ismultientitymanaged = 1;
55 
59  public $isextrafieldmanaged = 1;
60 
64  public $picto = 'conferenceorbooth';
65 
66 
67  const STATUS_DRAFT = 0;
68  const STATUS_SUGGESTED = 1;
69  const STATUS_CONFIRMED = 2;
70  const STATUS_NOT_QUALIFIED = 3;
71  const STATUS_DONE = 4;
72  const STATUS_CANCELED = 9;
73 
74 
101  // BEGIN MODULEBUILDER PROPERTIES
105  public $fields = array(
106  'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
107  'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
108  'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
109  'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
110  'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax100', 'css'=>'maxwidth500'),
111  'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
112  'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
113  'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
114  'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),
115  'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'csslist'=>'nowraponall'),
116  'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2, 'csslist'=>'nowraponall'),
117  'fk_user_author' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
118  'fk_user_mod' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2, 'csslist'=>'tdoverflowmax100'),
119  'num_vote' => array('type'=>'smallint', 'label'=>'NbVotes', 'enabled'=>'1', 'position'=>800, 'notnull'=>-1, 'visible'=>5, 'default'=>'0', 'index'=>0),
120  'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
121  'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'EvntOrgDraft', '1'=>'EvntOrgSuggested', '2'=> 'EvntOrgConfirmed', '3' =>'EvntOrgNotQualified', '4' =>'EvntOrgDone', '9'=>'EvntOrgCancelled'),),
122  );
123  public $rowid;
124  public $id;
125  public $label;
126  public $fk_soc;
127  public $fk_project;
128  public $note;
129  public $fk_action;
130  public $datec;
131  public $tms;
132  public $fk_user_author;
133  public $fk_user_mod;
134  public $import_key;
135  public $status;
136  // END MODULEBUILDER PROPERTIES
137 
138  //public $pubregister;
139 
140 
146  public function __construct(DoliDB $db)
147  {
148  global $conf, $langs;
149 
150  $this->db = $db;
151 
152  if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
153  $this->fields['id']['visible'] = 0;
154  }
155  if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
156  $this->fields['entity']['enabled'] = 0;
157  }
158 
159  // Unset fields that are disabled
160  foreach ($this->fields as $key => $val) {
161  if (isset($val['enabled']) && empty($val['enabled'])) {
162  unset($this->fields[$key]);
163  }
164  }
165 
166  // Translate some data of arrayofkeyval
167  if (is_object($langs)) {
168  foreach ($this->fields as $key => $val) {
169  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
170  foreach ($val['arrayofkeyval'] as $key2 => $val2) {
171  $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
172  }
173  }
174  }
175  }
176  }
177 
185  public function create(User $user, $notrigger = false)
186  {
187  $this->setPercentageFromStatus();
188  $this->setActionCommFields($user);
189  return parent::create($user, $notrigger);
190  }
191 
197  protected function setPercentageFromStatus()
198  {
199  if ($this->status == self::STATUS_DONE) {
200  $this->percentage = 100;
201  }
202  if ($this->status == self::STATUS_DRAFT) {
203  $this->percentage = 0;
204  }
205  }
206 
213  protected function setActionCommFields(User $user)
214  {
215  $this->userownerid = $user->id;
216  $this->type_id = $this->fk_action;
217  $this->socid = $this->fk_soc;
218  $this->datef = $this->datep2;
219  $this->note_private = $this->note;
220  }
221 
227  protected function getActionCommFields()
228  {
229  $this->fk_action = $this->type_id;
230  $this->fk_soc = $this->socid;
231  $this->datep2 = $this->datef;
232  }
233 
244  public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
245  {
246  global $dolibarr_main_url_root, $conf, $langs;
247 
248  $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
249 
250  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode($id).'&type=conf';
251 
252  $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2);
253  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
254 
255  /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
256  $this->pubregister = $link_subscription;*/
257 
258  $this->getActionCommFields();
259  return $result;
260  }
261 
273  public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
274  {
275  //TODO set percent according status
276  global $conf;
277 
278  dol_syslog(__METHOD__, LOG_DEBUG);
279 
280  $records = array();
281 
282  $sql = 'SELECT ';
283  $sql .= $this->getFieldList('t');
284  $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
285  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
286  if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
287  $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
288  } else {
289  $sql .= ' WHERE 1 = 1';
290  }
291  // Manage filter
292  $sqlwhere = array();
293  if (count($filter) > 0) {
294  foreach ($filter as $key => $value) {
295  if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
296  $sqlwhere[] = $key." = ".((int) $value);
297  } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
298  $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
299  } elseif ($key == 'customsql') {
300  $sqlwhere[] = $value;
301  } elseif (strpos($value, '%') === false) {
302  $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
303  } else {
304  $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
305  }
306  }
307  }
308  if (count($sqlwhere) > 0) {
309  $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
310  }
311 
312  if (!empty($sortfield)) {
313  $sql .= $this->db->order($sortfield, $sortorder);
314  }
315  if (!empty($limit)) {
316  $sql .= $this->db->plimit($limit, $offset);
317  }
318 
319  $resql = $this->db->query($sql);
320  if ($resql) {
321  $num = $this->db->num_rows($resql);
322  $i = 0;
323  while ($i < ($limit ? min($limit, $num) : $num)) {
324  $obj = $this->db->fetch_object($resql);
325 
326  $record = new self($this->db);
327  $record->setVarsFromFetchObj($obj);
328 
329  $records[$record->id] = $record;
330 
331  $i++;
332  }
333  $this->db->free($resql);
334 
335  return $records;
336  } else {
337  $this->errors[] = 'Error '.$this->db->lasterror();
338  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
339 
340  return -1;
341  }
342  }
343 
351  public function update(User $user, $notrigger = false)
352  {
353  $this->setPercentageFromStatus();
354  $this->setActionCommFields($user);
355  return parent::update($user, $notrigger);
356  }
357 
364  public function delete($notrigger = false)
365  {
366  //TODO delete attendees and subscription
367  return parent::delete($notrigger);
368  }
369 
377  public function validate($user, $notrigger = 0)
378  {
379  global $conf, $langs;
380 
381  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
382 
383  $error = 0;
384 
385  // Protection
386  if ($this->status == self::STATUS_CONFIRMED) {
387  dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
388  return 0;
389  }
390 
391  $now = dol_now();
392 
393  $this->db->begin();
394 
395  // Validate
396  $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
397  $sql .= " status = ".self::STATUS_CONFIRMED;
398  $sql .= " WHERE id = ".$this->id;
399 
400  dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
401  $resql = $this->db->query($sql);
402  if (!$resql) {
403  dol_print_error($this->db);
404  $this->error = $this->db->lasterror();
405  $error++;
406  }
407 
408  if (!$error && !$notrigger) {
409  // Call trigger
410  $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
411  if ($result < 0) {
412  $error++;
413  }
414  // End call triggers
415  }
416 
417  // Set new ref and current status
418  if (!$error) {
419  $this->status = self::STATUS_CONFIRMED;
420  }
421 
422  if (!$error) {
423  $this->db->commit();
424  return 1;
425  } else {
426  $this->db->rollback();
427  return -1;
428  }
429  }
430 
431 
439  public function setDraft($user, $notrigger = 0)
440  {
441  // Protection
442  if ($this->status <= self::STATUS_DRAFT) {
443  return 0;
444  }
445 
446  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
447  || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
448  {
449  $this->error='Permission denied';
450  return -1;
451  }*/
452 
453  return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
454  }
455 
463  public function cancel($user, $notrigger = 0)
464  {
465  // Protection
466  if ($this->status != self::STATUS_CONFIRMED) {
467  return 0;
468  }
469 
470  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
471  || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
472  {
473  $this->error='Permission denied';
474  return -1;
475  }*/
476 
477  return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
478  }
479 
487  public function reopen($user, $notrigger = 0)
488  {
489  // Protection
490  if ($this->status != self::STATUS_CANCELED) {
491  return 0;
492  }
493 
494  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
495  || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
496  {
497  $this->error='Permission denied';
498  return -1;
499  }*/
500 
501  return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
502  }
503 
517  public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
518  {
519  global $conf, $langs, $hookmanager;
520 
521  if (!empty($conf->dol_no_mouse_hover)) {
522  $notooltip = 1; // Force disable tooltips
523  }
524 
525  $result = '';
526 
527  $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
528  if (isset($this->status)) {
529  $label .= ' '.$this->getLibStatut(5);
530  }
531  $label .= '<br>';
532  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
533 
534  $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
535 
536  if ($option != 'nolink') {
537  // Add param to save lastsearch_values or not
538  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
539  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
540  $add_save_lastsearch_values = 1;
541  }
542  if ($add_save_lastsearch_values) {
543  $url .= '&save_lastsearch_values=1';
544  }
545  if ($option == 'withproject') {
546  $url .= '&withproject=1';
547  }
548  }
549 
550  $linkclose = '';
551  if (empty($notooltip)) {
552  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
553  $label = $langs->trans("ShowConferenceOrBooth");
554  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
555  }
556  //$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
557  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
558  } else {
559  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
560  }
561 
562  $linkstart = '<a href="'.$url.'"';
563  $linkstart .= $linkclose.'>';
564  $linkend = '</a>';
565 
566  $result .= $linkstart;
567 
568  if (empty($this->showphoto_on_popup)) {
569  if ($withpicto) {
570  $picto = img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
571  // var_dump($picto);
572  $result .= $picto;
573  }
574  } else {
575  if ($withpicto) {
576  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
577 
578  //list($class, $module) = explode('@', $this->picto);
579  $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
580  $filearray = dol_dir_list($upload_dir, "files");
581  $filename = $filearray[0]['name'];
582  if (!empty($filename)) {
583  $pospoint = strpos($filearray[0]['name'], '.');
584 
585  $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
586  $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=eventorganisation&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
587 
588  $result .= '</div>';
589  } else {
590  $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);
591  }
592  }
593  }
594 
595  if ($withpicto != 2) {
596  $result .= $this->ref;
597  }
598 
599  $result .= $linkend;
600  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
601 
602  global $action, $hookmanager;
603  $hookmanager->initHooks(array('conferenceorboothdao'));
604  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
605  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
606  if ($reshook > 0) {
607  $result = $hookmanager->resPrint;
608  } else {
609  $result .= $hookmanager->resPrint;
610  }
611 
612  return $result;
613  }
614 
622  public function getLibStatut($mode = 0, $hidenastatus = 0)
623  {
624  return $this->LibStatutEvent($this->status, $mode);
625  }
626 
627  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
635  public function LibStatutEvent($status, $mode = 0)
636  {
637  // phpcs:enable
638  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
639  global $langs;
640  //$langs->load("eventorganization@eventorganization");
641  $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
642  $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
643  $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
644  $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
645  $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
646  $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
647  $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
648  $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
649  $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
650  $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
651  $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
652  $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
653  }
654 
655  $statusType = 'status'.$status;
656  //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
657  if ($status == self::STATUS_CANCELED) {
658  $statusType = 'status6';
659  }
660 
661  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
662  }
663 
670  public function info($id)
671  {
672  $sql = 'SELECT rowid, datec as datec, tms as datem,';
673  $sql .= ' fk_user_author, fk_user_mod';
674  $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
675  $sql .= ' WHERE t.id = '.((int) $id);
676  $result = $this->db->query($sql);
677  if ($result) {
678  if ($this->db->num_rows($result)) {
679  $obj = $this->db->fetch_object($result);
680  $this->id = $obj->rowid;
681 
682  $this->user_creation_id = $obj->fk_user_creat;
683  $this->user_modification_id = $obj->fk_user_modif;
684  $this->date_creation = $this->db->jdate($obj->datec);
685  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
686  }
687 
688  $this->db->free($result);
689  } else {
690  dol_print_error($this->db);
691  }
692  }
693 
700  public function initAsSpecimen()
701  {
702  $this->initAsSpecimenCommon();
703  }
704 
710  /*public function getLinesArray()
711  {
712  $this->lines = array();
713 
714  $objectline = new ConferenceOrBoothLine($this->db);
715  $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorbooth = '.((int) $this->id)));
716 
717  if (is_numeric($result)) {
718  $this->error = $objectline->error;
719  $this->errors = $objectline->errors;
720  return $result;
721  } else {
722  $this->lines = $result;
723  return $this->lines;
724  }
725  }*/
726 
738  public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
739  {
740  global $conf, $langs;
741 
742  $result = 0;
743  $includedocgeneration = 0;
744 
745  $langs->load("eventorganization@eventorganization");
746 
747  if (!dol_strlen($modele)) {
748  $modele = 'standard_conferenceorbooth';
749 
750  if (!empty($this->model_pdf)) {
751  $modele = $this->model_pdf;
752  } elseif (!empty($conf->global->CONFERENCEORBOOTH_ADDON_PDF)) {
753  $modele = $conf->global->CONFERENCEORBOOTH_ADDON_PDF;
754  }
755  }
756 
757  $modelpath = "core/modules/eventorganization/doc/";
758 
759  if ($includedocgeneration && !empty($modele)) {
760  $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
761  }
762 
763  return $result;
764  }
765 
773  public function doScheduledJob()
774  {
775  global $conf, $langs;
776 
777  //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
778 
779  $error = 0;
780  $this->output = '';
781  $this->error = '';
782 
783  dol_syslog(__METHOD__, LOG_DEBUG);
784 
785  $now = dol_now();
786 
787  $this->db->begin();
788 
789  // ...
790 
791  $this->db->commit();
792 
793  return $error;
794  }
795 }
CommonObject\setStatusCommon
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
Definition: commonobject.class.php:9851
db
$conf db
API class for accounts.
Definition: inc.php:41
ConferenceOrBooth\LibStatutEvent
LibStatutEvent($status, $mode=0)
Return the status.
Definition: conferenceorbooth.class.php:635
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1225
ActionComm
Class to manage agenda events (actions)
Definition: actioncomm.class.php:38
DoliDB
Class to manage Dolibarr database access.
Definition: DoliDB.class.php:30
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4993
ref
$object ref
Definition: info.php:78
dol_dir_list
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:61
ConferenceOrBooth\setActionCommFields
setActionCommFields(User $user)
Set action comm fields.
Definition: conferenceorbooth.class.php:213
ConferenceOrBooth\getLibStatut
getLibStatut($mode=0, $hidenastatus=0)
Return the label of the status.
Definition: conferenceorbooth.class.php:622
CommonObject\initAsSpecimenCommon
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: commonobject.class.php:9901
ConferenceOrBooth\fetch
fetch($id, $ref=null, $ref_ext='', $email_msgid='', $loadresources=1)
Load object in memory from the database.
Definition: conferenceorbooth.class.php:244
ConferenceOrBooth\getNomUrl
getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overwritepicto=0, $notooltip=0, $save_lastsearch_value=-1, $morecss='')
Return a link to the object card (with optionaly the picto)
Definition: conferenceorbooth.class.php:517
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4024
CommonObject\commonGenerateDocument
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
Definition: commonobject.class.php:5427
ConferenceOrBooth\reopen
reopen($user, $notrigger=0)
Set back to validated status.
Definition: conferenceorbooth.class.php:487
ConferenceOrBooth\generateDocument
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create an array of lines.
Definition: conferenceorbooth.class.php:738
dol_hash
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
Definition: security.lib.php:215
ConferenceOrBooth\getActionCommFields
getActionCommFields()
Get action comm fields.
Definition: conferenceorbooth.class.php:227
ConferenceOrBooth\setPercentageFromStatus
setPercentageFromStatus()
Set Percentage from status.
Definition: conferenceorbooth.class.php:197
ConferenceOrBooth\cancel
cancel($user, $notrigger=0)
Set cancel status.
Definition: conferenceorbooth.class.php:463
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1628
ConferenceOrBooth\info
info($id)
Load the info information in the object.
Definition: conferenceorbooth.class.php:670
ConferenceOrBooth
Class for ConferenceOrBooth.
Definition: conferenceorbooth.class.php:33
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:82
ConferenceOrBooth\initAsSpecimen
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: conferenceorbooth.class.php:700
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3887
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:137
ConferenceOrBooth\validate
validate($user, $notrigger=0)
Validate object.
Definition: conferenceorbooth.class.php:377
ConferenceOrBooth\setDraft
setDraft($user, $notrigger=0)
Set draft status.
Definition: conferenceorbooth.class.php:439
User
Class to manage Dolibarr users.
Definition: user.class.php:46
ConferenceOrBooth\__construct
__construct(DoliDB $db)
Constructor.
Definition: conferenceorbooth.class.php:146
dolGetStatus
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
Definition: functions.lib.php:10745
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4360
ConferenceOrBooth\create
create(User $user, $notrigger=false)
Create object into database.
Definition: conferenceorbooth.class.php:185
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2951
ConferenceOrBooth\fetchAll
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
Definition: conferenceorbooth.class.php:273
ConferenceOrBooth\update
update(User $user, $notrigger=false)
Update object into database.
Definition: conferenceorbooth.class.php:351
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5818
ConferenceOrBooth\doScheduledJob
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
Definition: conferenceorbooth.class.php:773
CommonObject\getFieldList
getFieldList($alias='')
Function to concat keys of fields.
Definition: commonobject.class.php:9143