25 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.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.
'/categories/class/categorie.class.php';
38 $langs->loadLangs(array(
"eventorganization",
"projects",
"companies",
"other",
"mails"));
42 $lineid =
GETPOST(
'lineid',
'int');
43 $socid =
GETPOST(
'socid',
'int');
45 $action =
GETPOST(
'action',
'aZ09');
46 $confirm =
GETPOST(
'confirm',
'alpha');
47 $cancel =
GETPOST(
'cancel',
'aZ09');
48 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'conferenceorboothcard';
49 $backtopage =
GETPOST(
'backtopage',
'alpha');
50 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
52 $withproject =
GETPOST(
'withproject',
'int');
57 $projectstatic =
new Project($db);
58 $diroutputmassaction = $conf->eventorganization->dir_output.
'/temp/massgeneration/'.$user->id;
59 $hookmanager->initHooks(array(
'conferenceorboothcontact',
'globalcard'));
61 $extrafields->fetch_name_optionals_label($object->table_element);
63 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
66 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
69 if ($user->socid > 0) {
72 $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
73 $result =
restrictedArea($user,
'eventorganization', $object->id,
'',
'',
'fk_soc',
'rowid', $isdraft);
75 $permissiontoread = $user->rights->eventorganization->read;
76 $permissiontoadd = $user->rights->eventorganization->write;
77 $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
78 $permissionnote = $user->rights->eventorganization->write;
79 $permissiondellink = $user->rights->eventorganization->write;
80 $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
83 if ($user->socid > 0) {
86 $isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
87 $result =
restrictedArea($user,
'eventorganization', $object->id,
'',
'',
'fk_soc',
'rowid', $isdraft);
89 if (!$permissiontoread) {
98 $parameters = array();
99 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
104 if ($action ==
'addcontact' && $permission) {
107 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
110 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".((
int) $object->id).(!empty($withproject)?
'&withproject=1':
''));
113 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
114 $langs->load(
"errors");
115 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
120 } elseif ($action ==
'swapstatut' && $permission) {
122 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
123 } elseif ($action ==
'deletecontact' && $permission) {
125 $result = $object->delete_contact($lineid);
128 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".((
int) $object->id).(!empty($withproject)?
'&withproject=1':
''));
142 $contactstatic =
new Contact($db);
143 $userstatic =
new User($db);
145 $title = $langs->trans(
'ConferenceOrBooth').
" - ".$langs->trans(
'ContactsAddresses');
157 $result = $projectstatic->fetch($object->fk_project);
158 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
159 $projectstatic->fetchComments();
161 if (!empty($projectstatic->socid)) {
162 $projectstatic->fetch_thirdparty();
165 $object->project = clone $projectstatic;
167 if (!empty($withproject)) {
169 $tab =
'eventorganisation';
170 $withProjectUrl =
"&withproject=1";
172 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'), 0,
'',
'');
174 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
178 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
180 $morehtmlref =
'<div class="refidno">';
182 $morehtmlref .= $projectstatic->title;
184 if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
185 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$projectstatic->thirdparty->getNomUrl(1,
'project');
187 $morehtmlref .=
'</div>';
190 if (empty($user->rights->project->all->lire)) {
191 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
192 $projectstatic->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
195 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
197 print
'<div class="fichecenter">';
198 print
'<div class="fichehalfleft">';
199 print
'<div class="underbanner clearboth"></div>';
201 print
'<table class="border tableforfield centpercent">';
204 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
205 print
'<tr><td class="tdtop">';
206 print $langs->trans(
"Usage");
209 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
210 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
211 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
212 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
215 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
216 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
217 $htmltext = $langs->trans(
"ProjectFollowTasks");
218 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
221 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
222 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"' :
'')).
'"> ';
223 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
224 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
227 if (!empty($conf->eventorganization->enabled)) {
228 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"' :
'')).
'"> ';
229 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
230 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
236 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
237 if ($projectstatic->public) {
238 print $langs->trans(
'SharedProject');
240 print $langs->trans(
'PrivateProject');
245 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
247 print ($start ? $start :
'?');
250 print ($end ? $end :
'?');
251 if ($projectstatic->hasDelay()) {
257 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
258 if (strcmp($projectstatic->budget_amount,
'')) {
259 print
price($projectstatic->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
265 $objectconf = $object;
266 $object = $projectstatic;
267 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
268 $object = $objectconf;
274 print
'<div class="fichehalfright">';
275 print
'<div class="underbanner clearboth"></div>';
277 print
'<table class="border tableforfield centpercent">';
280 print
'<td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
281 print nl2br($projectstatic->description);
286 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
287 print
$form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
292 $typeofdata =
'checkbox:'.($projectstatic->accept_conference_suggestions ?
' checked="checked"' :
'');
293 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestConfHelp");
294 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'', $projectstatic, 0, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
296 print
$form->editfieldval(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'1', $projectstatic, 0, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
300 $typeofdata =
'checkbox:'.($projectstatic->accept_booth_suggestions ?
' checked="checked"' :
'');
301 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestBoothHelp");
302 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'', $projectstatic, 0, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
304 print
$form->editfieldval(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'1', $projectstatic, 0, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
308 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth',
'', $projectstatic, 0,
'amount',
'', 0, 0,
'projectid');
310 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth', $projectstatic->price_booth, $projectstatic, 0,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
314 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration',
'', $projectstatic, 0,
'amount',
'', 0, 0,
'projectid');
316 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration', $projectstatic->price_registration, $projectstatic, 0,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
319 print
'<tr><td valign="middle">'.$langs->trans(
"EventOrganizationICSLink").
'</td><td>';
321 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
322 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
325 $message =
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ?
"&entity=".$conf->entity :
"");
326 $message .=
'&exportkey='.urlencode(
getDolGlobalString(
'MAIN_AGENDA_XCAL_EXPORTKEY',
'...'));
327 $message .=
"&project=".$projectstatic->id.
'&module='.urlencode(
'@eventorganization').
'&status='.ConferenceOrBooth::STATUS_CONFIRMED.
'">'.$langs->trans(
'DownloadICSLink').img_picto(
'',
'download',
'class="paddingleft"').
'</a>';
334 print
$form->textwithpicto($langs->trans(
"SuggestOrVoteForConfOrBooth"), $langs->trans(
"EvntOrgRegistrationHelpMessage"));
337 $linksuggest = $dolibarr_main_url_root.
'/public/project/index.php?id='.((int) $projectstatic->id);
338 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $projectstatic->id),
'md5');
339 $linksuggest .=
'&securekey='.urlencode($encodedsecurekey);
342 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.
'" class="quatrevingtpercent">'.$linksuggest.
'</a></div>';
343 print
'<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.
'">'.
img_picto(
'',
'globe').
'</a>';
351 print $langs->trans(
"PublicAttendeeSubscriptionGlobalPage");
354 $link_subscription = $dolibarr_main_url_root.
'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).
'&type=global';
355 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $projectstatic->id),
'md5');
356 $link_subscription .=
'&securekey='.urlencode($encodedsecurekey);
359 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.
'" class="quatrevingtpercent">'.$link_subscription.
'</a></div>';
360 print
'<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.
'">'.
img_picto(
'',
'globe').
'</a>';
370 print
'<div class="clearboth"></div>';
383 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"ConferenceOrBooth"), -1, $object->picto);
385 $linkback =
'<a href="'.dol_buildpath(
'/eventorganization/conferenceorbooth_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
387 $morehtmlref =
'<div class="refidno">';
425 $morehtmlref .=
'</div>';
427 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
434 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
435 foreach ($dirtpls as $reldir) {