dolibarr  16.0.5
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', 'comment'=>"Id"),
108  'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',),
109  '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', 'css'=>'tdoverflowmax150 maxwidth500'),
110  'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
111  'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
112  'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),
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,),
116  'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
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',),
118  'fk_user_mod' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
119  'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
120  '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'),),
121  'num_vote' => array('type'=>'smallint', 'label'=>'NbVotes', 'enabled'=>'1', 'position'=>1001, 'notnull'=>-1, 'visible'=>5, 'default'=>'0', 'index'=>0),
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 (empty($conf->multicompany->enabled) && 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  $this->fk_user_author = $this->fk_user_author;
221  }
222 
228  protected function getActionCommFields()
229  {
230  $this->fk_action = $this->type_id;
231  $this->fk_soc = $this->socid;
232  $this->datep2 = $this->datef;
233  }
234 
245  public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
246  {
247  global $dolibarr_main_url_root, $conf, $langs;
248 
249  $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
250 
251  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode($id).'&type=conf';
252 
253  $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
254  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
255 
256  /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
257  $this->pubregister = $link_subscription;*/
258 
259  $this->getActionCommFields();
260  return $result;
261  }
262 
274  public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
275  {
276  //TODO set percent according status
277  global $conf;
278 
279  dol_syslog(__METHOD__, LOG_DEBUG);
280 
281  $records = array();
282 
283  $sql = 'SELECT ';
284  $sql .= $this->getFieldList('t');
285  $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
286  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
287  if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
288  $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
289  } else {
290  $sql .= ' WHERE 1 = 1';
291  }
292  // Manage filter
293  $sqlwhere = array();
294  if (count($filter) > 0) {
295  foreach ($filter as $key => $value) {
296  if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
297  $sqlwhere[] = $key." = ".((int) $value);
298  } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
299  $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
300  } elseif ($key == 'customsql') {
301  $sqlwhere[] = $value;
302  } elseif (strpos($value, '%') === false) {
303  $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
304  } else {
305  $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
306  }
307  }
308  }
309  if (count($sqlwhere) > 0) {
310  $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
311  }
312 
313  if (!empty($sortfield)) {
314  $sql .= $this->db->order($sortfield, $sortorder);
315  }
316  if (!empty($limit)) {
317  $sql .= $this->db->plimit($limit, $offset);
318  }
319 
320  $resql = $this->db->query($sql);
321  if ($resql) {
322  $num = $this->db->num_rows($resql);
323  $i = 0;
324  while ($i < ($limit ? min($limit, $num) : $num)) {
325  $obj = $this->db->fetch_object($resql);
326 
327  $record = new self($this->db);
328  $record->setVarsFromFetchObj($obj);
329 
330  $records[$record->id] = $record;
331 
332  $i++;
333  }
334  $this->db->free($resql);
335 
336  return $records;
337  } else {
338  $this->errors[] = 'Error '.$this->db->lasterror();
339  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
340 
341  return -1;
342  }
343  }
344 
352  public function update(User $user, $notrigger = false)
353  {
354  $this->setPercentageFromStatus();
355  $this->setActionCommFields($user);
356  return parent::update($user, $notrigger);
357  }
358 
365  public function delete($notrigger = false)
366  {
367  //TODO delete attendees and subscription
368  return parent::delete($notrigger);
369  }
370 
378  public function validate($user, $notrigger = 0)
379  {
380  global $conf, $langs;
381 
382  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
383 
384  $error = 0;
385 
386  // Protection
387  if ($this->status == self::STATUS_CONFIRMED) {
388  dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
389  return 0;
390  }
391 
392  $now = dol_now();
393 
394  $this->db->begin();
395 
396  // Validate
397  $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
398  $sql .= " status = ".self::STATUS_CONFIRMED;
399  $sql .= " WHERE id = ".$this->id;
400 
401  dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
402  $resql = $this->db->query($sql);
403  if (!$resql) {
404  dol_print_error($this->db);
405  $this->error = $this->db->lasterror();
406  $error++;
407  }
408 
409  if (!$error && !$notrigger) {
410  // Call trigger
411  $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
412  if ($result < 0) {
413  $error++;
414  }
415  // End call triggers
416  }
417 
418  // Set new ref and current status
419  if (!$error) {
420  $this->status = self::STATUS_CONFIRMED;
421  }
422 
423  if (!$error) {
424  $this->db->commit();
425  return 1;
426  } else {
427  $this->db->rollback();
428  return -1;
429  }
430  }
431 
432 
440  public function setDraft($user, $notrigger = 0)
441  {
442  // Protection
443  if ($this->status <= self::STATUS_DRAFT) {
444  return 0;
445  }
446 
447  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->write))
448  || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->eventorganization_advance->validate))))
449  {
450  $this->error='Permission denied';
451  return -1;
452  }*/
453 
454  return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
455  }
456 
464  public function cancel($user, $notrigger = 0)
465  {
466  // Protection
467  if ($this->status != self::STATUS_CONFIRMED) {
468  return 0;
469  }
470 
471  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->write))
472  || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->eventorganization_advance->validate))))
473  {
474  $this->error='Permission denied';
475  return -1;
476  }*/
477 
478  return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
479  }
480 
488  public function reopen($user, $notrigger = 0)
489  {
490  // Protection
491  if ($this->status != self::STATUS_CANCELED) {
492  return 0;
493  }
494 
495  /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->write))
496  || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->eventorganization_advance->validate))))
497  {
498  $this->error='Permission denied';
499  return -1;
500  }*/
501 
502  return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
503  }
504 
518  public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
519  {
520  global $conf, $langs, $hookmanager;
521 
522  if (!empty($conf->dol_no_mouse_hover)) {
523  $notooltip = 1; // Force disable tooltips
524  }
525 
526  $result = '';
527 
528  $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
529  if (isset($this->status)) {
530  $label .= ' '.$this->getLibStatut(5);
531  }
532  $label .= '<br>';
533  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
534 
535  $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
536 
537  if ($option != 'nolink') {
538  // Add param to save lastsearch_values or not
539  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
540  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
541  $add_save_lastsearch_values = 1;
542  }
543  if ($add_save_lastsearch_values) {
544  $url .= '&save_lastsearch_values=1';
545  }
546  if ($option == 'withproject') {
547  $url .= '&withproject=1';
548  }
549  }
550 
551  $linkclose = '';
552  if (empty($notooltip)) {
553  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
554  $label = $langs->trans("ShowConferenceOrBooth");
555  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
556  }
557  //$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
558  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
559  } else {
560  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
561  }
562 
563  $linkstart = '<a href="'.$url.'"';
564  $linkstart .= $linkclose.'>';
565  $linkend = '</a>';
566 
567  $result .= $linkstart;
568 
569  if (empty($this->showphoto_on_popup)) {
570  if ($withpicto) {
571  $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);
572  // var_dump($picto);
573  $result .= $picto;
574  }
575  } else {
576  if ($withpicto) {
577  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
578 
579  //list($class, $module) = explode('@', $this->picto);
580  $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
581  $filearray = dol_dir_list($upload_dir, "files");
582  $filename = $filearray[0]['name'];
583  if (!empty($filename)) {
584  $pospoint = strpos($filearray[0]['name'], '.');
585 
586  $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
587  $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>';
588 
589  $result .= '</div>';
590  } else {
591  $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);
592  }
593  }
594  }
595 
596  if ($withpicto != 2) {
597  $result .= $this->ref;
598  }
599 
600  $result .= $linkend;
601  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
602 
603  global $action, $hookmanager;
604  $hookmanager->initHooks(array('conferenceorboothdao'));
605  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
606  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
607  if ($reshook > 0) {
608  $result = $hookmanager->resPrint;
609  } else {
610  $result .= $hookmanager->resPrint;
611  }
612 
613  return $result;
614  }
615 
623  public function getLibStatut($mode = 0, $hidenastatus = 0)
624  {
625  return $this->LibStatutEvent($this->status, $mode);
626  }
627 
628  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
636  public function LibStatutEvent($status, $mode = 0)
637  {
638  // phpcs:enable
639  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
640  global $langs;
641  //$langs->load("eventorganization@eventorganization");
642  $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
643  $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
644  $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
645  $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
646  $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
647  $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
648  $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
649  $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
650  $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
651  $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
652  $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
653  $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
654  }
655 
656  $statusType = 'status'.$status;
657  //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
658  if ($status == self::STATUS_CANCELED) {
659  $statusType = 'status6';
660  }
661 
662  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
663  }
664 
671  public function info($id)
672  {
673  $sql = 'SELECT rowid, datec as datec, tms as datem,';
674  $sql .= ' fk_user_author, fk_user_mod';
675  $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
676  $sql .= ' WHERE t.id = '.((int) $id);
677  $result = $this->db->query($sql);
678  if ($result) {
679  if ($this->db->num_rows($result)) {
680  $obj = $this->db->fetch_object($result);
681  $this->id = $obj->rowid;
682 
683  $this->user_creation_id = $obj->fk_user_creat;
684  $this->user_modification_id = $obj->fk_user_modif;
685  $this->date_creation = $this->db->jdate($obj->datec);
686  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
687  }
688 
689  $this->db->free($result);
690  } else {
691  dol_print_error($this->db);
692  }
693  }
694 
701  public function initAsSpecimen()
702  {
703  $this->initAsSpecimenCommon();
704  }
705 
711  /*public function getLinesArray()
712  {
713  $this->lines = array();
714 
715  $objectline = new ConferenceOrBoothLine($this->db);
716  $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorbooth = '.((int) $this->id)));
717 
718  if (is_numeric($result)) {
719  $this->error = $this->error;
720  $this->errors = $this->errors;
721  return $result;
722  } else {
723  $this->lines = $result;
724  return $this->lines;
725  }
726  }*/
727 
739  public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
740  {
741  global $conf, $langs;
742 
743  $result = 0;
744  $includedocgeneration = 0;
745 
746  $langs->load("eventorganization@eventorganization");
747 
748  if (!dol_strlen($modele)) {
749  $modele = 'standard_conferenceorbooth';
750 
751  if (!empty($this->model_pdf)) {
752  $modele = $this->model_pdf;
753  } elseif (!empty($conf->global->CONFERENCEORBOOTH_ADDON_PDF)) {
754  $modele = $conf->global->CONFERENCEORBOOTH_ADDON_PDF;
755  }
756  }
757 
758  $modelpath = "core/modules/eventorganization/doc/";
759 
760  if ($includedocgeneration && !empty($modele)) {
761  $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
762  }
763 
764  return $result;
765  }
766 
774  public function doScheduledJob()
775  {
776  global $conf, $langs;
777 
778  //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
779 
780  $error = 0;
781  $this->output = '';
782  $this->error = '';
783 
784  dol_syslog(__METHOD__, LOG_DEBUG);
785 
786  $now = dol_now();
787 
788  $this->db->begin();
789 
790  // ...
791 
792  $this->db->commit();
793 
794  return $error;
795  }
796 }
CommonObject\setStatusCommon
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
Definition: commonobject.class.php:9683
db
$conf db
API class for accounts.
Definition: inc.php:41
ConferenceOrBooth\LibStatutEvent
LibStatutEvent($status, $mode=0)
Return the status.
Definition: conferenceorbooth.class.php:636
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1226
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:4844
ConferenceOrBooth\setActionCommFields
setActionCommFields(User $user)
Set action comm fields.
Definition: conferenceorbooth.class.php:213
ref
$object ref
Definition: info.php:77
ConferenceOrBooth\getLibStatut
getLibStatut($mode=0, $hidenastatus=0)
Return the label of the status.
Definition: conferenceorbooth.class.php:623
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)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:60
CommonObject\initAsSpecimenCommon
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: commonobject.class.php:9733
ConferenceOrBooth\fetch
fetch($id, $ref=null, $ref_ext='', $email_msgid='', $loadresources=1)
Load object in memory from the database.
Definition: conferenceorbooth.class.php:245
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:518
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:3880
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:5406
ConferenceOrBooth\reopen
reopen($user, $notrigger=0)
Set back to validated status.
Definition: conferenceorbooth.class.php:488
ConferenceOrBooth\generateDocument
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create an array of lines.
Definition: conferenceorbooth.class.php:739
dol_hash
dol_hash($chain, $type='0')
Returns a hash of a string.
Definition: security.lib.php:104
ConferenceOrBooth\getActionCommFields
getActionCommFields()
Get action comm fields.
Definition: conferenceorbooth.class.php:228
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:464
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
ConferenceOrBooth\info
info($id)
Load the info information in the object.
Definition: conferenceorbooth.class.php:671
ConferenceOrBooth
Class for ConferenceOrBooth.
Definition: conferenceorbooth.class.php:33
ConferenceOrBooth\initAsSpecimen
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: conferenceorbooth.class.php:701
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
ConferenceOrBooth\validate
validate($user, $notrigger=0)
Validate object.
Definition: conferenceorbooth.class.php:378
ConferenceOrBooth\setDraft
setDraft($user, $notrigger=0)
Set draft status.
Definition: conferenceorbooth.class.php:440
User
Class to manage Dolibarr users.
Definition: user.class.php:44
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:10338
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:4211
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:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
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:274
ConferenceOrBooth\update
update(User $user, $notrigger=false)
Update object into database.
Definition: conferenceorbooth.class.php:352
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5791
ConferenceOrBooth\doScheduledJob
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
Definition: conferenceorbooth.class.php:774
CommonObject\getFieldList
getFieldList($alias='')
Function to concat keys of fields.
Definition: commonobject.class.php:8987