dolibarr 20.0.2
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 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 );
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
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 $langs;
149
150 $this->db = $db;
151
152 $this->ismultientitymanaged = 1;
153 $this->isextrafieldmanaged = 1;
154
155 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
156 $this->fields['id']['visible'] = 0;
157 }
158 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
159 $this->fields['entity']['enabled'] = 0;
160 }
161
162 // Unset fields that are disabled
163 foreach ($this->fields as $key => $val) {
164 if (isset($val['enabled']) && empty($val['enabled'])) {
165 unset($this->fields[$key]);
166 }
167 }
168
169 // Translate some data of arrayofkeyval
170 if (is_object($langs)) {
171 foreach ($this->fields as $key => $val) {
172 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
173 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
174 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
175 }
176 }
177 }
178 }
179 }
180
188 public function create(User $user, $notrigger = 0)
189 {
191 $this->setActionCommFields($user);
192 return parent::create($user, $notrigger);
193 }
194
200 protected function setPercentageFromStatus()
201 {
202 if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_SUGGESTED || $this->status == self::STATUS_NOT_QUALIFIED || $this->status == self::STATUS_CANCELED) {
203 $this->percentage = -1;
204 }
205 if ($this->status == self::STATUS_CONFIRMED) {
206 $this->percentage = 0;
207 }
208 if ($this->status == self::STATUS_DONE) {
209 $this->percentage = 100;
210 }
211 }
212
219 protected function setActionCommFields(User $user)
220 {
221 $this->userownerid = $user->id;
222 $this->type_id = $this->fk_action;
223 $this->socid = $this->fk_soc;
224 $this->datef = $this->datep2;
225 $this->note_private = $this->note;
226 }
227
233 protected function getActionCommFields()
234 {
235 $this->fk_action = $this->type_id;
236 $this->fk_soc = $this->socid;
237 $this->datep2 = $this->datef;
238 }
239
250 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
251 {
252 global $dolibarr_main_url_root, $conf, $langs;
253
254 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
255
256 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
257
258 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2);
259 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
260
261 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
262 $this->pubregister = $link_subscription;*/
263
264 $this->getActionCommFields();
265 return $result;
266 }
267
280 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
281 {
282 dol_syslog(__METHOD__, LOG_DEBUG);
283
284 $records = array();
285
286 $sql = 'SELECT ';
287 $sql .= $this->getFieldList('t');
288 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
289 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
290 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
291 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
292 } else {
293 $sql .= ' WHERE 1 = 1';
294 }
295
296 // Manage filter
297 if (is_array($filter)) { // deprecated, use $filter = USF syntax
298 dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING);
299 $sqlwhere = array();
300 if (count($filter) > 0) {
301 foreach ($filter as $key => $value) {
302 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
303 $sqlwhere[] = $key." = ".((int) $value);
304 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
305 $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
306 } elseif ($key == 'customsql') {
307 $sqlwhere[] = $value;
308 } elseif (strpos($value, '%') === false) {
309 $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
310 } else {
311 $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
312 }
313 }
314 }
315 if (count($sqlwhere) > 0) {
316 $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
317 }
318
319 $filter = '';
320 }
321
322 // Manage filter
323 $errormessage = '';
324 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
325 if ($errormessage) {
326 $this->errors[] = $errormessage;
327 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
328 return -1;
329 }
330
331 if (!empty($sortfield)) {
332 $sql .= $this->db->order($sortfield, $sortorder);
333 }
334 if (!empty($limit)) {
335 $sql .= $this->db->plimit($limit, $offset);
336 }
337
338 $resql = $this->db->query($sql);
339 if ($resql) {
340 $num = $this->db->num_rows($resql);
341 $i = 0;
342 while ($i < ($limit ? min($limit, $num) : $num)) {
343 $obj = $this->db->fetch_object($resql);
344
345 $record = new self($this->db);
346 $record->setVarsFromFetchObj($obj);
347
348 $records[$record->id] = $record;
349
350 $i++;
351 }
352 $this->db->free($resql);
353
354 return $records;
355 } else {
356 $this->errors[] = 'Error '.$this->db->lasterror();
357 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
358
359 return -1;
360 }
361 }
362
370 public function update(User $user, $notrigger = 0)
371 {
373
374 $this->setActionCommFields($user);
375
376 return parent::update($user, $notrigger);
377 }
378
386 public function delete($user, $notrigger = 0)
387 {
388 //TODO delete attendees and subscription
389 return parent::delete($user, $notrigger);
390 }
391
399 public function validate($user, $notrigger = 0)
400 {
401 global $conf, $langs;
402
403 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
404
405 $error = 0;
406
407 // Protection
408 if ($this->status == self::STATUS_CONFIRMED) {
409 dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING);
410 return 0;
411 }
412
413 $now = dol_now();
414
415 $this->db->begin();
416
417 // Validate
418 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
419 $sql .= " status = ".self::STATUS_CONFIRMED;
420 $sql .= " WHERE id = ".$this->id;
421
422 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
423 $resql = $this->db->query($sql);
424 if (!$resql) {
425 dol_print_error($this->db);
426 $this->error = $this->db->lasterror();
427 $error++;
428 }
429
430 if (!$error && !$notrigger) {
431 // Call trigger
432 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
433 if ($result < 0) {
434 $error++;
435 }
436 // End call triggers
437 }
438
439 // Set new ref and current status
440 if (!$error) {
441 $this->status = self::STATUS_CONFIRMED;
442 }
443
444 if (!$error) {
445 $this->db->commit();
446 return 1;
447 } else {
448 $this->db->rollback();
449 return -1;
450 }
451 }
452
453
461 public function setDraft($user, $notrigger = 0)
462 {
463 // Protection
464 if ($this->status <= self::STATUS_DRAFT) {
465 return 0;
466 }
467
468 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
469 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
470 {
471 $this->error='Permission denied';
472 return -1;
473 }*/
474
475 return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
476 }
477
485 public function cancel($user, $notrigger = 0)
486 {
487 // Protection
488 if ($this->status != self::STATUS_CONFIRMED) {
489 return 0;
490 }
491
492 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
493 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
494 {
495 $this->error='Permission denied';
496 return -1;
497 }*/
498
499 return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
500 }
501
509 public function reopen($user, $notrigger = 0)
510 {
511 // Protection
512 if ($this->status != self::STATUS_CANCELED) {
513 return 0;
514 }
515
516 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
517 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
518 {
519 $this->error='Permission denied';
520 return -1;
521 }*/
522
523 return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
524 }
525
539 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
540 {
541 global $conf, $langs, $hookmanager;
542
543 if (!empty($conf->dol_no_mouse_hover)) {
544 $notooltip = 1; // Force disable tooltips
545 }
546
547 $result = '';
548
549 $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
550 if (isset($this->status)) {
551 $label .= ' '.$this->getLibStatut(5);
552 }
553 $label .= '<br>';
554 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
555
556 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
557
558 if ($option != 'nolink') {
559 // Add param to save lastsearch_values or not
560 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
561 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
562 $add_save_lastsearch_values = 1;
563 }
564 if ($add_save_lastsearch_values) {
565 $url .= '&save_lastsearch_values=1';
566 }
567 if ($option == 'withproject') {
568 $url .= '&withproject=1';
569 }
570 }
571
572 $linkclose = '';
573 if (empty($notooltip)) {
574 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
575 $label = $langs->trans("ShowConferenceOrBooth");
576 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
577 }
578 //$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
579 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
580 } else {
581 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
582 }
583
584 $linkstart = '<a href="'.$url.'"';
585 $linkstart .= $linkclose.'>';
586 $linkend = '</a>';
587
588 $result .= $linkstart;
589
590 if (empty($this->showphoto_on_popup)) {
591 if ($withpicto) {
592 $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);
593 // var_dump($picto);
594 $result .= $picto;
595 }
596 } else {
597 if ($withpicto) {
598 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
599
600 //list($class, $module) = explode('@', $this->picto);
601 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
602 $filearray = dol_dir_list($upload_dir, "files");
603 $filename = $filearray[0]['name'];
604 if (!empty($filename)) {
605 $pospoint = strpos($filearray[0]['name'], '.');
606
607 $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
608 $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>';
609
610 $result .= '</div>';
611 } else {
612 $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);
613 }
614 }
615 }
616
617 if ($withpicto != 2) {
618 $result .= $this->ref;
619 }
620
621 $result .= $linkend;
622 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
623
624 global $action, $hookmanager;
625 $hookmanager->initHooks(array('conferenceorboothdao'));
626 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
627 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
628 if ($reshook > 0) {
629 $result = $hookmanager->resPrint;
630 } else {
631 $result .= $hookmanager->resPrint;
632 }
633
634 return $result;
635 }
636
644 public function getLibStatut($mode = 0, $hidenastatus = 0)
645 {
646 return $this->LibStatutEvent($this->status, $mode);
647 }
648
649 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
657 public function LibStatutEvent($status, $mode = 0)
658 {
659 // phpcs:enable
660 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
661 global $langs;
662 //$langs->load("eventorganization@eventorganization");
663 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
664 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
665 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
666 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
667 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
668 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
669 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
670 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
671 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
672 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
673 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
674 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
675 }
676
677 $statusType = 'status'.$status;
678 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
679 if ($status == self::STATUS_CANCELED) {
680 $statusType = 'status6';
681 }
682
683 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
684 }
685
693 public function getKanbanView($option = '', $arraydata = null)
694 {
695 global $conf, $langs;
696
697 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
698
699 $return = '<div class="box-flex-item box-flex-grow-zero">';
700 $return .= '<div class="info-box info-box-sm">';
701 $return .= '<span class="info-box-icon bg-infobox-action">';
702 $return .= img_picto('', $this->picto);
703 $return .= '</span>';
704 $return .= '<div class="info-box-content">';
705 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
706 if ($selected >= 0) {
707 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
708 }
709 if (property_exists($this, 'label')) {
710 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
711 }
712 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
713 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
714 }
715 if (property_exists($this, 'amount')) {
716 $return .= '<br>';
717 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
718 }
719 if (method_exists($this, 'getLibStatut')) {
720 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
721 }
722 $return .= '</div>';
723 $return .= '</div>';
724 $return .= '</div>';
725
726 return $return;
727 }
728
735 public function info($id)
736 {
737 $sql = 'SELECT rowid, datec as datec, tms as datem,';
738 $sql .= ' fk_user_author, fk_user_mod';
739 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
740 $sql .= ' WHERE t.id = '.((int) $id);
741 $result = $this->db->query($sql);
742 if ($result) {
743 if ($this->db->num_rows($result)) {
744 $obj = $this->db->fetch_object($result);
745
746 $this->id = $obj->rowid;
747
748 $this->user_creation_id = $obj->fk_user_creat;
749 $this->user_modification_id = $obj->fk_user_modif;
750 $this->date_creation = $this->db->jdate($obj->datec);
751 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
752 }
753
754 $this->db->free($result);
755 } else {
756 dol_print_error($this->db);
757 }
758 }
759
766 public function initAsSpecimen()
767 {
768 return $this->initAsSpecimenCommon();
769 }
770
782 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
783 {
784 global $conf, $langs;
785
786 $result = 0;
787 $includedocgeneration = 0;
788
789 $langs->load("eventorganization@eventorganization");
790
791 if (!dol_strlen($modele)) {
792 $modele = 'standard_conferenceorbooth';
793
794 if (!empty($this->model_pdf)) {
795 $modele = $this->model_pdf;
796 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
797 $modele = getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF');
798 }
799 }
800
801 $modelpath = "core/modules/eventorganization/doc/";
802
803 if ($includedocgeneration && !empty($modele)) {
804 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
805 }
806
807 return $result;
808 }
809
817 public function doScheduledJob()
818 {
819 global $conf, $langs;
820
821 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
822
823 $error = 0;
824 $this->output = '';
825 $this->error = '';
826
827 dol_syslog(__METHOD__, LOG_DEBUG);
828
829 $now = dol_now();
830
831 $this->db->begin();
832
833 // ...
834
835 $this->db->commit();
836
837 return $error;
838 }
839}
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition security.php:637
$object ref
Definition info.php:79
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.
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_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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 dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.