27 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39 $langs->loadLangs(array(
'companies',
'eventorganization',
'mails',
'others',
'projects'));
44 $lineid =
GETPOST(
'lineid',
'int');
45 $socid =
GETPOST(
'socid',
'int');
47 $action =
GETPOST(
'action',
'aZ09');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'aZ09');
50 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'conferenceorboothcard';
51 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
54 $withproject =
GETPOST(
'withproject',
'int');
60 $projectstatic =
new Project($db);
61 $diroutputmassaction = $conf->eventorganization->dir_output.
'/temp/massgeneration/'.$user->id;
62 $hookmanager->initHooks(array(
'conferenceorboothcontact',
'globalcard'));
65 $extrafields->fetch_name_optionals_label($object->table_element);
67 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
70 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
73 if ($user->socid > 0) {
77 $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
78 $result =
restrictedArea($user,
'eventorganization', $object->id,
'',
'',
'fk_soc',
'rowid', $isdraft);
80 $permissiontoread = $user->rights->eventorganization->read;
81 $permissiontoadd = $user->rights->eventorganization->write;
82 $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
83 $permissionnote = $user->rights->eventorganization->write;
84 $permissiondellink = $user->rights->eventorganization->write;
85 $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
88 if ($user->socid > 0) {
91 $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
92 $result =
restrictedArea($user,
'eventorganization', $object->id,
'',
'',
'fk_soc',
'rowid', $isdraft);
94 if (!$permissiontoread) {
103 $parameters = array();
104 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
109 if ($action ==
'addcontact' && $permission) {
112 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
115 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".((
int) $object->id).(!empty($withproject)?
'&withproject=1':
''));
118 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
119 $langs->load(
"errors");
120 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
125 } elseif ($action ==
'swapstatut' && $permission) {
127 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
128 } elseif ($action ==
'deletecontact' && $permission) {
130 $result = $object->delete_contact($lineid);
133 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".((
int) $object->id).(!empty($withproject)?
'&withproject=1':
''));
147 $contactstatic =
new Contact($db);
148 $userstatic =
new User($db);
150 $title = $langs->trans(
'ConferenceOrBooth').
" - ".$langs->trans(
'ContactsAddresses');
162 $result = $projectstatic->fetch($object->fk_project);
163 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
164 $projectstatic->fetchComments();
166 if (!empty($projectstatic->socid)) {
167 $projectstatic->fetch_thirdparty();
170 $object->project = clone $projectstatic;
172 if (!empty($withproject)) {
174 $tab =
'eventorganisation';
175 $withProjectUrl =
"&withproject=1";
177 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'), 0,
'',
'');
179 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
183 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
185 $morehtmlref =
'<div class="refidno">';
187 $morehtmlref .= $projectstatic->title;
189 if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
190 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
192 $morehtmlref .=
'</div>';
195 if (empty($user->rights->project->all->lire)) {
196 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
197 $projectstatic->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
200 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
202 print
'<div class="fichecenter">';
203 print
'<div class="fichehalfleft">';
204 print
'<div class="underbanner clearboth"></div>';
206 print
'<table class="border tableforfield centpercent">';
209 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) ||
isModEnabled(
'eventorganization')) {
210 print
'<tr><td class="tdtop">';
211 print $langs->trans(
"Usage");
214 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
215 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
216 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
217 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
220 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
221 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
222 $htmltext = $langs->trans(
"ProjectFollowTasks");
223 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
226 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
227 print
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
228 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
229 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
233 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
234 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
235 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
241 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
242 if ($projectstatic->public) {
243 print $langs->trans(
'SharedProject');
245 print $langs->trans(
'PrivateProject');
250 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
252 print ($start ? $start :
'?');
255 print ($end ? $end :
'?');
256 if ($projectstatic->hasDelay()) {
262 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
263 if (strcmp($projectstatic->budget_amount,
'')) {
264 print
price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
270 $objectconf = $object;
271 $object = $projectstatic;
272 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
273 $object = $objectconf;
279 print
'<div class="fichehalfright">';
280 print
'<div class="underbanner clearboth"></div>';
282 print
'<table class="border tableforfield centpercent">';
285 print
'<td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
286 print nl2br($projectstatic->description);
291 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
292 print
$form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
297 $typeofdata =
'checkbox:'.($projectstatic->accept_conference_suggestions ?
' checked="checked"' :
'');
298 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestConfHelp");
299 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'', $projectstatic, 0, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
301 print
$form->editfieldval(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'1', $projectstatic, 0, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
305 $typeofdata =
'checkbox:'.($projectstatic->accept_booth_suggestions ?
' checked="checked"' :
'');
306 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestBoothHelp");
307 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'', $projectstatic, 0, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
309 print
$form->editfieldval(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'1', $projectstatic, 0, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
313 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth',
'', $projectstatic, 0,
'amount',
'', 0, 0,
'projectid');
315 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth', $projectstatic->price_booth, $projectstatic, 0,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
319 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration',
'', $projectstatic, 0,
'amount',
'', 0, 0,
'projectid');
321 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration', $projectstatic->price_registration, $projectstatic, 0,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
324 print
'<tr><td valign="middle">'.$langs->trans(
"EventOrganizationICSLink").
'</td><td>';
326 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
327 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
330 $message =
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ?
"&entity=".$conf->entity :
"");
331 $message .=
'&exportkey='.urlencode(
getDolGlobalString(
'MAIN_AGENDA_XCAL_EXPORTKEY',
'...'));
332 $message .=
"&project=".$projectstatic->id.
'&module='.urlencode(
'@eventorganization').
'&status='.ConferenceOrBooth::STATUS_CONFIRMED.
'">'.$langs->trans(
'DownloadICSLink').img_picto(
'',
'download',
'class="paddingleft"').
'</a>';
339 print
$form->textwithpicto($langs->trans(
"SuggestOrVoteForConfOrBooth"), $langs->trans(
"EvntOrgRegistrationHelpMessage"));
342 $linksuggest = $dolibarr_main_url_root.
'/public/project/index.php?id='.((int) $projectstatic->id);
343 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $projectstatic->id),
'md5');
344 $linksuggest .=
'&securekey='.urlencode($encodedsecurekey);
347 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.
'" class="quatrevingtpercent">'.$linksuggest.
'</a></div>';
348 print
'<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.
'">'.
img_picto(
'',
'globe').
'</a>';
356 print $langs->trans(
"PublicAttendeeSubscriptionGlobalPage");
359 $link_subscription = $dolibarr_main_url_root.
'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).
'&type=global';
360 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $projectstatic->id),
'md5');
361 $link_subscription .=
'&securekey='.urlencode($encodedsecurekey);
364 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.
'" class="quatrevingtpercent">'.$link_subscription.
'</a></div>';
365 print
'<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.
'">'.
img_picto(
'',
'globe').
'</a>';
375 print
'<div class="clearboth"></div>';
388 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"ConferenceOrBooth"), -1, $object->picto);
390 $linkback =
'<a href="'.dol_buildpath(
'/eventorganization/conferenceorbooth_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
392 $morehtmlref =
'<div class="refidno">';
430 $morehtmlref .=
'</div>';
432 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
439 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
440 foreach ($dirtpls as $reldir) {