28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
40 public $module =
'eventorganization';
45 public $element =
'conferenceorbooth';
50 public $table_element =
'actioncomm';
55 public $picto =
'conferenceorbooth';
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;
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'),),
133 public $fk_user_author;
153 $this->ismultientitymanaged = 1;
154 $this->isextrafieldmanaged = 1;
157 $this->fields[
'id'][
'visible'] = 0;
159 if (!isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
160 $this->fields[
'entity'][
'enabled'] = 0;
164 foreach ($this->fields as $key => $val) {
165 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
166 unset($this->fields[$key]);
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);
193 return parent::create($user, $notrigger);
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;
206 if ($this->
status == self::STATUS_CONFIRMED) {
207 $this->percentage = 0;
209 if ($this->
status == self::STATUS_DONE) {
210 $this->percentage = 100;
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;
236 $this->fk_action = $this->type_id;
237 $this->fk_soc = $this->socid;
238 $this->datep2 = $this->datef;
251 public function fetch($id, $ref =
null, $ref_ext =
'', $email_msgid =
'', $loadresources = 1)
253 global $dolibarr_main_url_root, $conf, $langs;
255 $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
257 $link_subscription = $dolibarr_main_url_root.
'/public/eventorganization/attendee_new.php?id='.urlencode((
string) ($id)).
'&type=conf';
260 $link_subscription .=
'&securekey='.urlencode($encodedsecurekey);
281 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
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).
')';
297 $sql .=
' WHERE 1 = 1';
304 $this->errors[] = $errormessage;
305 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
309 if (!empty($sortfield)) {
310 $sql .= $this->db->order($sortfield, $sortorder);
312 if (!empty($limit)) {
313 $sql .= $this->db->plimit($limit, $offset);
316 $resql = $this->db->query($sql);
318 $num = $this->db->num_rows($resql);
320 while ($i < ($limit ? min($limit, $num) : $num)) {
321 $obj = $this->db->fetch_object($resql);
323 $record =
new self($this->db);
324 $record->setVarsFromFetchObj($obj);
326 $records[$record->id] = $record;
330 $this->db->free($resql);
334 $this->errors[] =
'Error '.$this->db->lasterror();
335 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
354 return parent::update($user, $notrigger);
364 public function delete($user, $notrigger = 0)
367 return parent::delete($user, $notrigger);
379 global $conf, $langs;
381 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
386 if ($this->
status == self::STATUS_CONFIRMED) {
387 dol_syslog(get_class($this).
"::validate action abandoned: already validated", LOG_WARNING);
396 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
397 $sql .=
" status = ".self::STATUS_CONFIRMED;
398 $sql .=
" WHERE id = ".$this->id;
400 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
401 $resql = $this->db->query($sql);
404 $this->error = $this->db->lasterror();
408 if (!$error && !$notrigger) {
410 $result = $this->
call_trigger(
'CONFERENCEORBOOTH_VALIDATE', $user);
419 $this->
status = self::STATUS_CONFIRMED;
426 $this->db->rollback();
442 if ($this->
status <= self::STATUS_DRAFT) {
453 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'CONFERENCEORBOOTH_UNVALIDATE');
463 public function cancel($user, $notrigger = 0)
466 if ($this->
status != self::STATUS_CONFIRMED) {
477 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'CONFERENCEORBOOTH_CANCEL');
487 public function reopen($user, $notrigger = 0)
490 if ($this->
status != self::STATUS_CANCELED) {
501 return $this->
setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger,
'CONFERENCEORBOOTH_REOPEN');
517 public function getNomUrl($withpicto = 0, $maxlength = 0, $classname =
'', $option =
'', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1, $morecss =
'')
519 global $conf, $langs, $hookmanager;
521 if (!empty($conf->dol_no_mouse_hover)) {
527 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"ConferenceOrBooth").
'</u>';
528 if (isset($this->
status)) {
529 $label .=
' '.$this->getLibStatut(5);
532 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
534 $url = DOL_URL_ROOT.
'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
536 if ($option !=
'nolink') {
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;
542 if ($add_save_lastsearch_values) {
543 $url .=
'&save_lastsearch_values=1';
545 if ($option ==
'withproject') {
546 $url .=
'&withproject=1';
551 if (empty($notooltip)) {
553 $label = $langs->trans(
"ShowConferenceOrBooth");
554 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
557 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
559 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
562 $linkstart =
'<a href="'.$url.
'"';
563 $linkstart .= $linkclose.
'>';
566 $result .= $linkstart;
568 if (empty($this->showphoto_on_popup)) {
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);
576 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
581 $filename = $filearray[0][
'name'];
582 if (!empty($filename)) {
583 $pospoint = strpos($filearray[0][
'name'],
'.');
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>';
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);
595 if ($withpicto != 2) {
596 $result .= $this->ref;
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);
607 $result = $hookmanager->resPrint;
609 $result .= $hookmanager->resPrint;
638 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
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');
655 $statusType =
'status'.$status;
657 if ($status == self::STATUS_CANCELED) {
658 $statusType =
'status6';
661 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
673 global $conf, $langs;
675 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
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">';
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"' :
'').
'>';
687 if (property_exists($this,
'label')) {
688 $return .=
' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.
'</div>';
690 if (property_exists($this,
'thirdparty') && is_object($this->thirdparty)) {
691 $return .=
'<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).
'</div>';
693 if (property_exists($this,
'amount')) {
695 $return .=
'<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span>';
697 if (method_exists($this,
'getLibStatut')) {
698 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3).
'</div>';
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);
721 if ($this->db->num_rows($result)) {
722 $obj = $this->db->fetch_object($result);
724 $this->
id = $obj->rowid;
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);
732 $this->db->free($result);
760 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
762 global $conf, $langs;
765 $includedocgeneration = 0;
767 $langs->load(
"eventorganization@eventorganization");
770 $modele =
'standard_conferenceorbooth';
772 if (!empty($this->model_pdf)) {
773 $modele = $this->model_pdf;
779 $modelpath =
"core/modules/eventorganization/doc/";
781 if ($includedocgeneration && !empty($modele)) {
782 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
797 global $conf, $langs;
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...
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.
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.