dolibarr 25.0.0-alpha
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 'max_participants' => array('type' => 'integer', 'label' => 'MaxNbOfAttendees', 'enabled' => 1, 'position' => 72, 'notnull' => -1, 'visible' => 1),
116 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'),
117 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'),
118 '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'),
119 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax100'),
120 'num_vote' => array('type' => 'smallint', 'label' => 'NbVotes', 'enabled' => 1, 'position' => 800, 'notnull' => -1, 'visible' => 5, 'default' => '0', 'index' => 0),
121 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,),
122 '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'),),
123 );
127 public $rowid;
131 public $id;
135 public $label;
139 public $fk_soc;
143 public $fk_project;
147 public $note;
151 public $fk_action;
155 public $datec;
156
160 public $max_participants;
161
165 public $fk_user_author;
169 public $fk_user_mod;
173 public $import_key;
174
178 public $status;
179 // END MODULEBUILDER PROPERTIES
180
181 //public $pubregister;
182
183
189 public function __construct(DoliDB $db)
190 {
191 global $langs;
192
193 $this->db = $db;
194
195 $this->ismultientitymanaged = 1;
196 $this->isextrafieldmanaged = 1;
197
198 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
199 $this->fields['id']['visible'] = 0;
200 }
201 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
202 $this->fields['entity']['enabled'] = 0;
203 }
204
205 // Unset fields that are disabled
206 foreach ($this->fields as $key => $val) {
207 if (isset($val['enabled']) && empty($val['enabled'])) {
208 unset($this->fields[$key]);
209 }
210 }
211
212 // Translate some data of arrayofkeyval
213 if (is_object($langs)) {
214 foreach ($this->fields as $key => $val) {
215 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
216 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
217 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
218 }
219 }
220 }
221 }
222 }
223
231 public function create(User $user, $notrigger = 0)
232 {
234 $this->setActionCommFields($user);
235 return parent::create($user, $notrigger);
236 }
237
243 protected function setPercentageFromStatus()
244 {
245 if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_SUGGESTED || $this->status == self::STATUS_NOT_QUALIFIED || $this->status == self::STATUS_CANCELED) {
246 $this->percentage = -1;
247 }
248 if ($this->status == self::STATUS_CONFIRMED) {
249 $this->percentage = 0;
250 }
251 if ($this->status == self::STATUS_DONE) {
252 $this->percentage = 100;
253 }
254 }
255
262 protected function setActionCommFields(User $user)
263 {
264 $this->userownerid = $user->id;
265 $this->type_id = $this->fk_action;
266 $this->socid = $this->fk_soc;
267 $this->datef = $this->datep2;
268 $this->note_private = $this->note;
269 }
270
276 protected function getActionCommFields()
277 {
278 $this->fk_action = $this->type_id;
279 $this->fk_soc = $this->socid;
280 $this->datep2 = $this->datef;
281 }
282
293 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
294 {
296
297 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
298
299 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
300
301 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $id), 'md5');
302 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
303
304 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
305 $this->pubregister = $link_subscription;*/
306
307 $this->getActionCommFields();
308
309 return $result;
310 }
311
324 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
325 {
326 dol_syslog(__METHOD__, LOG_DEBUG);
327
328 $records = array();
329
330 $sql = 'SELECT ';
331 $sql .= $this->getFieldList('t');
332 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
333 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
334 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
335 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
336 } else {
337 $sql .= ' WHERE 1 = 1';
338 }
339
340 // Manage filter
341 if (is_array($filter)) { // deprecated, use $filter = USF syntax
342 dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING);
343 $sqlwhere = array();
344 if (count($filter) > 0) {
345 foreach ($filter as $key => $value) {
346 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
347 $sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
348 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
349 $sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate((int) $value)."'";
350 } elseif ($key == 'customsql') {
351 $sqlwhere[] = $value; // deprecated
352 } elseif (strpos($value, '%') === false) {
353 $sqlwhere[] = $this->db->sanitize($key).' IN ('.$this->db->sanitize($this->db->escape($value)).')';
354 } else {
355 $sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($value)."%'";
356 }
357 }
358 }
359 if (count($sqlwhere) > 0) {
360 $sql .= ' AND ('.implode(' '.$this->db->sanitize($filtermode).' ', $sqlwhere).')';
361 }
362
363 $filter = '';
364 }
365
366 // Manage filter
367 $errormessage = '';
368 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
369 if ($errormessage) {
370 $this->errors[] = $errormessage;
371 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
372 return -1;
373 }
374
375 if (!empty($sortfield)) {
376 $sql .= $this->db->order($sortfield, $sortorder);
377 }
378 if (!empty($limit)) {
379 $sql .= $this->db->plimit($limit, $offset);
380 }
381
382 $resql = $this->db->query($sql);
383 if ($resql) {
384 $num = $this->db->num_rows($resql);
385 $i = 0;
386 while ($i < ($limit ? min($limit, $num) : $num)) {
387 $obj = $this->db->fetch_object($resql);
388
389 $record = new self($this->db);
390 $record->setVarsFromFetchObj($obj);
391
392 $records[$record->id] = $record;
393
394 $i++;
395 }
396 $this->db->free($resql);
397
398 return $records;
399 } else {
400 $this->errors[] = 'Error '.$this->db->lasterror();
401 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
402
403 return -1;
404 }
405 }
406
414 public function update(User $user, $notrigger = 0)
415 {
417
418 $this->setActionCommFields($user);
419
420 return parent::update($user, $notrigger);
421 }
422
430 public function delete($user, $notrigger = 0)
431 {
432 //TODO delete attendees and subscription
433 return parent::delete($user, $notrigger);
434 }
435
443 public function validate($user, $notrigger = 0)
444 {
445 global $conf, $langs;
446
447 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
448
449 $error = 0;
450
451 // Protection
452 if ($this->status == self::STATUS_CONFIRMED) {
453 dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING);
454 return 0;
455 }
456
457 $now = dol_now();
458
459 $this->db->begin();
460
461 // Validate
462 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
463 $sql .= " SET status = ".self::STATUS_CONFIRMED;
464 $sql .= " WHERE id = ".((int) $this->id);
465
466 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
467 $resql = $this->db->query($sql);
468 if (!$resql) {
469 dol_print_error($this->db);
470 $this->error = $this->db->lasterror();
471 $error++;
472 }
473
474 if (!$error && !$notrigger) {
475 // Call trigger
476 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
477 if ($result < 0) {
478 $error++;
479 }
480 // End call triggers
481 }
482
483 // Set new ref and current status
484 if (!$error) {
485 $this->status = self::STATUS_CONFIRMED;
486 }
487
488 if (!$error) {
489 $this->db->commit();
490 return 1;
491 } else {
492 $this->db->rollback();
493 return -1;
494 }
495 }
496
497
505 public function setDraft($user, $notrigger = 0)
506 {
507 // Protection
508 if ($this->status <= self::STATUS_DRAFT) {
509 return 0;
510 }
511
512 return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
513 }
514
522 public function cancel($user, $notrigger = 0)
523 {
524 // Protection
525 if ($this->status != self::STATUS_CONFIRMED) {
526 return 0;
527 }
528
529 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
530 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
531 {
532 $this->error='Permission denied';
533 return -1;
534 }*/
535
536 return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
537 }
538
546 public function reopen($user, $notrigger = 0)
547 {
548 // Protection
549 if ($this->status != self::STATUS_CANCELED) {
550 return 0;
551 }
552
553 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
554 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
555 {
556 $this->error='Permission denied';
557 return -1;
558 }*/
559
560 return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
561 }
562
576 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
577 {
578 global $conf, $langs, $hookmanager;
579
580 if (!empty($conf->dol_no_mouse_hover)) {
581 $notooltip = 1; // Force disable tooltips
582 }
583
584 $result = '';
585
586 $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
587 if (isset($this->status)) {
588 $label .= ' '.$this->getLibStatut(5);
589 }
590 $label .= '<br>';
591 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
592
593 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
594
595 if ($option != 'nolink') {
596 // Add param to save lastsearch_values or not
597 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
598 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
599 $add_save_lastsearch_values = 1;
600 }
601 if ($add_save_lastsearch_values) {
602 $url .= '&save_lastsearch_values=1';
603 }
604 if ($option == 'withproject') {
605 $url .= '&withproject=1';
606 }
607 if ($option == 'thirdpartyid') {
608 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php?thirdpartyid='.$this->id;
609 }
610 }
611
612 $linkclose = '';
613 if (empty($notooltip)) {
614 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
615 $label = $langs->trans("ShowConferenceOrBooth");
616 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
617 }
618 //$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
619 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
620 } else {
621 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
622 }
623
624 $linkstart = '<a href="'.$url.'"';
625 $linkstart .= $linkclose.'>';
626 $linkend = '</a>';
627
628 $result .= $linkstart;
629
630 if (empty($this->showphoto_on_popup)) {
631 if ($withpicto) {
632 $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);
633 // var_dump($picto);
634 $result .= $picto;
635 }
636 } else {
637 if ($withpicto) {
638 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
639
640 //list($class, $module) = explode('@', $this->picto);
641 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
642 $filearray = dol_dir_list($upload_dir, "files");
643 $filename = $filearray[0]['name'];
644 if (!empty($filename)) {
645 $pospoint = strpos($filearray[0]['name'], '.');
646
647 $pathtophoto = '/'.$this->ref.'/thumbs/'.dol_substr($filename, 0, $pospoint).'_mini'.dol_substr($filename, $pospoint);
648 $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>';
649
650 $result .= '</div>';
651 } else {
652 $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);
653 }
654 }
655 }
656
657 if ($withpicto != 2) {
658 $result .= $this->ref;
659 }
660
661 $result .= $linkend;
662 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
663
664 global $action, $hookmanager;
665 $hookmanager->initHooks(array('conferenceorboothdao'));
666 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
667 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
668 if ($reshook > 0) {
669 $result = $hookmanager->resPrint;
670 } else {
671 $result .= $hookmanager->resPrint;
672 }
673
674 return $result;
675 }
676
684 public function getLibStatut($mode = 0, $hidenastatus = 0)
685 {
686 return $this->LibStatutEvent($this->status, $mode);
687 }
688
689 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
697 public function LibStatutEvent($status, $mode = 0)
698 {
699 // phpcs:enable
700 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
701 global $langs;
702 //$langs->load("eventorganization@eventorganization");
703 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
704 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
705 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
706 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
707 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
708 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
709 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
710 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
711 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
712 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
713 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
714 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
715 }
716
717 $statusType = 'status'.$status;
718 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
719 if ($status == self::STATUS_CANCELED) {
720 $statusType = 'status6';
721 }
722
723 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
724 }
725
733 public function getKanbanView($option = '', $arraydata = null)
734 {
735 global $conf, $langs;
736
737 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
738
739 $return = '<div class="box-flex-item box-flex-grow-zero">';
740 $return .= '<div class="info-box info-box-sm">';
741 $return .= '<span class="info-box-icon bg-infobox-action">';
742 $return .= img_picto('', $this->picto);
743 $return .= '</span>';
744 $return .= '<div class="info-box-content">';
745 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
746 if ($selected >= 0) {
747 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
748 }
749 if (!empty($this->label)) {
750 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
751 }
752 if (isset($this->thirdparty) && is_object($this->thirdparty)) {
753 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
754 }
755 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
756 $return .= '</div>';
757 $return .= '</div>';
758 $return .= '</div>';
759
760 return $return;
761 }
762
769 public function info($id)
770 {
771 $sql = 'SELECT rowid, datec as datec, tms as datem,';
772 $sql .= ' fk_user_author, fk_user_mod';
773 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
774 $sql .= ' WHERE t.id = '.((int) $id);
775 $result = $this->db->query($sql);
776 if ($result) {
777 if ($this->db->num_rows($result)) {
778 $obj = $this->db->fetch_object($result);
779
780 $this->id = $obj->rowid;
781
782 $this->user_creation_id = $obj->fk_user_creat;
783 $this->user_modification_id = $obj->fk_user_modif;
784 $this->date_creation = $this->db->jdate($obj->datec);
785 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
786 }
787
788 $this->db->free($result);
789 } else {
790 dol_print_error($this->db);
791 }
792 }
793
800 public function initAsSpecimen()
801 {
802 return $this->initAsSpecimenCommon();
803 }
804
816 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
817 {
818 global $conf, $langs;
819
820 $result = 0;
821
822 $langs->load("eventorganization@eventorganization");
823
824 if (!dol_strlen($modele)) {
825 $modele = 'standard_conferenceorbooth';
826
827 if (!empty($this->model_pdf)) {
828 $modele = $this->model_pdf;
829 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
830 $modele = getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF');
831 }
832 }
833
834 $modelpath = "core/modules/eventorganization/doc/";
835
836 if (!empty($modele)) {
837 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
838 }
839
840 return $result;
841 }
842
850 public function doScheduledJob()
851 {
852 global $conf, $langs;
853
854 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
855
856 $error = 0;
857 $this->output = '';
858 $this->error = '';
859
860 dol_syslog(__METHOD__, LOG_DEBUG);
861
862 $now = dol_now();
863
864 $this->db->begin();
865
866 // ...
867
868 $this->db->commit();
869
870 return $error;
871 }
872}
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:169
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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:65
dol_now($mode='gmt')
Return date for now.
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.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0, $forbiddenfields=array())
forgeSQLFromUniversalSearchCriteria
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
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.