dolibarr 22.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) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024-2025 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' => '$conf->societe->enabled', '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;
171 public $status;
172 // END MODULEBUILDER PROPERTIES
173
174 //public $pubregister;
175
176
182 public function __construct(DoliDB $db)
183 {
184 global $langs;
185
186 $this->db = $db;
187
188 $this->ismultientitymanaged = 1;
189 $this->isextrafieldmanaged = 1;
190
191 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
192 $this->fields['id']['visible'] = 0;
193 }
194 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
195 $this->fields['entity']['enabled'] = 0;
196 }
197
198 // Unset fields that are disabled
199 foreach ($this->fields as $key => $val) {
200 if (isset($val['enabled']) && empty($val['enabled'])) {
201 unset($this->fields[$key]);
202 }
203 }
204
205 // Translate some data of arrayofkeyval
206 if (is_object($langs)) {
207 foreach ($this->fields as $key => $val) {
208 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
209 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
210 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
211 }
212 }
213 }
214 }
215 }
216
224 public function create(User $user, $notrigger = 0)
225 {
227 $this->setActionCommFields($user);
228 return parent::create($user, $notrigger);
229 }
230
236 protected function setPercentageFromStatus()
237 {
238 if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_SUGGESTED || $this->status == self::STATUS_NOT_QUALIFIED || $this->status == self::STATUS_CANCELED) {
239 $this->percentage = -1;
240 }
241 if ($this->status == self::STATUS_CONFIRMED) {
242 $this->percentage = 0;
243 }
244 if ($this->status == self::STATUS_DONE) {
245 $this->percentage = 100;
246 }
247 }
248
255 protected function setActionCommFields(User $user)
256 {
257 $this->userownerid = $user->id;
258 $this->type_id = $this->fk_action;
259 $this->socid = $this->fk_soc;
260 $this->datef = $this->datep2;
261 $this->note_private = $this->note;
262 }
263
269 protected function getActionCommFields()
270 {
271 $this->fk_action = $this->type_id;
272 $this->fk_soc = $this->socid;
273 $this->datep2 = $this->datef;
274 }
275
286 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
287 {
289
290 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
291
292 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
293
294 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $id), 'md5');
295 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
296
297 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
298 $this->pubregister = $link_subscription;*/
299
300 $this->getActionCommFields();
301
302 return $result;
303 }
304
317 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
318 {
319 dol_syslog(__METHOD__, LOG_DEBUG);
320
321 $records = array();
322
323 $sql = 'SELECT ';
324 $sql .= $this->getFieldList('t');
325 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
326 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
327 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
328 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
329 } else {
330 $sql .= ' WHERE 1 = 1';
331 }
332
333 // Manage filter
334 if (is_array($filter)) { // deprecated, use $filter = USF syntax
335 dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING);
336 $sqlwhere = array();
337 if (count($filter) > 0) {
338 foreach ($filter as $key => $value) {
339 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
340 $sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
341 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
342 $sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate($value)."'";
343 } elseif ($key == 'customsql') {
344 $sqlwhere[] = $value; // deprecated
345 } elseif (strpos($value, '%') === false) {
346 $sqlwhere[] = $this->db->sanitize($key).' IN ('.$this->db->sanitize($this->db->escape($value)).')';
347 } else {
348 $sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($value)."%'";
349 }
350 }
351 }
352 if (count($sqlwhere) > 0) {
353 $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
354 }
355
356 $filter = '';
357 }
358
359 // Manage filter
360 $errormessage = '';
361 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
362 if ($errormessage) {
363 $this->errors[] = $errormessage;
364 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
365 return -1;
366 }
367
368 if (!empty($sortfield)) {
369 $sql .= $this->db->order($sortfield, $sortorder);
370 }
371 if (!empty($limit)) {
372 $sql .= $this->db->plimit($limit, $offset);
373 }
374
375 $resql = $this->db->query($sql);
376 if ($resql) {
377 $num = $this->db->num_rows($resql);
378 $i = 0;
379 while ($i < ($limit ? min($limit, $num) : $num)) {
380 $obj = $this->db->fetch_object($resql);
381
382 $record = new self($this->db);
383 $record->setVarsFromFetchObj($obj);
384
385 $records[$record->id] = $record;
386
387 $i++;
388 }
389 $this->db->free($resql);
390
391 return $records;
392 } else {
393 $this->errors[] = 'Error '.$this->db->lasterror();
394 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
395
396 return -1;
397 }
398 }
399
407 public function update(User $user, $notrigger = 0)
408 {
410
411 $this->setActionCommFields($user);
412
413 return parent::update($user, $notrigger);
414 }
415
423 public function delete($user, $notrigger = 0)
424 {
425 //TODO delete attendees and subscription
426 return parent::delete($user, $notrigger);
427 }
428
436 public function validate($user, $notrigger = 0)
437 {
438 global $conf, $langs;
439
440 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
441
442 $error = 0;
443
444 // Protection
445 if ($this->status == self::STATUS_CONFIRMED) {
446 dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING);
447 return 0;
448 }
449
450 $now = dol_now();
451
452 $this->db->begin();
453
454 // Validate
455 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
456 $sql .= " status = ".self::STATUS_CONFIRMED;
457 $sql .= " WHERE id = ".$this->id;
458
459 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
460 $resql = $this->db->query($sql);
461 if (!$resql) {
462 dol_print_error($this->db);
463 $this->error = $this->db->lasterror();
464 $error++;
465 }
466
467 if (!$error && !$notrigger) {
468 // Call trigger
469 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
470 if ($result < 0) {
471 $error++;
472 }
473 // End call triggers
474 }
475
476 // Set new ref and current status
477 if (!$error) {
478 $this->status = self::STATUS_CONFIRMED;
479 }
480
481 if (!$error) {
482 $this->db->commit();
483 return 1;
484 } else {
485 $this->db->rollback();
486 return -1;
487 }
488 }
489
490
498 public function setDraft($user, $notrigger = 0)
499 {
500 // Protection
501 if ($this->status <= self::STATUS_DRAFT) {
502 return 0;
503 }
504
505 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
506 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
507 {
508 $this->error='Permission denied';
509 return -1;
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 }
608
609 $linkclose = '';
610 if (empty($notooltip)) {
611 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
612 $label = $langs->trans("ShowConferenceOrBooth");
613 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
614 }
615 //$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
616 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
617 } else {
618 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
619 }
620
621 $linkstart = '<a href="'.$url.'"';
622 $linkstart .= $linkclose.'>';
623 $linkend = '</a>';
624
625 $result .= $linkstart;
626
627 if (empty($this->showphoto_on_popup)) {
628 if ($withpicto) {
629 $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);
630 // var_dump($picto);
631 $result .= $picto;
632 }
633 } else {
634 if ($withpicto) {
635 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
636
637 //list($class, $module) = explode('@', $this->picto);
638 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
639 $filearray = dol_dir_list($upload_dir, "files");
640 $filename = $filearray[0]['name'];
641 if (!empty($filename)) {
642 $pospoint = strpos($filearray[0]['name'], '.');
643
644 $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
645 $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>';
646
647 $result .= '</div>';
648 } else {
649 $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);
650 }
651 }
652 }
653
654 if ($withpicto != 2) {
655 $result .= $this->ref;
656 }
657
658 $result .= $linkend;
659 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
660
661 global $action, $hookmanager;
662 $hookmanager->initHooks(array('conferenceorboothdao'));
663 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
664 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
665 if ($reshook > 0) {
666 $result = $hookmanager->resPrint;
667 } else {
668 $result .= $hookmanager->resPrint;
669 }
670
671 return $result;
672 }
673
681 public function getLibStatut($mode = 0, $hidenastatus = 0)
682 {
683 return $this->LibStatutEvent($this->status, $mode);
684 }
685
686 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
694 public function LibStatutEvent($status, $mode = 0)
695 {
696 // phpcs:enable
697 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
698 global $langs;
699 //$langs->load("eventorganization@eventorganization");
700 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
701 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
702 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
703 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
704 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
705 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
706 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
707 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
708 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
709 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
710 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
711 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
712 }
713
714 $statusType = 'status'.$status;
715 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
716 if ($status == self::STATUS_CANCELED) {
717 $statusType = 'status6';
718 }
719
720 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
721 }
722
730 public function getKanbanView($option = '', $arraydata = null)
731 {
732 global $conf, $langs;
733
734 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
735
736 $return = '<div class="box-flex-item box-flex-grow-zero">';
737 $return .= '<div class="info-box info-box-sm">';
738 $return .= '<span class="info-box-icon bg-infobox-action">';
739 $return .= img_picto('', $this->picto);
740 $return .= '</span>';
741 $return .= '<div class="info-box-content">';
742 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
743 if ($selected >= 0) {
744 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
745 }
746 if (property_exists($this, 'label')) {
747 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
748 }
749 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
750 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
751 }
752 if (property_exists($this, 'amount')) {
753 $return .= '<br>';
754 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>'; // @phan-suppress-current-line PhanUndeclaredProperty
755 }
756 if (method_exists($this, 'getLibStatut')) {
757 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
758 }
759 $return .= '</div>';
760 $return .= '</div>';
761 $return .= '</div>';
762
763 return $return;
764 }
765
772 public function info($id)
773 {
774 $sql = 'SELECT rowid, datec as datec, tms as datem,';
775 $sql .= ' fk_user_author, fk_user_mod';
776 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
777 $sql .= ' WHERE t.id = '.((int) $id);
778 $result = $this->db->query($sql);
779 if ($result) {
780 if ($this->db->num_rows($result)) {
781 $obj = $this->db->fetch_object($result);
782
783 $this->id = $obj->rowid;
784
785 $this->user_creation_id = $obj->fk_user_creat;
786 $this->user_modification_id = $obj->fk_user_modif;
787 $this->date_creation = $this->db->jdate($obj->datec);
788 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
789 }
790
791 $this->db->free($result);
792 } else {
793 dol_print_error($this->db);
794 }
795 }
796
803 public function initAsSpecimen()
804 {
805 return $this->initAsSpecimenCommon();
806 }
807
819 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
820 {
821 global $conf, $langs;
822
823 $result = 0;
824 $includedocgeneration = 0;
825
826 $langs->load("eventorganization@eventorganization");
827
828 if (!dol_strlen($modele)) {
829 $modele = 'standard_conferenceorbooth';
830
831 if (!empty($this->model_pdf)) {
832 $modele = $this->model_pdf;
833 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
834 $modele = getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF');
835 }
836 }
837
838 $modelpath = "core/modules/eventorganization/doc/";
839
840 if ($includedocgeneration && !empty($modele)) {
841 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
842 }
843
844 return $result;
845 }
846
854 public function doScheduledJob()
855 {
856 global $conf, $langs;
857
858 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
859
860 $error = 0;
861 $this->output = '';
862 $this->error = '';
863
864 dol_syslog(__METHOD__, LOG_DEBUG);
865
866 $now = dol_now();
867
868 $this->db->begin();
869
870 // ...
871
872 $this->db->commit();
873
874 return $error;
875 }
876}
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.
call_trigger($triggerName, $user)
Call trigger based on this instance.
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:171
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:63
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_now($mode='auto')
Return date for now.
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.