dolibarr 18.0.6
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
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'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100 maxwidth75'),
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 public $tms;
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 $conf, $langs;
149
150 $this->db = $db;
151
152 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
153 $this->fields['id']['visible'] = 0;
154 }
155 if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
156 $this->fields['entity']['enabled'] = 0;
157 }
158
159 // Unset fields that are disabled
160 foreach ($this->fields as $key => $val) {
161 if (isset($val['enabled']) && empty($val['enabled'])) {
162 unset($this->fields[$key]);
163 }
164 }
165
166 // Translate some data of arrayofkeyval
167 if (is_object($langs)) {
168 foreach ($this->fields as $key => $val) {
169 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
170 foreach ($val['arrayofkeyval'] as $key2 => $val2) {
171 $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
172 }
173 }
174 }
175 }
176 }
177
185 public function create(User $user, $notrigger = false)
186 {
188 $this->setActionCommFields($user);
189 return parent::create($user, $notrigger);
190 }
191
197 protected function setPercentageFromStatus()
198 {
199 if ($this->status == self::STATUS_DONE) {
200 $this->percentage = 100;
201 }
202 if ($this->status == self::STATUS_DRAFT) {
203 $this->percentage = 0;
204 }
205 }
206
213 protected function setActionCommFields(User $user)
214 {
215 $this->userownerid = $user->id;
216 $this->type_id = $this->fk_action;
217 $this->socid = $this->fk_soc;
218 $this->datef = $this->datep2;
219 $this->note_private = $this->note;
220 }
221
227 protected function getActionCommFields()
228 {
229 $this->fk_action = $this->type_id;
230 $this->fk_soc = $this->socid;
231 $this->datep2 = $this->datef;
232 }
233
244 public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
245 {
246 global $dolibarr_main_url_root, $conf, $langs;
247
248 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
249
250 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode($id).'&type=conf';
251
252 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2);
253 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
254
255 /*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
256 $this->pubregister = $link_subscription;*/
257
258 $this->getActionCommFields();
259 return $result;
260 }
261
273 public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
274 {
275 //TODO set percent according status
276 global $conf;
277
278 dol_syslog(__METHOD__, LOG_DEBUG);
279
280 $records = array();
281
282 $sql = 'SELECT ';
283 $sql .= $this->getFieldList('t');
284 $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
285 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
286 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
287 $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
288 } else {
289 $sql .= ' WHERE 1 = 1';
290 }
291 // Manage filter
292 $sqlwhere = array();
293 if (count($filter) > 0) {
294 foreach ($filter as $key => $value) {
295 if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
296 $sqlwhere[] = $key." = ".((int) $value);
297 } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
298 $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
299 } elseif ($key == 'customsql') {
300 $sqlwhere[] = $value;
301 } elseif (strpos($value, '%') === false) {
302 $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
303 } else {
304 $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
305 }
306 }
307 }
308 if (count($sqlwhere) > 0) {
309 $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
310 }
311
312 if (!empty($sortfield)) {
313 $sql .= $this->db->order($sortfield, $sortorder);
314 }
315 if (!empty($limit)) {
316 $sql .= $this->db->plimit($limit, $offset);
317 }
318
319 $resql = $this->db->query($sql);
320 if ($resql) {
321 $num = $this->db->num_rows($resql);
322 $i = 0;
323 while ($i < ($limit ? min($limit, $num) : $num)) {
324 $obj = $this->db->fetch_object($resql);
325
326 $record = new self($this->db);
327 $record->setVarsFromFetchObj($obj);
328
329 $records[$record->id] = $record;
330
331 $i++;
332 }
333 $this->db->free($resql);
334
335 return $records;
336 } else {
337 $this->errors[] = 'Error '.$this->db->lasterror();
338 dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
339
340 return -1;
341 }
342 }
343
351 public function update(User $user, $notrigger = false)
352 {
354 $this->setActionCommFields($user);
355 return parent::update($user, $notrigger);
356 }
357
364 public function delete($notrigger = false)
365 {
366 //TODO delete attendees and subscription
367 return parent::delete($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 abandonned: 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 && 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 (!empty($conf->global->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 margintoponly">'.$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 $this->id = $obj->rowid;
724
725 $this->user_creation_id = $obj->fk_user_creat;
726 $this->user_modification_id = $obj->fk_user_modif;
727 $this->date_creation = $this->db->jdate($obj->datec);
728 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
729 }
730
731 $this->db->free($result);
732 } else {
733 dol_print_error($this->db);
734 }
735 }
736
743 public function initAsSpecimen()
744 {
745 $this->initAsSpecimenCommon();
746 }
747
759 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
760 {
761 global $conf, $langs;
762
763 $result = 0;
764 $includedocgeneration = 0;
765
766 $langs->load("eventorganization@eventorganization");
767
768 if (!dol_strlen($modele)) {
769 $modele = 'standard_conferenceorbooth';
770
771 if (!empty($this->model_pdf)) {
772 $modele = $this->model_pdf;
773 } elseif (!empty($conf->global->CONFERENCEORBOOTH_ADDON_PDF)) {
774 $modele = $conf->global->CONFERENCEORBOOTH_ADDON_PDF;
775 }
776 }
777
778 $modelpath = "core/modules/eventorganization/doc/";
779
780 if ($includedocgeneration && !empty($modele)) {
781 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
782 }
783
784 return $result;
785 }
786
794 public function doScheduledJob()
795 {
796 global $conf, $langs;
797
798 //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
799
800 $error = 0;
801 $this->output = '';
802 $this->error = '';
803
804 dol_syslog(__METHOD__, LOG_DEBUG);
805
806 $now = dol_now();
807
808 $this->db->begin();
809
810 // ...
811
812 $this->db->commit();
813
814 return $error;
815 }
816}
$object ref
Definition info.php:78
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')
Returns a hash (non reversible encryption) of a string.