dolibarr 21.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) ---Put here your own copyright and developer email---
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Put here all includes required by your class file
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
30//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
31
36{
40 public $module = 'eventorganization';
41
45 public $element = 'conferenceorbooth';
46
50 public $table_element = 'actioncomm';
51
55 public $picto = 'conferenceorbooth';
56
57
58 const STATUS_DRAFT = 0;
59 const STATUS_SUGGESTED = 1;
60 const STATUS_CONFIRMED = 2;
61 const STATUS_NOT_QUALIFIED = 3;
62 const STATUS_DONE = 4;
63 const STATUS_CANCELED = 9;
64
65
102 // BEGIN MODULEBUILDER PROPERTIES
106 public $fields = array(
107 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"),
108 'ref' => array('type' => 'integer', 'label' => 'Ref', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"),
109 '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),
110 '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'),
111 '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'),
112 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3),
113 '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'),
114 'datep' => array('type' => 'datetime', 'label' => 'DateStart', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '2',),
115 'datep2' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '3',),
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 );
124 public $rowid;
125 public $id;
126 public $label;
127 public $fk_soc;
128 public $fk_project;
129 public $note;
130 public $fk_action;
131 public $datec;
132
133 public $fk_user_author;
134 public $fk_user_mod;
135 public $import_key;
136 public $status;
137 // END MODULEBUILDER PROPERTIES
138
139 //public $pubregister;
140
141
147 public function __construct(DoliDB $db)
148 {
149 global $langs;
150
151 $this->db = $db;
152
153 $this->ismultientitymanaged = 1;
154 $this->isextrafieldmanaged = 1;
155
156 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
157 $this->fields['id']['visible'] = 0;
158 }
159 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
160 $this->fields['entity']['enabled'] = 0;
161 }
162
163 // Unset fields that are disabled
164 foreach ($this->fields as $key => $val) {
165 if (isset($val['enabled']) && empty($val['enabled'])) {
166 unset($this->fields[$key]);
167 }
168 }
169
170 // Translate some data of arrayofkeyval
171 if (is_object($langs)) {
172 foreach ($this->fields as $key => $val) {
173 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
174 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
175 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
176 }
177 }
178 }
179 }
180 }
181
189 public function create(User $user, $notrigger = 0)
190 {
192 $this->setActionCommFields($user);
193 return parent::create($user, $notrigger);
194 }
195
201 protected function setPercentageFromStatus()
202 {
203 if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_SUGGESTED || $this->status == self::STATUS_NOT_QUALIFIED || $this->status == self::STATUS_CANCELED) {
204 $this->percentage = -1;
205 }
206 if ($this->status == self::STATUS_CONFIRMED) {
207 $this->percentage = 0;
208 }
209 if ($this->status == self::STATUS_DONE) {
210 $this->percentage = 100;
211 }
212 }
213
220 protected function setActionCommFields(User $user)
221 {
222 $this->userownerid = $user->id;
223 $this->type_id = $this->fk_action;
224 $this->socid = $this->fk_soc;
225 $this->datef = $this->datep2;
226 $this->note_private = $this->note;
227 }
228
234 protected function getActionCommFields()
235 {
236 $this->fk_action = $this->type_id;
237 $this->fk_soc = $this->socid;
238 $this->datep2 = $this->datef;
239 }
240
251 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
252 {
253 global $dolibarr_main_url_root, $conf, $langs;
254
255 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
256
257 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
258
259 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2);
260 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
261
262 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
263 $this->pubregister = $link_subscription;*/
264
265 $this->getActionCommFields();
266 return $result;
267 }
268
281 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
282 {
283 //TODO set percent according status
284 global $conf;
285
286 dol_syslog(__METHOD__, LOG_DEBUG);
287
288 $records = array();
289
290 $sql = 'SELECT ';
291 $sql .= $this->getFieldList('t');
292 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
293 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
294 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
295 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
296 } else {
297 $sql .= ' WHERE 1 = 1';
298 }
299
300 // Manage filter
301 $errormessage = '';
302 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
303 if ($errormessage) {
304 $this->errors[] = $errormessage;
305 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
306 return -1;
307 }
308
309 if (!empty($sortfield)) {
310 $sql .= $this->db->order($sortfield, $sortorder);
311 }
312 if (!empty($limit)) {
313 $sql .= $this->db->plimit($limit, $offset);
314 }
315
316 $resql = $this->db->query($sql);
317 if ($resql) {
318 $num = $this->db->num_rows($resql);
319 $i = 0;
320 while ($i < ($limit ? min($limit, $num) : $num)) {
321 $obj = $this->db->fetch_object($resql);
322
323 $record = new self($this->db);
324 $record->setVarsFromFetchObj($obj);
325
326 $records[$record->id] = $record;
327
328 $i++;
329 }
330 $this->db->free($resql);
331
332 return $records;
333 } else {
334 $this->errors[] = 'Error '.$this->db->lasterror();
335 dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
336
337 return -1;
338 }
339 }
340
348 public function update(User $user, $notrigger = 0)
349 {
351
352 $this->setActionCommFields($user);
353
354 return parent::update($user, $notrigger);
355 }
356
364 public function delete($user, $notrigger = 0)
365 {
366 //TODO delete attendees and subscription
367 return parent::delete($user, $notrigger);
368 }
369
377 public function validate($user, $notrigger = 0)
378 {
379 global $conf, $langs;
380
381 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
382
383 $error = 0;
384
385 // Protection
386 if ($this->status == self::STATUS_CONFIRMED) {
387 dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING);
388 return 0;
389 }
390
391 $now = dol_now();
392
393 $this->db->begin();
394
395 // Validate
396 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
397 $sql .= " status = ".self::STATUS_CONFIRMED;
398 $sql .= " WHERE id = ".$this->id;
399
400 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
401 $resql = $this->db->query($sql);
402 if (!$resql) {
403 dol_print_error($this->db);
404 $this->error = $this->db->lasterror();
405 $error++;
406 }
407
408 if (!$error && !$notrigger) {
409 // Call trigger
410 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
411 if ($result < 0) {
412 $error++;
413 }
414 // End call triggers
415 }
416
417 // Set new ref and current status
418 if (!$error) {
419 $this->status = self::STATUS_CONFIRMED;
420 }
421
422 if (!$error) {
423 $this->db->commit();
424 return 1;
425 } else {
426 $this->db->rollback();
427 return -1;
428 }
429 }
430
431
439 public function setDraft($user, $notrigger = 0)
440 {
441 // Protection
442 if ($this->status <= self::STATUS_DRAFT) {
443 return 0;
444 }
445
446 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
447 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
448 {
449 $this->error='Permission denied';
450 return -1;
451 }*/
452
453 return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
454 }
455
463 public function cancel($user, $notrigger = 0)
464 {
465 // Protection
466 if ($this->status != self::STATUS_CONFIRMED) {
467 return 0;
468 }
469
470 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
471 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
472 {
473 $this->error='Permission denied';
474 return -1;
475 }*/
476
477 return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
478 }
479
487 public function reopen($user, $notrigger = 0)
488 {
489 // Protection
490 if ($this->status != self::STATUS_CANCELED) {
491 return 0;
492 }
493
494 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
495 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
496 {
497 $this->error='Permission denied';
498 return -1;
499 }*/
500
501 return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
502 }
503
517 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
518 {
519 global $conf, $langs, $hookmanager;
520
521 if (!empty($conf->dol_no_mouse_hover)) {
522 $notooltip = 1; // Force disable tooltips
523 }
524
525 $result = '';
526
527 $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
528 if (isset($this->status)) {
529 $label .= ' '.$this->getLibStatut(5);
530 }
531 $label .= '<br>';
532 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
533
534 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
535
536 if ($option != 'nolink') {
537 // Add param to save lastsearch_values or not
538 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
539 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
540 $add_save_lastsearch_values = 1;
541 }
542 if ($add_save_lastsearch_values) {
543 $url .= '&save_lastsearch_values=1';
544 }
545 if ($option == 'withproject') {
546 $url .= '&withproject=1';
547 }
548 }
549
550 $linkclose = '';
551 if (empty($notooltip)) {
552 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
553 $label = $langs->trans("ShowConferenceOrBooth");
554 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
555 }
556 //$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
557 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
558 } else {
559 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
560 }
561
562 $linkstart = '<a href="'.$url.'"';
563 $linkstart .= $linkclose.'>';
564 $linkend = '</a>';
565
566 $result .= $linkstart;
567
568 if (empty($this->showphoto_on_popup)) {
569 if ($withpicto) {
570 $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);
571 // var_dump($picto);
572 $result .= $picto;
573 }
574 } else {
575 if ($withpicto) {
576 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
577
578 //list($class, $module) = explode('@', $this->picto);
579 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
580 $filearray = dol_dir_list($upload_dir, "files");
581 $filename = $filearray[0]['name'];
582 if (!empty($filename)) {
583 $pospoint = strpos($filearray[0]['name'], '.');
584
585 $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
586 $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>';
587
588 $result .= '</div>';
589 } else {
590 $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);
591 }
592 }
593 }
594
595 if ($withpicto != 2) {
596 $result .= $this->ref;
597 }
598
599 $result .= $linkend;
600 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
601
602 global $action, $hookmanager;
603 $hookmanager->initHooks(array('conferenceorboothdao'));
604 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
605 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
606 if ($reshook > 0) {
607 $result = $hookmanager->resPrint;
608 } else {
609 $result .= $hookmanager->resPrint;
610 }
611
612 return $result;
613 }
614
622 public function getLibStatut($mode = 0, $hidenastatus = 0)
623 {
624 return $this->LibStatutEvent($this->status, $mode);
625 }
626
627 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
635 public function LibStatutEvent($status, $mode = 0)
636 {
637 // phpcs:enable
638 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
639 global $langs;
640 //$langs->load("eventorganization@eventorganization");
641 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
642 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
643 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
644 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
645 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
646 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
647 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
648 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
649 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
650 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
651 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
652 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
653 }
654
655 $statusType = 'status'.$status;
656 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
657 if ($status == self::STATUS_CANCELED) {
658 $statusType = 'status6';
659 }
660
661 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
662 }
663
671 public function getKanbanView($option = '', $arraydata = null)
672 {
673 global $conf, $langs;
674
675 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
676
677 $return = '<div class="box-flex-item box-flex-grow-zero">';
678 $return .= '<div class="info-box info-box-sm">';
679 $return .= '<span class="info-box-icon bg-infobox-action">';
680 $return .= img_picto('', $this->picto);
681 $return .= '</span>';
682 $return .= '<div class="info-box-content">';
683 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
684 if ($selected >= 0) {
685 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
686 }
687 if (property_exists($this, 'label')) {
688 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
689 }
690 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
691 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
692 }
693 if (property_exists($this, 'amount')) {
694 $return .= '<br>';
695 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
696 }
697 if (method_exists($this, 'getLibStatut')) {
698 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
699 }
700 $return .= '</div>';
701 $return .= '</div>';
702 $return .= '</div>';
703
704 return $return;
705 }
706
713 public function info($id)
714 {
715 $sql = 'SELECT rowid, datec as datec, tms as datem,';
716 $sql .= ' fk_user_author, fk_user_mod';
717 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
718 $sql .= ' WHERE t.id = '.((int) $id);
719 $result = $this->db->query($sql);
720 if ($result) {
721 if ($this->db->num_rows($result)) {
722 $obj = $this->db->fetch_object($result);
723
724 $this->id = $obj->rowid;
725
726 $this->user_creation_id = $obj->fk_user_creat;
727 $this->user_modification_id = $obj->fk_user_modif;
728 $this->date_creation = $this->db->jdate($obj->datec);
729 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
730 }
731
732 $this->db->free($result);
733 } else {
734 dol_print_error($this->db);
735 }
736 }
737
744 public function initAsSpecimen()
745 {
746 return $this->initAsSpecimenCommon();
747 }
748
760 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
761 {
762 global $conf, $langs;
763
764 $result = 0;
765 $includedocgeneration = 0;
766
767 $langs->load("eventorganization@eventorganization");
768
769 if (!dol_strlen($modele)) {
770 $modele = 'standard_conferenceorbooth';
771
772 if (!empty($this->model_pdf)) {
773 $modele = $this->model_pdf;
774 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
775 $modele = getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF');
776 }
777 }
778
779 $modelpath = "core/modules/eventorganization/doc/";
780
781 if ($includedocgeneration && !empty($modele)) {
782 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
783 }
784
785 return $result;
786 }
787
795 public function doScheduledJob()
796 {
797 global $conf, $langs;
798
799 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
800
801 $error = 0;
802 $this->output = '';
803 $this->error = '';
804
805 dol_syslog(__METHOD__, LOG_DEBUG);
806
807 $now = dol_now();
808
809 $this->db->begin();
810
811 // ...
812
813 $this->db->commit();
814
815 return $error;
816 }
817}
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:626
$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.