Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

This commit is contained in:
Laurent Destailleur 2021-09-04 13:53:46 +02:00
commit 5b9a583005
11 changed files with 299 additions and 140 deletions

View File

@ -48,8 +48,8 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),

View File

@ -246,7 +246,7 @@ class ConferenceOrBooth extends ActionComm
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id).'&type=conf';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);

View File

@ -103,7 +103,8 @@ class ConferenceOrBoothAttendee extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>1, 'visible'=>0, 'index'=>1,),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1,),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1,),
'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'amount' => array('type'=>'price', 'label'=>'AmountOfSubscriptionPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
@ -403,7 +404,7 @@ class ConferenceOrBoothAttendee extends CommonObject
$sql = 'SELECT ';
$sql .= $this->getFieldList('t');
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
} else {
@ -746,6 +747,10 @@ class ConferenceOrBoothAttendee extends CommonObject
$url .= '&conforboothid='.$this->fk_actioncomm;
}
if ($option == 'projectid') {
$url .= '&fk_project='.$this->fk_project.'&withproject=1';
}
if ($option == 'conforboothidproject') {
$url .= '&conforboothid='.$this->fk_actioncomm.'&withproject=1' ;
}

View File

@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
if ($conf->categorie->enabled) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@ -266,7 +267,7 @@ if ($projectid > 0) {
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
$head = project_prepare_head($project);
print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'));
print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("ConferenceOrBoothTab"), -1, ($project->public ? 'projectpub' : 'project'));
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -440,10 +441,10 @@ if ($projectid > 0) {
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionPage");
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id;
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
@ -465,6 +466,12 @@ if ($projectid > 0) {
print dol_get_fiche_end();
}
if (!empty($project->id)) {
$head = conferenceorboothProjectPrepareHead($project);
$tab = 'conferenceorbooth';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
}
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';

View File

@ -47,6 +47,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$conf_or_booth_id = GETPOST('conforboothid', 'int');
$fk_project = GETPOST('fk_project', 'int');
$withproject = GETPOST('withproject', 'int');
// Initialize technical objects
@ -174,7 +175,7 @@ $title = $langs->trans("ConferenceOrBoothAttendee");
$help_url = '';
llxHeader('', $title, $help_url);
$result = $projectstatic->fetch($confOrBooth->fk_project);
$result = $projectstatic->fetch(empty($confOrBooth->fk_project)?$fk_project:$confOrBooth->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
@ -343,10 +344,44 @@ if (!empty($withproject)) {
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>';
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>';
print '</div>';
@ -370,6 +405,10 @@ if ($action == 'create') {
if ($confOrBooth->id > 0) {
print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
}
if ($projectstatic->id > 0) {
print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
}
print '<input type="hidden" name="action" value="add">';
if ($backtopage) {
@ -381,9 +420,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
// Set some default values
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
@ -427,6 +463,9 @@ if (($id || $ref) && $action == 'edit') {
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
if ($projectstatic->id > 0) {
print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
}
print dol_get_fiche_head();
@ -476,16 +515,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action xxxx
if ($action == 'xxx') {
$formquestion = array();
/*
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
);
*/
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
}
@ -501,61 +530,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1&conforboothid='.$confOrBooth->id .$withProjectUrl.'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {
//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
$morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= ': '.$proj->getNomUrl();
} else {
$morehtmlref .= '';
}
}
}*/
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_soc']); // Hide field already shown in banner
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
@ -634,29 +624,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle');
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&mode=init#formmailbeforetitle');
}
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&conforboothid='.$confOrBooth->id.'&action=edit', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit', '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ENABLED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
}
}
if ($permissiontoadd) {
if ($object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n";
}
}
*/
// Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));

View File

@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattend
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other"));
$langs->loadLangs(array("eventorganization", "other", "projects"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -59,6 +59,7 @@ $conf_or_booth_id = GETPOST('conforboothid', 'int');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$fk_project = GETPOST('fk_project', 'int');
$withProjectUrl='';
@ -215,9 +216,19 @@ if ($conf_or_booth_id > 0) {
$result = $confOrBooth->fetch($conf_or_booth_id);
if ($result < 0) {
setEventMessages(null, $confOrBooth->errors, 'errors');
} else {
$fk_project = $confOrBooth->fk_project;
}
}
if ($fk_project > 0) {
$result = $projectstatic->fetch($fk_project);
if ($result < 0) {
setEventMessages(null, $projectstatic->errors, 'errors');
}
}
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
@ -234,7 +245,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
if (!empty($confOrBooth->id)) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
}
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
@ -247,6 +260,9 @@ if ($object->ismultientitymanaged == 1) {
} else {
$sql .= " WHERE 1 = 1";
}
if (!empty($projectstatic->id)) {
$sql .= " AND t.fk_project=".((int) $projectstatic->id);
}
foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
@ -336,8 +352,9 @@ $morejs = array();
$morecss = array();
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
if ($confOrBooth->id > 0) {
$result = $projectstatic->fetch($confOrBooth->fk_project);
if ($projectstatic->id > 0 || $confOrBooth > 0) {
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
@ -456,7 +473,7 @@ if ($confOrBooth->id > 0) {
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -506,10 +523,44 @@ if ($confOrBooth->id > 0) {
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>';
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>';
print '</div>';
@ -520,38 +571,44 @@ if ($confOrBooth->id > 0) {
print dol_get_fiche_end();
print '<br>';
if (empty($confOrBooth->id)) {
$head = conferenceorboothProjectPrepareHead($projectstatic);
$tab = 'attendees';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
}
}
$head = conferenceorboothPrepareHead($confOrBooth, $withproject);
print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
if ($confOrBooth->id > 0) {
$head = conferenceorboothPrepareHead($confOrBooth, $withproject);
print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
//$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("ConferenceOrBooth") . ' - ' . $langs->trans("Attendees") . ' - ' . $confOrBooth->id;
//$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("ConferenceOrBooth") . ' - ' . $langs->trans("Attendees") . ' - ' . $confOrBooth->id;
$object_evt=$object;
$object=$confOrBooth;
$object_evt = $object;
$object = $confOrBooth;
dol_banner_tab($object, 'ref', '', 0);
dol_banner_tab($object, 'ref', '', 0);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">' . "\n";
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object=$object_evt;
print '</table>';
print '</div>';
print '</div>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$object = $object_evt;
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print dol_get_fiche_end();
}
}
$arrayofselected = is_array($toselect) ? $toselect : array();
@ -575,6 +632,9 @@ foreach ($search as $key => $val) {
if ($confOrBooth->id > 0) {
$param .= '&conforboothid='.urlencode($confOrBooth->id).$withProjectUrl;
}
if ($projectstatic->id > 0) {
$param .= '&fk_project='.urlencode($projectstatic->id).$withProjectUrl;
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@ -612,7 +672,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].(!empty($confOrBooth->id)?'?conforboothid='.$confOrBooth->id:'').$withProjectUrl), '', $permissiontoadd);
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].(!empty($confOrBooth->id)?'?conforboothid='.$confOrBooth->id:'').$withProjectUrl), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -784,7 +844,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'ref') {
print $object->getNomUrl(1, (!empty($withproject)?'conforboothidproject':'conforboothid'));
$optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
if (empty($confOrBooth->id)) {
$optionLink='projectid';
}
print $object->getNomUrl(1, $optionLink);
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}

View File

@ -106,6 +106,80 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBooth Project tab
*
* @param $object Project Project
* @return array
*/
function conferenceorboothProjectPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("eventorganization");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_list.php", 1).'?projectid='.$object->id;
$head[$h][1] = $langs->trans("ConferenceOrBooth");
$head[$h][2] = 'conferenceorbooth';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_conferenceorbooth_project_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
$conforbooth=new ConferenceOrBooth($db);
$result = $conforbooth->fetchAll('', '', 0, 0, array('t.fk_project'=>$object->id));
if (!is_array($result) && $result<0) {
setEventMessages($conforbooth->error, $conforbooth->errors, 'errors');
} else {
$nbConferenceOrBooth = count($result);
}
dol_setcache($cachekey, $nbConferenceOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbConferenceOrBooth > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbConferenceOrBooth.'</span>';
}
$h++;
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_list.php", 1).'?fk_project='.$object->id.'&withproject=1';
$head[$h][1] = $langs->trans("Attendees");
$head[$h][2] = 'attendees';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_attendees_conferenceorbooth_project_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
$attendees=new ConferenceOrBoothAttendee($db);
$result = $attendees->fetchAll('', '', 0, 0, array('t.fk_project'=>$object->id));
if (!is_array($result) && $result<0) {
setEventMessages($attendees->error, $attendees->errors, 'errors');
} else {
$nbAttendees = count($result);
}
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbAttendees > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbAttendees.'</span>';
}
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization', 'remove');
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBoothAttendees

