suggestconference.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <?php
  2. /* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/public/project/suggestconference.php
  19. * \ingroup member
  20. * \brief Example of form to suggest a conference
  21. *
  22. * Note that you can add following constant to change behaviour of page
  23. * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
  24. * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
  25. * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
  26. * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
  27. * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
  28. * MEMBER_NEWFORM_FORCETYPE Force type of member
  29. * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy)
  30. * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country
  31. */
  32. if (!defined('NOLOGIN')) {
  33. define("NOLOGIN", 1); // This means this output page does not require to be logged.
  34. }
  35. if (!defined('NOCSRFCHECK')) {
  36. define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
  37. }
  38. if (!defined('NOIPCHECK')) {
  39. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  40. }
  41. if (!defined('NOBROWSERNOTIF')) {
  42. define('NOBROWSERNOTIF', '1');
  43. }
  44. if (!defined('NOIPCHECK')) {
  45. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  46. }
  47. // For MultiCompany module.
  48. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
  49. // TODO This should be useless. Because entity must be retrieve from object ref and not from url.
  50. $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
  51. if (is_numeric($entity)) {
  52. define("DOLENTITY", $entity);
  53. }
  54. require '../../main.inc.php';
  55. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  56. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  57. require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
  58. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  59. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  60. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  61. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  62. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
  63. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  64. global $dolibarr_main_instance_unique_id;
  65. global $dolibarr_main_url_root;
  66. // Init vars
  67. $errmsg = '';
  68. $num = 0;
  69. $error = 0;
  70. $backtopage = GETPOST('backtopage', 'alpha');
  71. $action = GETPOST('action', 'aZ09');
  72. $eventtype = GETPOST("eventtype");
  73. $email = GETPOST("email");
  74. $societe = GETPOST("societe");
  75. $label = GETPOST("label");
  76. $note = GETPOST("note");
  77. $datestart = GETPOST("datestart");
  78. $dateend = GETPOST("dateend");
  79. $id = GETPOST('id');
  80. $project = new Project($db);
  81. $resultproject = $project->fetch($id);
  82. if ($resultproject < 0) {
  83. $error++;
  84. $errmsg .= $project->error;
  85. }
  86. // Security check
  87. $securekeyreceived = GETPOST("securekey");
  88. $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5');
  89. if ($securekeytocompare != $securekeyreceived) {
  90. print $langs->trans('MissingOrBadSecureKey');
  91. exit;
  92. }
  93. // Load translation files
  94. $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
  95. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  96. $hookmanager->initHooks(array('publicnewmembercard', 'globalcard'));
  97. $extrafields = new ExtraFields($db);
  98. $user->loadDefaultValues();
  99. $cactioncomm = new CActionComm($db);
  100. $arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, "module='conference@eventorganization'");
  101. // Security check
  102. if (empty($conf->eventorganization->enabled)) {
  103. accessforbidden('', 0, 0, 1);
  104. }
  105. /**
  106. * Show header for new member
  107. *
  108. * @param string $title Title
  109. * @param string $head Head array
  110. * @param int $disablejs More content into html header
  111. * @param int $disablehead More content into html header
  112. * @param array $arrayofjs Array of complementary js files
  113. * @param array $arrayofcss Array of complementary css files
  114. * @return void
  115. */
  116. function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
  117. {
  118. global $user, $conf, $langs, $mysoc;
  119. top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
  120. print '<body id="mainbody" class="publicnewmemberform">';
  121. // Define urllogo
  122. $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
  123. if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
  124. $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
  125. } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
  126. $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
  127. } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
  128. $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
  129. }
  130. print '<div class="center">';
  131. // Output html code for logo
  132. if ($urllogo) {
  133. print '<div class="backgreypublicpayment">';
  134. print '<div class="logopublicpayment">';
  135. print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
  136. print '>';
  137. print '</div>';
  138. if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
  139. print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
  140. }
  141. print '</div>';
  142. }
  143. if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE)) {
  144. print '<div class="backimagepublicsuggestconference">';
  145. print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE.'">';
  146. print '</div>';
  147. }
  148. print '</div>';
  149. print '<div class="divmainbodylarge">';
  150. }
  151. /**
  152. * Show footer for new member
  153. *
  154. * @return void
  155. */
  156. function llxFooterVierge()
  157. {
  158. print '</div>';
  159. printCommonFooter('public');
  160. print "</body>\n";
  161. print "</html>\n";
  162. }
  163. /*
  164. * Actions
  165. */
  166. $parameters = array();
  167. // Note that $action and $object may have been modified by some hooks
  168. $reshook = $hookmanager->executeHooks('doActions', $parameters, $project, $action);
  169. if ($reshook < 0) {
  170. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  171. }
  172. // Action called when page is submitted
  173. if (empty($reshook) && $action == 'add') {
  174. $error = 0;
  175. $urlback = '';
  176. $db->begin();
  177. if (!GETPOST("lastname")) {
  178. $error++;
  179. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
  180. }
  181. if (!GETPOST("firstname")) {
  182. $error++;
  183. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
  184. }
  185. if (!GETPOST("email")) {
  186. $error++;
  187. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
  188. }
  189. if (!GETPOST("societe")) {
  190. $error++;
  191. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
  192. }
  193. if (!GETPOST("label")) {
  194. $error++;
  195. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
  196. }
  197. if (!GETPOST("note")) {
  198. $error++;
  199. $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
  200. }
  201. if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
  202. $error++;
  203. $langs->load("errors");
  204. $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
  205. }
  206. if (!$error) {
  207. // Getting the thirdparty or creating it
  208. $thirdparty = new Societe($db);
  209. $resultfetchthirdparty = $thirdparty->fetch('', $societe);
  210. if ($resultfetchthirdparty<=0) {
  211. // Need to create a new one (not found or multiple with the same name)
  212. $thirdparty->name = $societe;
  213. $thirdparty->address = GETPOST("address");
  214. $thirdparty->zip = GETPOST("zipcode");
  215. $thirdparty->town = GETPOST("town");
  216. $thirdparty->client = 2;
  217. $thirdparty->fournisseur = 0;
  218. $thirdparty->country_id = GETPOST("country_id", 'int');
  219. $thirdparty->state_id = GETPOST("state_id", 'int');
  220. $thirdparty->email = $email;
  221. // Load object modCodeTiers
  222. $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
  223. if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
  224. $module = substr($module, 0, dol_strlen($module) - 4);
  225. }
  226. $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
  227. foreach ($dirsociete as $dirroot) {
  228. $res = dol_include_once($dirroot.$module.'.php');
  229. if ($res) {
  230. break;
  231. }
  232. }
  233. $modCodeClient = new $module($db);
  234. if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
  235. $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
  236. }
  237. $thirdparty->code_client = $tmpcode;
  238. $readythirdparty = $thirdparty->create($user);
  239. if ($readythirdparty <0) {
  240. $error++;
  241. $errmsg .= $thirdparty->error;
  242. } else {
  243. $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
  244. $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
  245. }
  246. }
  247. // From there we have a thirdparty, now looking for the contact
  248. if (!$error) {
  249. $contact = new Contact($db);
  250. $resultcontact = $contact->fetch('', '', '', $email);
  251. if ($resultcontact<=0) {
  252. // Need to create a contact
  253. $contact->socid = $thirdparty->id;
  254. $contact->lastname = (string) GETPOST("lastname", 'alpha');
  255. $contact->firstname = (string) GETPOST("firstname", 'alpha');
  256. $contact->address = (string) GETPOST("address", 'alpha');
  257. $contact->zip = (string) GETPOST("zipcode", 'alpha');
  258. $contact->town = (string) GETPOST("town", 'alpha');
  259. $contact->country_id = (int) GETPOST("country_id", 'int');
  260. $contact->state_id = (int) GETPOST("state_id", 'int');
  261. $contact->email = $email;
  262. $contact->statut = 1; //Default status to Actif
  263. $resultcreatecontact = $contact->create($user);
  264. if ($resultcreatecontact<0) {
  265. $error++;
  266. $errmsg .= $contact->error;
  267. }
  268. }
  269. }
  270. if (!$error) {
  271. // Adding supplier tag and tag from setup to thirdparty
  272. $category = new Categorie($db);
  273. $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF);
  274. if ($resultcategory<=0) {
  275. $error++;
  276. $errmsg .= $category->error;
  277. } else {
  278. $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false);
  279. if ($resultsetcategory < 0) {
  280. $error++;
  281. $errmsg .= $thirdparty->error;
  282. } else {
  283. $thirdparty->fournisseur = 1;
  284. // Load object modCodeFournisseur
  285. $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
  286. if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
  287. $module = substr($module, 0, dol_strlen($module) - 4);
  288. }
  289. $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
  290. foreach ($dirsociete as $dirroot) {
  291. $res = dol_include_once($dirroot.$module.'.php');
  292. if ($res) {
  293. break;
  294. }
  295. }
  296. $modCodeFournisseur = new $module;
  297. if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
  298. $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
  299. }
  300. $thirdparty->code_fournisseur = $tmpcode;
  301. $res = $thirdparty->update(0, $user, 1, 1, 1);
  302. if ($res <= 0) {
  303. $error++;
  304. }
  305. }
  306. }
  307. }
  308. if (!$error) {
  309. // We have the contact and the thirdparty
  310. $conforbooth = new ConferenceOrBooth($db);
  311. $conforbooth->label = $label;
  312. $conforbooth->fk_soc = $thirdparty->id;
  313. $conforbooth->fk_project = $project->id;
  314. $conforbooth->note = $note;
  315. $conforbooth->fk_action = $eventtype;
  316. $conforbooth->datep =$datestart;
  317. $conforbooth->datep2 = $dateend;
  318. $conforbooth->datec = dol_now();
  319. $conforbooth->tms = dol_now();
  320. $conforbooth->firstname = $contact->firstname;
  321. $conforbooth->lastname = $contact->lastname;
  322. $resultconforbooth = $conforbooth->create($user);
  323. if ($resultconforbooth<=0) {
  324. $error++;
  325. $errmsg .= $conforbooth->error;
  326. } else {
  327. // Adding the contact to the project
  328. $resultaddcontact = $conforbooth->add_contact($contact->id, 'SPEAKER');
  329. if ($resultaddcontact<0) {
  330. $error++;
  331. $errmsg .= $conforbooth->error;
  332. } else {
  333. $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
  334. $conforbooth->update($user);
  335. // Sending mail
  336. require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
  337. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
  338. $formmail = new FormMail($db);
  339. // Set output language
  340. $outputlangs = new Translate('', $conf);
  341. $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
  342. // Load traductions files required by page
  343. $outputlangs->loadLangs(array("main", "members"));
  344. // Get email content from template
  345. $arraydefaultmessage = null;
  346. $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF;
  347. if (!empty($labeltouse)) {
  348. $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
  349. }
  350. if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
  351. $subject = $arraydefaultmessage->topic;
  352. $msg = $arraydefaultmessage->content;
  353. }
  354. $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
  355. complete_substitutions_array($substitutionarray, $outputlangs, $object);
  356. $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
  357. $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
  358. $sendto = $thirdparty->email;
  359. $from = $conf->global->MAILING_EMAIL_FROM;
  360. $urlback = $_SERVER["REQUEST_URI"];
  361. $ishtml = dol_textishtml($texttosend); // May contain urls
  362. $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
  363. $result = $mailfile->sendfile();
  364. if ($result) {
  365. dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
  366. } else {
  367. dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
  368. }
  369. }
  370. }
  371. }
  372. }
  373. if (!$error) {
  374. $db->commit();
  375. $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
  376. $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl;
  377. Header("Location: ".$redirection);
  378. exit;
  379. } else {
  380. $db->rollback();
  381. }
  382. }
  383. /*
  384. * View
  385. */
  386. $form = new Form($db);
  387. $formcompany = new FormCompany($db);
  388. llxHeaderVierge($langs->trans("NewSuggestionOfConference"));
  389. print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center');
  390. print '<div align="center">';
  391. print '<div id="divsubscribe">';
  392. print '<div class="center subscriptionformhelptext justify">';
  393. // Welcome message
  394. $text = '<tr><td class="textpublicpayment"><strong>'.$langs->trans("EvntOrgRegistrationConfWelcomeMessage").'</strong></td></tr></br>';
  395. $text .= '<tr><td class="textpublicpayment">'.$langs->trans("EvntOrgRegistrationConfHelpMessage").' '.$project->label.'.<br><br></td></tr>'."\n";
  396. $text .= '<tr><td class="textpublicpayment">'.$project->note_public.'</td></tr>'."\n";;
  397. print $text;
  398. print '</div>';
  399. dol_htmloutput_errors($errmsg);
  400. // Print form
  401. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
  402. print '<input type="hidden" name="token" value="'.newToken().'" / >';
  403. print '<input type="hidden" name="entity" value="'.$entity.'" />';
  404. print '<input type="hidden" name="action" value="add" />';
  405. print '<input type="hidden" name="id" value="'.$id.'" />';
  406. print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
  407. print '<br>';
  408. print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
  409. //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
  410. print dol_get_fiche_head('');
  411. print '<script type="text/javascript">
  412. jQuery(document).ready(function () {
  413. jQuery(document).ready(function () {
  414. jQuery("#selectcountry_id").change(function() {
  415. document.newmember.action.value="create";
  416. document.newmember.submit();
  417. });
  418. });
  419. });
  420. </script>';
  421. print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
  422. // Last Name
  423. print '<tr><td><label for="lastname">'.$langs->trans("Lastname").'<FONT COLOR="red">*</FONT></label></td>';
  424. print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ?GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>';
  425. print '</tr>';
  426. // First Name
  427. print '<tr><td><label for="firstname">'.$langs->trans("Firstname").'<FONT COLOR="red">*</FONT></label></td>';
  428. print '<td colspan="3"><input name="firstname" id="firstname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'" autofocus="autofocus"></td>';
  429. print '</tr>';
  430. // Email
  431. 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";
  432. // Company
  433. print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'<FONT COLOR="red">*</FONT>';
  434. print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
  435. // Address
  436. print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
  437. 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";
  438. // Zip / Town
  439. print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
  440. print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
  441. print ' / ';
  442. print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
  443. print '</td></tr>';
  444. // Country
  445. print '<tr><td>'.$langs->trans('Country').'</td><td>';
  446. $country_id = GETPOST('country_id');
  447. if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
  448. $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
  449. }
  450. if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
  451. $country_code = dol_user_country();
  452. //print $country_code;
  453. if ($country_code) {
  454. $new_country_id = getCountry($country_code, 3, $db, $langs);
  455. //print 'xxx'.$country_code.' - '.$new_country_id;
  456. if ($new_country_id) {
  457. $country_id = $new_country_id;
  458. }
  459. }
  460. }
  461. $country_code = getCountry($country_id, 2, $db, $langs);
  462. print $form->select_country($country_id, 'country_id');
  463. print '</td></tr>';
  464. // State
  465. if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
  466. print '<tr><td>'.$langs->trans('State').'</td><td>';
  467. if ($country_code) {
  468. print $formcompany->select_state(GETPOST("state_id"), $country_code);
  469. } else {
  470. print '';
  471. }
  472. print '</td></tr>';
  473. }
  474. // Type of event
  475. print '<tr><td>'.$langs->trans("EventType").'<FONT COLOR="red">*</FONT></td>'."\n";
  476. print '<td>'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).'</td>';
  477. // Label
  478. print '<tr><td>'.$langs->trans("LabelOfconference").'<FONT COLOR="red">*</FONT></td>'."\n";
  479. print '</td><td><input type="text" name="label" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'."\n";
  480. // Note
  481. print '<tr><td>'.$langs->trans("Description").'<FONT COLOR="red">*</FONT></td>'."\n";
  482. print '<td><textarea name="note" id="note" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
  483. print "</table>\n";
  484. print dol_get_fiche_end();
  485. // Show all action buttons
  486. print '<div class="center">';
  487. print '<br>';
  488. print '<input type="submit" value="'.$langs->trans("SuggestConference").'" name="suggestconference" id="suggestconference" class="button">';
  489. print '<br><br>';
  490. print "</form>\n";
  491. print "<br>";
  492. print '</div></div>';
  493. llxFooterVierge();
  494. $db->close();