dolibarr 19.0.3
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Put here all includes required by your class file
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
28//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
29
34{
38 public $module = 'eventorganization';
39
43 public $element = 'conferenceorbooth';
44
48 public $table_element = 'actioncomm';
49
54 public $ismultientitymanaged = 1;
55
59 public $isextrafieldmanaged = 1;
60
64 public $picto = 'conferenceorbooth';
65
66
67 const STATUS_DRAFT = 0;
68 const STATUS_SUGGESTED = 1;
69 const STATUS_CONFIRMED = 2;
70 const STATUS_NOT_QUALIFIED = 3;
71 const STATUS_DONE = 4;
72 const STATUS_CANCELED = 9;
73
74
111 // BEGIN MODULEBUILDER PROPERTIES
115 public $fields = array(
116 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
117 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
118 '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),
119 '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'),
120 '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'),
121 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
122 'fk_action' => array('type'=>"sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
123 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
124 'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),
125 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'csslist'=>'nowraponall'),
126 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2, 'csslist'=>'nowraponall'),
127 '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'),
128 'fk_user_mod' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2, 'csslist'=>'tdoverflowmax100'),
129 'num_vote' => array('type'=>'smallint', 'label'=>'NbVotes', 'enabled'=>'1', 'position'=>800, 'notnull'=>-1, 'visible'=>5, 'default'=>'0', 'index'=>0),
130 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
131 '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'),),
132 );
133 public $rowid;
134 public $id;
135 public $label;
136 public $fk_soc;
137 public $fk_project;
138 public $note;
139 public $fk_action;
140 public $datec;
141 public $tms;
142 public $fk_user_author;
143 public $fk_user_mod;
144 public $import_key;
145 public $status;
146 // END MODULEBUILDER PROPERTIES
147
148 //public $pubregister;
149
150
156 public function __construct(DoliDB $db)
157 {
158 global $conf, $langs;
159
160 $this->db = $db;
161
162 if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
163 $this->fields['id']['visible'] = 0;
164 }
165 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
166 $this->fields['entity']['enabled'] = 0;
167 }
168
169 // Unset fields that are disabled
170 foreach ($this->fields as $key => $val) {
171 if (isset($val['enabled']) && empty($val['enabled'])) {
172 unset($this->fields[$key]);
173 }
174 }
175
176 // Translate some data of arrayofkeyval
177 if (is_object($langs)) {
178 foreach ($this->fields as $key => $val) {
179 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
180 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
181 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
182 }
183 }
184 }
185 }
186 }
187
195 public function create(User $user, $notrigger = false)
196 {
198 $this->setActionCommFields($user);
199 return parent::create($user, $notrigger);
200 }
201
207 protected function setPercentageFromStatus()
208 {
209 if ($this->status == self::STATUS_DONE) {
210 $this->percentage = 100;
211 }
212 if ($this->status == self::STATUS_DRAFT) {
213 $this->percentage = 0;
214 }
215 }
216
223 protected function setActionCommFields(User $user)
224 {
225 $this->userownerid = $user->id;
226 $this->type_id = $this->fk_action;
227 $this->socid = $this->fk_soc;
228 $this->datef = $this->datep2;
229 $this->note_private = $this->note;
230 }
231
237 protected function getActionCommFields()
238 {
239 $this->fk_action = $this->type_id;
240 $this->fk_soc = $this->socid;
241 $this->datep2 = $this->datef;
242 }
243
254 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
255 {
256 global $dolibarr_main_url_root, $conf, $langs;
257
258 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
259
260 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode($id).'&type=conf';
261
262 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2);
263 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
264
265 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
266 $this->pubregister = $link_subscription;*/
267
268 $this->getActionCommFields();
269 return $result;
270 }
271
283 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
284 {
285 //TODO set percent according status
286 global $conf;
287
288 dol_syslog(__METHOD__, LOG_DEBUG);
289
290 $records = array();
291
292 $sql = 'SELECT ';
293 $sql .= $this->getFieldList('t');
294 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
295 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
296 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
297 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
298 } else {
299 $sql .= ' WHERE 1 = 1';
300 }
301 // Manage filter
302 $sqlwhere = array();
303 if (count($filter) > 0) {
304 foreach ($filter as $key => $value) {
305 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
306 $sqlwhere[] = $key." = ".((int) $value);
307 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
308 $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
309 } elseif ($key == 'customsql') {
310 $sqlwhere[] = $value;
311 } elseif (strpos($value, '%') === false) {
312 $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
313 } else {
314 $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
315 }
316 }
317 }
318 if (count($sqlwhere) > 0) {
319 $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
320 }
321
322 if (!empty($sortfield)) {
323 $sql .= $this->db->order($sortfield, $sortorder);
324 }
325 if (!empty($limit)) {
326 $sql .= $this->db->plimit($limit, $offset);
327 }
328
329 $resql = $this->db->query($sql);
330 if ($resql) {
331 $num = $this->db->num_rows($resql);
332 $i = 0;
333 while ($i < ($limit ? min($limit, $num) : $num)) {
334 $obj = $this->db->fetch_object($resql);
335
336 $record = new self($this->db);
337 $record->setVarsFromFetchObj($obj);
338
339 $records[$record->id] = $record;
340
341 $i++;
342 }
343 $this->db->free($resql);
344
345 return $records;
346 } else {
347 $this->errors[] = 'Error '.$this->db->lasterror();
348 dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
349
350 return -1;
351 }
352 }
353
361 public function update(User $user, $notrigger = false)
362 {
364 $this->setActionCommFields($user);
365 return parent::update($user, $notrigger);
366 }
367
374 public function delete($notrigger = false)
375 {
376 //TODO delete attendees and subscription
377 return parent::delete($notrigger);
378 }
379
387 public function validate($user, $notrigger = 0)
388 {
389 global $conf, $langs;
390
391 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
392
393 $error = 0;
394
395 // Protection
396 if ($this->status == self::STATUS_CONFIRMED) {
397 dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
398 return 0;
399 }
400
401 $now = dol_now();
402
403 $this->db->begin();
404
405 // Validate
406 $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
407 $sql .= " status = ".self::STATUS_CONFIRMED;
408 $sql .= " WHERE id = ".$this->id;
409
410 dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
411 $resql = $this->db->query($sql);
412 if (!$resql) {
413 dol_print_error($this->db);
414 $this->error = $this->db->lasterror();
415 $error++;
416 }
417
418 if (!$error && !$notrigger) {
419 // Call trigger
420 $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user);
421 if ($result < 0) {
422 $error++;
423 }
424 // End call triggers
425 }
426
427 // Set new ref and current status
428 if (!$error) {
429 $this->status = self::STATUS_CONFIRMED;
430 }
431
432 if (!$error) {
433 $this->db->commit();
434 return 1;
435 } else {
436 $this->db->rollback();
437 return -1;
438 }
439 }
440
441
449 public function setDraft($user, $notrigger = 0)
450 {
451 // Protection
452 if ($this->status <= self::STATUS_DRAFT) {
453 return 0;
454 }
455
456 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
457 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
458 {
459 $this->error='Permission denied';
460 return -1;
461 }*/
462
463 return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'CONFERENCEORBOOTH_UNVALIDATE');
464 }
465
473 public function cancel($user, $notrigger = 0)
474 {
475 // Protection
476 if ($this->status != self::STATUS_CONFIRMED) {
477 return 0;
478 }
479
480 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
481 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
482 {
483 $this->error='Permission denied';
484 return -1;
485 }*/
486
487 return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'CONFERENCEORBOOTH_CANCEL');
488 }
489
497 public function reopen($user, $notrigger = 0)
498 {
499 // Protection
500 if ($this->status != self::STATUS_CANCELED) {
501 return 0;
502 }
503
504 /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->write))
505 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->eventorganization->eventorganization_advance->validate))))
506 {
507 $this->error='Permission denied';
508 return -1;
509 }*/
510
511 return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN');
512 }
513
527 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
528 {
529 global $conf, $langs, $hookmanager;
530
531 if (!empty($conf->dol_no_mouse_hover)) {
532 $notooltip = 1; // Force disable tooltips
533 }
534
535 $result = '';
536
537 $label = img_picto('', $this->picto).' <u>'.$langs->trans("ConferenceOrBooth").'</u>';
538 if (isset($this->status)) {
539 $label .= ' '.$this->getLibStatut(5);
540 }
541 $label .= '<br>';
542 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
543
544 $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
545
546 if ($option != 'nolink') {
547 // Add param to save lastsearch_values or not
548 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
549 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
550 $add_save_lastsearch_values = 1;
551 }
552 if ($add_save_lastsearch_values) {
553 $url .= '&save_lastsearch_values=1';
554 }
555 if ($option == 'withproject') {
556 $url .= '&withproject=1';
557 }
558 }
559
560 $linkclose = '';
561 if (empty($notooltip)) {
562 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
563 $label = $langs->trans("ShowConferenceOrBooth");
564 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
565 }
566 //$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
567 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
568 } else {
569 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
570 }
571
572 $linkstart = '<a href="'.$url.'"';
573 $linkstart .= $linkclose.'>';
574 $linkend = '</a>';
575
576 $result .= $linkstart;
577
578 if (empty($this->showphoto_on_popup)) {
579 if ($withpicto) {
580 $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);
581 // var_dump($picto);
582 $result .= $picto;
583 }
584 } else {
585 if ($withpicto) {
586 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
587
588 //list($class, $module) = explode('@', $this->picto);
589 $upload_dir = $conf->eventorganisation->multidir_output[$conf->entity]."/".dol_sanitizeFileName($this->ref);
590 $filearray = dol_dir_list($upload_dir, "files");
591 $filename = $filearray[0]['name'];
592 if (!empty($filename)) {
593 $pospoint = strpos($filearray[0]['name'], '.');
594
595 $pathtophoto = '/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
596 $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>';
597
598 $result .= '</div>';
599 } else {
600 $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);
601 }
602 }
603 }
604
605 if ($withpicto != 2) {
606 $result .= $this->ref;
607 }
608
609 $result .= $linkend;
610 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
611
612 global $action, $hookmanager;
613 $hookmanager->initHooks(array('conferenceorboothdao'));
614 $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
615 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
616 if ($reshook > 0) {
617 $result = $hookmanager->resPrint;
618 } else {
619 $result .= $hookmanager->resPrint;
620 }
621
622 return $result;
623 }
624
632 public function getLibStatut($mode = 0, $hidenastatus = 0)
633 {
634 return $this->LibStatutEvent($this->status, $mode);
635 }
636
637 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
645 public function LibStatutEvent($status, $mode = 0)
646 {
647 // phpcs:enable
648 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
649 global $langs;
650 //$langs->load("eventorganization@eventorganization");
651 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
652 $this->labelStatus[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
653 $this->labelStatus[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
654 $this->labelStatus[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
655 $this->labelStatus[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
656 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
657 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
658 $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->transnoentitiesnoconv('Suggested');
659 $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->transnoentitiesnoconv('Confirmed');
660 $this->labelStatusShort[self::STATUS_NOT_QUALIFIED] = $langs->transnoentitiesnoconv('NotSelected');
661 $this->labelStatusShort[self::STATUS_DONE] = $langs->transnoentitiesnoconv('Done');
662 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
663 }
664
665 $statusType = 'status'.$status;
666 //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
667 if ($status == self::STATUS_CANCELED) {
668 $statusType = 'status6';
669 }
670
671 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
672 }
673
681 public function getKanbanView($option = '', $arraydata = null)
682 {
683 global $conf, $langs;
684
685 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
686
687 $return = '<div class="box-flex-item box-flex-grow-zero">';
688 $return .= '<div class="info-box info-box-sm">';
689 $return .= '<span class="info-box-icon bg-infobox-action">';
690 $return .= img_picto('', $this->picto);
691 $return .= '</span>';
692 $return .= '<div class="info-box-content">';
693 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
694 if ($selected >= 0) {
695 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
696 }
697 if (property_exists($this, 'label')) {
698 $return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
699 }
700 if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
701 $return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
702 }
703 if (property_exists($this, 'amount')) {
704 $return .= '<br>';
705 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
706 }
707 if (method_exists($this, 'getLibStatut')) {
708 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
709 }
710 $return .= '</div>';
711 $return .= '</div>';
712 $return .= '</div>';
713
714 return $return;
715 }
716
723 public function info($id)
724 {
725 $sql = 'SELECT rowid, datec as datec, tms as datem,';
726 $sql .= ' fk_user_author, fk_user_mod';
727 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
728 $sql .= ' WHERE t.id = '.((int) $id);
729 $result = $this->db->query($sql);
730 if ($result) {
731 if ($this->db->num_rows($result)) {
732 $obj = $this->db->fetch_object($result);
733
734 $this->id = $obj->rowid;
735
736 $this->user_creation_id = $obj->fk_user_creat;
737 $this->user_modification_id = $obj->fk_user_modif;
738 $this->date_creation = $this->db->jdate($obj->datec);
739 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
740 }
741
742 $this->db->free($result);
743 } else {
744 dol_print_error($this->db);
745 }
746 }
747
754 public function initAsSpecimen()
755 {
756 $this->initAsSpecimenCommon();
757 }
758
770 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
771 {
772 global $conf, $langs;
773
774 $result = 0;
775 $includedocgeneration = 0;
776
777 $langs->load("eventorganization@eventorganization");
778
779 if (!dol_strlen($modele)) {
780 $modele = 'standard_conferenceorbooth';
781
782 if (!empty($this->model_pdf)) {
783 $modele = $this->model_pdf;
784 } elseif (getDolGlobalString('CONFERENCEORBOOTH_ADDON_PDF')) {
785 $modele = $conf->global->CONFERENCEORBOOTH_ADDON_PDF;
786 }
787 }
788
789 $modelpath = "core/modules/eventorganization/doc/";
790
791 if ($includedocgeneration && !empty($modele)) {
792 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
793 }
794
795 return $result;
796 }
797
805 public function doScheduledJob()
806 {
807 global $conf, $langs;
808
809 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
810
811 $error = 0;
812 $this->output = '';
813 $this->error = '';
814
815 dol_syslog(__METHOD__, LOG_DEBUG);
816
817 $now = dol_now();
818
819 $this->db->begin();
820
821 // ...
822
823 $this->db->commit();
824
825 return $error;
826 }
827}
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Definition security.php:604
$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 optionaly the picto)
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
getActionCommFields()
Get action comm fields.
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 Percentage from status.
setDraft($user, $notrigger=0)
Set draft status.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
update(User $user, $notrigger=false)
Update object into database.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
create(User $user, $notrigger=false)
Create object into database.
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.
getKanbanView($option='', $arraydata=null)
Return a thumb for kanban views.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
dol_dir_list($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:62
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.