View File

@ -21,10 +21,12 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_evento
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-- END MODULEBUILDER INDEXES
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email);

View File

@ -19,7 +19,8 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
fk_soc integer,
fk_actioncomm integer NOT NULL,
fk_actioncomm integer,
fk_project integer NOT NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,

View File

@ -110,7 +110,8 @@ ListOfConferencesOrBooths=List of conferences or booths
SuggestConference = Suggest a new conference
SuggestBooth = Suggest a booth
ViewAndVote = View and vote for suggested events
PublicAttendeeSubscriptionPage = Public link for registration to the event
PublicAttendeeSubscriptionGlobalPage = Public link for registration to the event
PublicAttendeeSubscriptionPage = Public link for registration to this event only
MissingOrBadSecureKey = The security key is invalid or missing
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference : '%s'
EvntOrgDuration = This conference starts on %s and ends on %s.

View File

@ -80,20 +80,35 @@ $societe = GETPOST("societe");
// Getting id from Post and decoding it
$id = GETPOST('id', 'int');
$type = GETPOST('type', 'alpha');
$conference = new ConferenceOrBooth($db);
$resultconf = $conference->fetch($id);
if ($resultconf < 0) {
print 'Bad value for parameter id';
exit;
$project = new Project($db);
if ($type=='conf') {
$resultconf = $conference->fetch($id);
if ($resultconf < 0) {
print 'Bad value for parameter id';
exit;
}
$resultproject = $project->fetch($conference->fk_project);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
}
if ($type=='global') {
$project = new Project($db);
if (empty($id)) {
$id = GETPOST('fk_project', 'int');
}
$resultproject = $project->fetch($id);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
}
$project = new Project($db);
$resultproject = $project->fetch($conference->fk_project);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
// Security check
@ -206,7 +221,7 @@ if ($reshook < 0) {
}
// Action called when page is submitted
if (empty($reshook) && $action == 'add' && $conference->status == 2) {
if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status!=2 || !empty($project->id) && $project->status==Project::STATUS_VALIDATED)) {
$error = 0;
$urlback = '';
@ -235,7 +250,15 @@ if (empty($reshook) && $action == 'add' && $conference->status == 2) {
if (!$error) {
// Check if attendee already exists (by email and for this event)
$confattendee = new ConferenceOrBoothAttendee($db);
$resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"'));
if ($type=='global') {
$filter = array('t.fk_project'=>$id, 'customsql'=>'t.email="'.$email.'"');
}
if ($action='conf') {
$filter = array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"');
}
$resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, $filter);
if ($resultfetchconfattendee > 0 && count($resultfetchconfattendee)>0) {
// Found confattendee
$confattendee = array_shift($resultfetchconfattendee);
@ -243,6 +266,7 @@ if (empty($reshook) && $action == 'add' && $conference->status == 2) {
// Need to create a confattendee
$confattendee->date_subscription = dol_now();
$confattendee->email = $email;
$confattendee->fk_project = $project->id;
$confattendee->fk_actioncomm = $id;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
@ -470,24 +494,29 @@ print '<div id="divsubscribe">';
print '<div class="center subscriptionformhelptext justify">';
// Welcome message
print $langs->trans("EvntOrgWelcomeMessage", $conference->label);
print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label);
print '<br>';
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
if ($conference->id) {
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
} else {
print $langs->trans("EvntOrgDuration", dol_print_date($project->date_start), dol_print_date($project->date_end));
}
print '</div>';
print '<br>';
dol_htmloutput_errors($errmsg);
if ($conference->status!=2) {
print $langs->trans("ConferenceIsNotConfirmed");
} else {
if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CONFIRMED || (!empty($project->id) && $project->status==Project::STATUS_VALIDATED)) {
// Print form
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="newmember">' . "\n";
print '<input type="hidden" name="token" value="' . newToken() . '" / >';
print '<input type="hidden" name="entity" value="' . $entity . '" />';
print '<input type="hidden" name="action" value="add" />';
print '<input type="hidden" name="id" value="' . $id . '" />';
print '<input type="hidden" name="id" value="' . $conference->id . '" />';
print '<input type="hidden" name="type" value="' . $type . '" />';
print '<input type="hidden" name="fk_project" value="' . $project->id . '" />';
print '<input type="hidden" name="securekey" value="' . $securekeyreceived . '" />';
print '<br>';
@ -498,15 +527,15 @@ if ($conference->status!=2) {
print dol_get_fiche_head('');
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.newmember.action.value="create";
document.newmember.submit();
});
});
});
</script>';
jQuery(document).ready(function () {
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.newmember.action.value="create";
document.newmember.submit();
});
});
});
</script>';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">' . "\n";
@ -574,6 +603,8 @@ jQuery(document).ready(function () {
print "</form>\n";
print "<br>";
print '</div></div>';
} else {
print $langs->trans("ConferenceIsNotConfirmed");
}
llxFooterVierge();