dolibarr 24.0.0-beta
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) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Put here all includes required by your class file
27require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
29//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
30
35{
39 public $module = 'eventorganization';
40
44 public $element = 'conferenceorbooth';
45
49 public $table_element = 'actioncomm';
50
54 public $picto = 'conferenceorbooth';
55
56
57 const STATUS_DRAFT = 0;
58 const STATUS_SUGGESTED = 1;
59 const STATUS_CONFIRMED = 2;
60 const STATUS_NOT_QUALIFIED = 3;
61 const STATUS_DONE = 4;
62 const STATUS_CANCELED = 9;
63
64
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', 'csslist' => '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' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'help' => "OrganizationEventLinkToThirdParty", 'picto' => 'company', 'csslist' => 'tdoverflowmax100', 'css' => 'maxwidth500'),
111 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3),
112 'fk_action' => array('type' => "sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label' => 'ConferenceOrBoothFormat', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'css' => 'width200', '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 );
126 public $rowid;
130 public $id;
134 public $label;
138 public $fk_soc;
142 public $fk_project;
146 public $note;
150 public $fk_action;
154 public $datec;
155
159 public $fk_user_author;
163 public $fk_user_mod;
167 public $import_key;
168
172 public $status;
173 // END MODULEBUILDER PROPERTIES
174
175 //public $pubregister;
176
177
183 public function __construct(DoliDB $db)
184 {
185 global $langs;
186
187 $this->db = $db;
188
189 $this->ismultientitymanaged = 1;
190 $this->isextrafieldmanaged = 1;
191
192 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
193 $this->fields['id']['visible'] = 0;
194 }
195 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
196 $this->fields['entity']['enabled'] = 0;
197 }
198
199 // Unset fields that are disabled
200 foreach ($this->fields as $key => $val) {
201 if (isset($val['enabled']) && empty($val['enabled'])) {
202 unset($this->fields[$key]);
203 }
204 }
205
206 // Translate some data of arrayofkeyval
207 if (is_object($langs)) {
208 foreach ($this->fields as $key => $val) {
209 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
210 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
211 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
212 }
213 }
214 }
215 }
216 }
217
225 public function create(User $user, $notrigger = 0)
226 {
228 $this->setActionCommFields($user);
229 return parent::create($user, $notrigger);
230 }
231
237 protected function setPercentageFromStatus()
238 {
239 if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_SUGGESTED || $this->status == self::STATUS_NOT_QUALIFIED || $this->status == self::STATUS_CANCELED) {
240 $this->percentage = -1;
241 }
242 if ($this->status == self::STATUS_CONFIRMED) {
243 $this->percentage = 0;
244 }
245 if ($this->status == self::STATUS_DONE) {
246 $this->percentage = 100;
247 }
248 }
249
256 protected function setActionCommFields(User $user)
257 {
258 $this->userownerid = $user->id;
259 $this->type_id = $this->fk_action;
260 $this->socid = $this->fk_soc;
261 $this->datef = $this->datep2;
262 $this->note_private = $this->note;
263 }
264
270 protected function getActionCommFields()
271 {
272 $this->fk_action = $this->type_id;
273 $this->fk_soc = $this->socid;
274 $this->datep2 = $this->datef;
275 }
276
287 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
288 {
290
291 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
292
293 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
294
295 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $id), 'md5');
296 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
297
298 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
299 $this->pubregister = $link_subscription;*/
300
301 $this->getActionCommFields();
302
303 return $result;
304 }
305
318 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
319 {
320 dol_syslog(__METHOD__, LOG_DEBUG);
321
322 $records = array();
323
324 $sql = 'SELECT ';
325 $sql .= $this->getFieldList('t');
326 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
327 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
328 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
329 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
330 } else {
331 $sql .= ' WHERE 1 = 1';
332 }
333
334 // Manage filter
335 if (is_array($filter)) { // deprecated, use $filter = USF syntax
336 dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING);
337 $sqlwhere = array();
338 if (count($filter) > 0) {
339 foreach ($filter as $key => $value) {
340 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
341 $sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
342 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
343 $sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate((int) $value)."'";
344 } elseif ($key == 'customsql') {
345 $sqlwhere[] = $value; // deprecated
346 } elseif (strpos($value, '%') === false) {
347 $sqlwhere[] = $this->db->sanitize($key).' IN ('.$this->db->sanitize($this->db->escape($value)).')';
348 } else {
349 $sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($value)."%'";
350 }
351 }
352 }
353 if (count($sqlwhere) > 0) {
354 $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
355 }
356
357 $filter = '';
358 }
359
360 // Manage filter
361 $errormessage = '';
362 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
363 if ($errormessage) {
364 $this->errors[] = $errormessage;
365 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
366 return -1;
367 }
368
369 if (!empty($sortfield)) {
370 $sql .= $this->db->order($sortfield, $sortorder);
371 }
372 if (!empty($limit)) {
373 $sql .= $this->db->plimit($limit, $offset);
374 }
375
376 $resql = $this->db->query($sql);
377 if ($resql) {
378 $num = $this->db->num_rows($resql);
379 $i = 0;
380 while ($i < ($limit ? min($limit, $num) : $num)) {
381 $obj = $this->db->fetch_object($resql);
382
383 $record = new self($this->db);
384 $record->setVarsFromFetchObj($obj);
385
386 $records[$record->id] = $record;
387
388 $i++;
389 }
390 $this->db->free($resql);
391
392 return $records;
393 } else {
394 $this->errors[] = 'Error '.$this->db->lasterror();
395 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
396
397 return -1;
398 }
399 }
400
408 public function update(User $user, $notrigger = 0)
409 {
411
412 $this->setActionCommFields($user);
413
414 return parent::update($user, $notrigger);
415 }
416
424 public function delete($user, $notrigger = 0)
425 {
426 //TODO delete attendees and subscription
427 return parent::delete($user, $notrigger);
428 }
429
437 public function validate($user, $notrigger = 0)
438 {
439 global $conf, $langs;
440
441 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
442
443 $error = 0;
444
445 // Protection
446 if ($this->status == self::STATUS_CONFIRMED) {
447 dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING);
448 return 0;
449 }
450
451 $now = dol_now();
452
453 $this->db->begin();
454
455 // Validate
456 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
457 $sql .= " status = ".self::STATUS_CONFIRMED;
458 $sql .= " WHERE id = ".((int) $this->id);
459
460 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
461 $resql = $this->db->query($sql);
462 if (!$resql) {
463 dol_print_error($this->db);
464 $this->error = $this->db->lasterror();
465 $error++;
466 }
467
468 if (!$error && !$notrigger) {
469 // Call trigger
470 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
471 if ($result < 0) {
472 $error++;
473 }
474 // End call triggers
475 }
476
477 // Set new ref and current status
478 if (!$error) {
479 $this->status = self::STATUS_CONFIRMED;
480 }
481
482 if (!$error) {
483 $this->db->commit();
484 return 1;
485 } else {
486 $this->db->rollback();
487 return -1;
488 }
489 }
490
491
499 public function setDraft($user, $notrigger = 0)
500 {
501 // Protection
502 if ($this->status <= self::STATUS_DRAFT) {
503 return 0;
504 }
505
506 return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
507 }
508
516 public function cancel($user, $notrigger = 0)
517 {
518 // Protection
519 if ($this->status != self::STATUS_CONFIRMED) {
520 return 0;
521 }
522
523 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
524 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
525 {
526 $this->error='Permission denied';
527 return -1;
528 }*/
529
530 return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
531 }
532
540 public function reopen($user, $notrigger = 0)
541 {
542 // Protection
543 if ($this->status != self::STATUS_CANCELED) {
544 return 0;
545 }
546
547 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
548 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
549 {
550 $this->error='Permission denied';
551 return -1;
552 }*/
553
554 return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
555 }
556
570 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
571 {
572 global $conf, $langs, $hookmanager;
573
574 if (!empty($conf->dol_no_mouse_hover)) {
575 $notooltip = 1; // Force disable tooltips
576 }
577
578 $result = '';
579
580 $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
581 if (isset($this->status)) {
582 $label .= ' '.$this->getLibStatut(5);
583 }
584 $label .= '<br>';
585 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
586
587 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
588
589 if ($option != 'nolink') {
590 // Add param to save lastsearch_values or not
591 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
592 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
593 $add_save_lastsearch_values = 1;
594 }
595 if ($add_save_lastsearch_values) {
596 $url .= '&save_lastsearch_values=1';
597 }
598 if ($option == 'withproject') {
599 $url .= '&withproject=1';
600 }
601 if ($option == 'thirdpartyid') {
602 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php?thirdpartyid='.$this->id;
603 }
604 }
605
606 $linkclose = '';
607 if (empty($notooltip)) {
608 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
609 $label = $langs->trans("ShowConferenceOrBooth");
610 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
611 }
612 //$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
613 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
614 } else {
615 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
616 }
617
618 $linkstart = '<a href="'.$url.'"';
619 $linkstart .= $linkclose.'>';
620 $linkend = '</a>';
621
622 $result .= $linkstart;
623
624 if (empty($this->showphoto_on_popup)) {
625 if ($withpicto) {
626 $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);
627 // var_dump($picto);
628 $result .= $picto;
629 }
630 } else {
631 if ($withpicto) {
632 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
633
634 //list($class, $module) = explode('@', $this->picto);
635 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
636 $filearray = dol_dir_list($upload_dir, "files");
637 $filename = $filearray[0]['name'];
638 if (!empty($filename)) {
639 $pospoint = strpos($filearray[0]['name'], '.');
640
641 $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
642 $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>';
643
644 $result .= '</div>';
645 } else {
646 $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);
647 }
648 }
649 }
650
651 if ($withpicto != 2) {
652 $result .= $this->ref;
653 }
654
655 $result .= $linkend;
656 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
657
658 global $action, $hookmanager;
659 $hookmanager->initHooks(array('conferenceorboothdao'));
660 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
661 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
662 if ($reshook > 0) {
663 $result = $hookmanager->resPrint;
664 } else {
665 $result .= $hookmanager->resPrint;
666 }
667
668 return $result;
669 }
670
678 public function getLibStatut($mode = 0, $hidenastatus = 0)
679 {
680 return $this->LibStatutEvent($this->status, $mode);
681 }
682
683 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
691 public function LibStatutEvent($status, $mode = 0)
692 {
693 // phpcs:enable
694 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
695 global $langs;
696 //$langs->load("eventorganization@eventorganization");
697 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
698 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
699 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
700 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
701 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
702 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
703 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
704 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
705 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
706 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
707 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
708 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
709 }
710
711 $statusType = 'status'.$status;
712 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
713 if ($status == self::STATUS_CANCELED) {
714 $statusType = 'status6';
715 }
716
717 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
718 }
719
727 public function getKanbanView($option = '', $arraydata = null)
728 {
729 global $conf, $langs;
730
731 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
732
733 $return = '<div class="box-flex-item box-flex-grow-zero">';
734 $return .= '<div class="info-box info-box-sm">';
735 $return .= '<span class="info-box-icon bg-infobox-action">';
736 $return .= img_picto('', $this->picto);
737 $return .= '</span>';
738 $return .= '<div class="info-box-content">';
739 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
740 if ($selected >= 0) {
741 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
742 }
743 if (!empty($this->label)) {
744 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
745 }
746 if (isset($this->thirdparty) && is_object($this->thirdparty)) {
747 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
748 }
749 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
750 $return .= '</div>';
751 $return .= '</div>';
752 $return .= '</div>';
753
754 return $return;
755 }
756
763 public function info($id)
764 {
765 $sql = 'SELECT rowid, datec as datec, tms as datem,';
766 $sql .= ' fk_user_author, fk_user_mod';
767 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
768 $sql .= ' WHERE t.id = '.((int) $id);
769 $result = $this->db->query($sql);
770 if ($result) {
771 if ($this->db->num_rows($result)) {
772 $obj = $this->db->fetch_object($result);
773
774 $this->id = $obj->rowid;
775
776 $this->user_creation_id = $obj->fk_user_creat;
777 $this->user_modification_id = $obj->fk_user_modif;
778 $this->date_creation = $this->db->jdate($obj->datec);
779 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
780 }
781
782 $this->db->free($result);
783 } else {
784 dol_print_error($this->db);
785 }
786 }
787
794 public function initAsSpecimen()
795 {
796 return $this->initAsSpecimenCommon();
797 }
798
810 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
811 {
812 global $conf, $langs;
813
814 $result = 0;
815
816 $langs->load("eventorganization@eventorganization");
817
818 if (!dol_strlen($modele)) {
819 $modele = 'standard_conferenceorbooth';
820
821 if (!empty($this->model_pdf)) {
822 $modele = $this->model_pdf;
823 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
824 $modele = getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF');
825 }
826 }
827
828 $modelpath = "core/modules/eventorganization/doc/";
829
830 if (!empty($modele)) {
831 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
832 }
833
834 return $result;
835 }
836
844 public function doScheduledJob()
845 {
846 global $conf, $langs;
847
848 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
849
850 $error = 0;
851 $this->output = '';
852 $this->error = '';
853
854 dol_syslog(__METHOD__, LOG_DEBUG);
855
856 $now = dol_now();
857
858 $this->db->begin();
859
860 // ...
861
862 $this->db->commit();
863
864 return $error;
865 }
866}
global $dolibarr_main_url_root
$object ref
Definition info.php:90
Class to manage agenda events (actions)
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
Class for ConferenceOrBooth.
getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overwritepicto=0, $notooltip=0, $save_lastsearch_value=-1, $morecss='')
Return a link to the object card (with optionally the picto)
getActionCommFields()
Get action comm fields.
create(User $user, $notrigger=0)
Create object into database.
info($id)
Load the info information in the object.
reopen($user, $notrigger=0)
Set back to validated status.
fetch($id, $ref=null, $ref_ext='', $email_msgid='', $loadresources=1)
Load object in memory from the database.
setPercentageFromStatus()
Set the percentage of actioncomm from the status of the booth or conference.
setDraft($user, $notrigger=0)
Set draft status.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
cancel($user, $notrigger=0)
Set cancel status.
LibStatutEvent($status, $mode=0)
Return the status.
setActionCommFields(User $user)
Set action comm fields.
__construct(DoliDB $db)
Constructor.
getLibStatut($mode=0, $hidenastatus=0)
Return the label of the status.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
validate($user, $notrigger=0)
Validate object.
update(User $user, $notrigger=0)
Update object into database.
getKanbanView($option='', $arraydata=null)
Return a thumb for kanban views.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition index.php:168
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_dir_list($utf8_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:64
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.