suggestconference.php 21 KB

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