diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index 61d8fdacbd6..e869d869ba5 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -493,9 +493,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//$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
- $link = 'http://localhost/dolibarr/htdocs/public/members/attendee_subscription.php';
- $object->fields['pubregister'] = array('type'=>'text', 'label'=>'Lien public d\'enregistrement à une conférence', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
- $object->pubregister = $link;
+ $link_subscription = 'http://localhost/dolibarr/htdocs/public/members/attendee_subscription.php';
+ $object->fields['pubregister'] = array('type'=>'url', 'label'=>'Lien public d\'enregistrement à une conférence', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
+ $object->pubregister = $link_subscription;
$keyforbreak='pubregister';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
//var_dump($object);
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index c0ff5e8e281..b1fc2b9b7e5 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -91,3 +91,7 @@ EvntOrgConfirmed = Confirmed
EvntOrgNotQualified = Not Qualified
EvntOrgDone = Done
EvntOrgCancelled = Cancelled
+#
+# Public page
+#
+EventOrgWelcomeMessage = This form allows you to register as a new participant to a conference.
diff --git a/htdocs/public/members/attendee_subscription.php b/htdocs/public/members/attendee_subscription.php
index 873742f99b9..d145c23d207 100644
--- a/htdocs/public/members/attendee_subscription.php
+++ b/htdocs/public/members/attendee_subscription.php
@@ -76,7 +76,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');
// Load translation files
-$langs->loadLangs(array("main", "members", "companies", "install", "other"));
+$langs->loadLangs(array("main", "members", "companies", "install", "other", "eventorganization"));
/* Security check
if (empty($conf->adherent->enabled)) {
@@ -180,45 +180,15 @@ if (empty($reshook) && $action == 'add') {
$db->begin();
- // test if login already exists
- if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
- if (!GETPOST('login')) {
- $error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."
\n";
- }
- $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
- $result = $db->query($sql);
- if ($result) {
- $num = $db->num_rows($result);
- }
- if ($num != 0) {
- $error++;
- $langs->load("errors");
- $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."
\n";
- }
- if (!GETPOSTISSET("pass1") || !GETPOSTISSET("pass2") || GETPOST("pass1", 'none') == '' || GETPOST("pass2", 'none') == '' || GETPOST("pass1", 'none') != GETPOST("pass2", 'none')) {
- $error++;
- $langs->load("errors");
- $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."
\n";
- }
- if (!GETPOST("email")) {
- $error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."
\n";
- }
- }
- if (GETPOST('type') <= 0) {
- $error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."
\n";
- }
- if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
- $error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."
\n";
+ if (!GETPOST("email")) {
+ $error++;
+ $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."
\n";
}
if (!GETPOST("lastname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n";
}
- if (GETPOST("firstname")) {
+ if (!GETPOST("firstname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n";
}
@@ -227,51 +197,29 @@ if (empty($reshook) && $action == 'add') {
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n";
}
- $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
- if (GETPOSTISSET("birthmonth") && empty($birthday)) {
- $error++;
- $langs->load("errors");
- $errmsg .= $langs->trans("ErrorBadDateFormat")."
\n";
- }
- if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
- if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
- $error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."
\n";
- }
- }
-
- if (GETPOSTISSET('public')) {
- $public = 1;
- } else {
- $public = 0;
- }
-
if (!$error) {
- // email a peu pres correct et le login n'existe pas
- $adh = new Adherent($db);
- $adh->statut = -1;
- $adh->public = $public;
- $adh->firstname = GETPOST("firstname");
- $adh->lastname = GETPOST("lastname");
- $adh->gender = GETPOST("gender");
- $adh->civility_id = GETPOST("civility_id");
- $adh->societe = GETPOST("societe");
- $adh->address = GETPOST("address");
- $adh->zip = GETPOST("zipcode");
- $adh->town = GETPOST("town");
- $adh->email = GETPOST("email");
- if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
- $adh->login = GETPOST("login");
- $adh->pass = GETPOST("pass1");
- }
- $adh->photo = GETPOST("photo");
- $adh->country_id = GETPOST("country_id", 'int');
- $adh->state_id = GETPOST("state_id", 'int');
- $adh->typeid = GETPOST("type", 'int');
- $adh->note_private = GETPOST("note_private");
- $adh->morphy = GETPOST("morphy");
- $adh->birth = $birthday;
-
+ // Client => fournisseur à 0
+ $thirdparty = new Client($db);
+ // Prospect forcé
+ $thirdparty->fk_prospectlevel = "Prospect";
+ $thirdparty->firstname = GETPOST("firstname");
+ $thirdparty->lastname = GETPOST("lastname");
+ $thirdparty->address = GETPOST("address");
+ $thirdparty->zip = GETPOST("zipcode");
+ $thirdparty->town = GETPOST("town");
+ $thirdparty->email = GETPOST("email");
+ $thirdparty->country_id = GETPOST("country_id", 'int');
+ $thirdparty->state_id = GETPOST("state_id", 'int');
+
+ // @todo commit to generate the id, remove it ?
+ $db->commit();
+
+ $db->begin();
+ // @todo creation of an attendee
+ $confattendee = new ConferenceOrBoothAttendee($db);
+ $confattendee->alreadypaid = 0.0;
+ $confattendee->fk_soc = $thirdparty->rowid;
+ $confattendee->date_subscription = dol_now();
// Fill array 'array_options' with data from add form
$extrafields->fetch_name_optionals_label($adh->table_element);
@@ -500,13 +448,10 @@ print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center')
print '
| '.$langs->trans("Type").' * | '; - print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); - print ' |
| '.$langs->trans('MemberNature').' * | '."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); - print ' |
| '.$langs->trans('UserTitle').' | '; -print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').' |
| '.$langs->trans("Lastname").' * | |
| '.$langs->trans("Firstname").' * | |
| '.$langs->trans("Gender").' | '; -print ''; -$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); -print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); -print ' |
| '.$langs->trans("Company").' | |
| '.$langs->trans("Company").' | |
| '.$langs->trans("Address").' | '."\n"; print ' |
| '.$langs->trans('State').' | '; @@ -633,30 +542,8 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { } print ' |
| '.$langs->trans("Email").' * | |
| '.$langs->trans("Login").' * | |
| '.$langs->trans("Password").' * | |
| '.$langs->trans("PasswordAgain").' * | |
| '.$langs->trans("DateOfBirth").' | '; -print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); -print ' |
| '.$langs->trans("URLPhoto").' | |
| '.$langs->trans("Public").' | |
| '.$langs->trans("Comments").' | '; -print ''; -print ' |