diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 9aa1ca7d2e0..faff3d40712 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -83,6 +83,19 @@ $email = GETPOST("email"); $encodedid = GETPOST('id'); $id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$conference = new ConferenceOrBooth($db); +$resultconf = $conference->fetch($id); +if ($resultconf < 0) { + setEventMessages(null, $object->errors, "errors"); +} + +$project = new Project($db); +$resultproject = $project->fetch($conference->fk_project); +if ($resultproject < 0){ + $error++; + $errmsg .= $project->error; +} + // Getting 'securekey'.'id' from Post and decoding it $encodedsecurekeyandid = GETPOST('securekey', 'alpha'); $securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id); @@ -97,12 +110,6 @@ if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecure exit; } -$conference = new ConferenceOrBooth($db); -$resultconf = $conference->fetch($id); -if ($resultconf < 0) { - setEventMessages(null, $object->errors, "errors"); -} - // Load translation files $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); @@ -201,10 +208,11 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; } - /*if (!GETPOST("societe")) { + // If the price has been set, name is required for the invoice + if (!GETPOST("societe") && !empty(floatval($project->price_registration))) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; - }*/ + } if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { $error++; $langs->load("errors"); @@ -284,42 +292,7 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { - $db->commit(); - $project = new Project($db); - $resultproject = $project->fetch($conference->fk_project); - if ($resultproject < 0){ - $error++; - $errmsg .= $project->error; - } else { - global $dolibarr_main_url_root; - if (!empty(floatval($project->price_registration))){ - $facture = new Facture($db); - $facture->type = 0; - $facture->socid = $thirdparty->id; - $facture->paye = 0; - //@todo price and taxes to add - $tva = get_default_tva($mysoc, $thirdparty); - $facture->date = dol_now(); - - $resultfacture = $facture->create($user); - if ($resultfacture < 0){ - $error++; - $errmsg .= $facture->error; - } else { - // @todo corriger la réf qui est surement celle de la facture au lieu du client - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription&ref='.$thirdparty->ref; - Header("Location: ".$redirection); - exit; - } - } else { - // No price has been set - // Validating the subscription - $confattendee->setStatut(1); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php'; - Header("Location: ".$redirection); - exit; - } - } + $db->commit(); //Header("Location: ".$urlback); //exit; } else { @@ -393,7 +366,11 @@ print ''." // Email print ''."\n"; // Company -print ''."\n"; +print ''."\n"; // Address print ''."\n";
'.$langs->trans("Email").' *
'.$langs->trans("Company").'
'.$langs->trans("Company"); +if(!empty(floatval($project->price_registration))){ + print '*'; +} +print '
'.$langs->trans("Address").''."\n"; print '