Merge pull request #17251 from DorianVabre/dev_EventOrganizer
Dev event organizer: public registration page to a conference
This commit is contained in:
commit
3f159fa39f
@ -494,11 +494,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
||||||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||||
global $dolibarr_main_url_root;
|
global $dolibarr_main_url_root;
|
||||||
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id=';
|
|
||||||
$key = 'DV3PH';
|
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||||
$link_subscription .= dol_encode($id, $key);
|
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
|
||||||
$link_subscription .= '&securekey='.urlencode($conf->global->EVENTORGANIZATION_SECUREKEY);
|
|
||||||
$object->fields['pubregister'] = array('type'=>'url', 'label'=>'Lien public d\'enregistrement à une conférence', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
|
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
|
||||||
|
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
||||||
|
|
||||||
|
$object->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
|
||||||
$object->pubregister = $link_subscription;
|
$object->pubregister = $link_subscription;
|
||||||
$keyforbreak='pubregister';
|
$keyforbreak='pubregister';
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
ModuleEventOrganizationName = Event Organization
|
ModuleEventOrganizationName = Event Organization
|
||||||
EventOrganizationDescription = Event Organization through Module Project
|
EventOrganizationDescription = Event Organization through Module Project
|
||||||
EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page
|
EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page
|
||||||
|
|
||||||
#
|
#
|
||||||
# Menu
|
# Menu
|
||||||
#
|
#
|
||||||
@ -82,6 +81,7 @@ PriceOfBoothHelp=Subscription price to stand a booth
|
|||||||
EventOrganizationICSLink=Link ICS for events
|
EventOrganizationICSLink=Link ICS for events
|
||||||
ConferenceOrBoothInformation=Conference Or Booth informations
|
ConferenceOrBoothInformation=Conference Or Booth informations
|
||||||
Attendees = Attendees
|
Attendees = Attendees
|
||||||
|
EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference
|
||||||
#
|
#
|
||||||
# Status
|
# Status
|
||||||
#
|
#
|
||||||
@ -94,6 +94,7 @@ EvntOrgCancelled = Cancelled
|
|||||||
#
|
#
|
||||||
# Public page
|
# Public page
|
||||||
#
|
#
|
||||||
|
PublicAttendeeSubscriptionPage = Public link of registration to a conference
|
||||||
MissingOrBadSecureKey = The security key is invalid or missing
|
MissingOrBadSecureKey = The security key is invalid or missing
|
||||||
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference
|
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference
|
||||||
EvntOrgStartDuration = This conference starts on
|
EvntOrgStartDuration = This conference starts on
|
||||||
|
|||||||
@ -75,12 +75,22 @@ $error = 0;
|
|||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
$key = 'DV3PH';
|
$email = GETPOST("email");
|
||||||
$id = dol_decode(GETPOST('id'), $key);
|
|
||||||
|
|
||||||
// Securekey check
|
// Getting id from Post and decoding it
|
||||||
$securekey = GETPOST('securekey', 'alpha');
|
$encodedid = GETPOST('id');
|
||||||
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY) {
|
$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id);
|
||||||
|
|
||||||
|
// Getting 'securekey'.'id' from Post and decoding it
|
||||||
|
$encodedsecurekeyandid = GETPOST('securekey', 'alpha');
|
||||||
|
$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id);
|
||||||
|
|
||||||
|
// Securekey decomposition into pure securekey and id added at the end
|
||||||
|
$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($encodedid));
|
||||||
|
$idgotfromsecurekey = dol_decode(substr($securekeyandid, -strlen($encodedid), strlen($encodedid)), $dolibarr_main_instance_unique_id);
|
||||||
|
|
||||||
|
// We check if the securekey collected is OK and if the id collected is the same than the id in the securekey
|
||||||
|
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecurekey != $id) {
|
||||||
print $langs->trans('MissingOrBadSecureKey');
|
print $langs->trans('MissingOrBadSecureKey');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -175,32 +185,32 @@ if ($reshook < 0) {
|
|||||||
if (empty($reshook) && $action == 'add') {
|
if (empty($reshook) && $action == 'add') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$urlback = '';
|
$urlback = '';
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
|
||||||
if (!GETPOST("email")) {
|
if (!GETPOST("email")) {
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
|
||||||
}
|
}
|
||||||
if (!GETPOST("societe")) {
|
/*if (!GETPOST("societe")) {
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
|
||||||
}
|
}*/
|
||||||
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
||||||
}
|
}
|
||||||
|
if (!GETPOST("country_id")) {
|
||||||
|
$error++;
|
||||||
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Vérifier si client existe
|
// Vérifier si client existe par l'email
|
||||||
$thirdparty = new Societe($db);
|
$thirdparty = new Societe($db);
|
||||||
$nomsociete = GETPOST("societe");
|
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
|
||||||
$resultfetchthirdparty = $thirdparty->fetch('', $nomsociete);
|
|
||||||
|
|
||||||
if ($resultfetchthirdparty<0) {
|
if ($resultfetchthirdparty<0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -208,7 +218,12 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$readythirdparty = -1;
|
$readythirdparty = -1;
|
||||||
} elseif ($resultfetchthirdparty==0) {
|
} elseif ($resultfetchthirdparty==0) {
|
||||||
// creation of a new thirdparty
|
// creation of a new thirdparty
|
||||||
$thirdparty->name = $nomsociete;
|
if (!empty(GETPOST("societe"))) {
|
||||||
|
$thirdparty->name = GETPOST("societe");
|
||||||
|
} else {
|
||||||
|
$thirdparty->name = $email;
|
||||||
|
}
|
||||||
|
|
||||||
$thirdparty->address = GETPOST("address");
|
$thirdparty->address = GETPOST("address");
|
||||||
$thirdparty->zip = GETPOST("zipcode");
|
$thirdparty->zip = GETPOST("zipcode");
|
||||||
$thirdparty->town = GETPOST("town");
|
$thirdparty->town = GETPOST("town");
|
||||||
@ -216,6 +231,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$thirdparty->fournisseur = 0;
|
$thirdparty->fournisseur = 0;
|
||||||
$thirdparty->country_id = GETPOST("country_id", 'int');
|
$thirdparty->country_id = GETPOST("country_id", 'int');
|
||||||
$thirdparty->state_id = GETPOST("state_id", 'int');
|
$thirdparty->state_id = GETPOST("state_id", 'int');
|
||||||
|
$thirdparty->email = $email;
|
||||||
|
|
||||||
// Load object modCodeTiers
|
// Load object modCodeTiers
|
||||||
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
|
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
|
||||||
@ -308,8 +324,8 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'.
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
||||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
print '<input type="hidden" name="action" value="add" />';
|
print '<input type="hidden" name="action" value="add" />';
|
||||||
print '<input type="hidden" name="id" value="'.dol_encode($id, $key).'" />';
|
print '<input type="hidden" name="id" value="'.$encodedid.'" />';
|
||||||
print '<input type="hidden" name="securekey" value="'.$securekey.'" />';
|
print '<input type="hidden" name="securekey" value="'.$encodedsecurekeyandid.'" />';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -331,8 +347,10 @@ jQuery(document).ready(function () {
|
|||||||
|
|
||||||
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
|
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
|
||||||
|
|
||||||
|
// Email
|
||||||
|
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||||
// Company
|
// Company
|
||||||
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
|
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
|
||||||
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
|
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
|
||||||
@ -343,7 +361,7 @@ print ' / ';
|
|||||||
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
|
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// Country
|
// Country
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
print '<tr><td>'.$langs->trans('Country').'<FONT COLOR="red">*</FONT></td><td>';
|
||||||
$country_id = GETPOST('country_id');
|
$country_id = GETPOST('country_id');
|
||||||
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
|
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
|
||||||
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
|
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
|
||||||
@ -372,8 +390,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
// Email
|
|
||||||
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user