33if (!defined(
'NOLOGIN')) {
36if (!defined(
'NOCSRFCHECK')) {
37 define(
"NOCSRFCHECK", 1);
39if (!defined(
'NOBROWSERNOTIF')) {
40 define(
'NOBROWSERNOTIF',
'1');
47$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
49define(
"DOLENTITY", $entity);
54require
'../../main.inc.php';
55require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT .
'/core/lib/payments.lib.php';
57require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
58require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
59require_once DOL_DOCUMENT_ROOT .
'/core/class/extrafields.class.php';
60require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
61require_once DOL_DOCUMENT_ROOT .
'/core/class/cunits.class.php';
62require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
63require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formadmin.class.php';
64require_once DOL_DOCUMENT_ROOT .
'/core/lib/public.lib.php';
74$backtopage =
GETPOST(
'backtopage',
'alpha');
75$action =
GETPOST(
'action',
'aZ09');
82$langs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other",
"errors"));
90 httponly_accessforbidden(
"Online form for contact for public visitors has not been enabled (option SOCIETE_ENABLE_PUBLIC)");
96$permissiontoadd = $user->hasRight(
'societe',
'creer');
99$hookmanager->initHooks(array(
'publicnewmembercard',
'globalcard'));
104$user->loadDefaultValues();
106$extrafields->fetch_name_optionals_label(
$object->table_element);
123function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $ws =
'')
127 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
129 print
'<body id="mainbody" class="publicnewmemberform">';
131 include_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
134 print
'<div class="divmainbodylarge">';
146 global
$conf, $langs;
152 if (!empty(
$conf->use_javascript_ajax)) {
153 print
"\n" .
'<!-- Includes JS Footer of Dolibarr -->' .
"\n";
154 print
'<script src="' . DOL_URL_ROOT .
'/core/js/lib_foot.js.php?lang=' . $langs->defaultlang .
'"></script>' .
"\n";
167$parameters = array();
169$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
175if (empty($reshook) && $action ==
'add') {
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Company")),
null,
'errors');
188 $sessionkey =
'dol_antispam_value';
189 $ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) == strtolower(
GETPOST(
'code'))));
192 $errmsg .= $langs->trans(
"ErrorBadValueForCode") .
"<br>\n";
200 $societe->name =
GETPOST(
'name',
'alphanohtml');
202 $societe->address =
GETPOST(
'address',
'alphanohtml');
203 $societe->country_id =
GETPOSTINT(
'country_id');
204 $societe->phone =
GETPOST(
'phone',
'alpha');
205 $societe->fax =
GETPOST(
'fax',
'alpha');
206 $societe->email = trim(
GETPOST(
'email',
'email'));
207 $societe->client = 2 ;
208 $societe->code_client =
'-1';
209 $societe->name_alias =
GETPOST(
'name_alias',
'alphanohtml');
210 $societe->note_private =
GETPOST(
'note_private',
'alphanohtml');
223 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
227 $errmsg .= implode(
'<br>', $societe->errors);
231 $result = $societe->create($user);
233 require_once DOL_DOCUMENT_ROOT .
'/core/class/CMailFile.class.php';
236 if (!empty($backtopage)) {
237 $urlback = $backtopage;
242 $urlback = $_SERVER[
"PHP_SELF"] .
"?action=added&token=" . newToken();
246 $errmsg .= implode(
'<br>', $societe->errors);
254 header(
"Location: " . $urlback);
266if (empty($reshook) && $action ==
'added') {
271 print
'<div class="center">';
272 print $langs->trans(
"newSocieteAdded");
294print
load_fiche_titre(
img_picto(
'',
'member_nocolor',
'class="pictofixedwidth"') .
' ' . $langs->trans(
"ContactUs"),
'',
'', 0,
'',
'center');
297print
'<div align="center">';
298print
'<div id="divsubscribe">';
300print
'<div class="center subscriptionformhelptext opacitymedium">';
304 print $langs->trans(
"ContactUsDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")) .
"<br>\n";
312print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="newprospect">' .
"\n";
313print
'<input type="hidden" name="token" value="' . newToken() .
'" / >';
314print
'<input type="hidden" name="entity" value="' . $entity .
'" />';
315print
'<input type="hidden" name="action" value="add" />';
318$messagemandatory =
'<span class="">' . $langs->trans(
"FieldsWithAreMandatory",
'*') .
'</span>';
324print
'<script type="text/javascript">
325jQuery(document).ready(function () {
326 jQuery(document).ready(function () {
327 function initmorphy()
329 console.log("Call initmorphy");
330 if (jQuery("#morphy").val() == \'phy\') {
331 jQuery("#trcompany").hide();
333 if (jQuery("#morphy").val() == \'mor\') {
334 jQuery("#trcompany").show();
338 jQuery("#morphy").change(function() {
341 jQuery("#selectcountry_id").change(function() {
342 document.newprospect.action.value="create";
343 document.newprospect.submit();
345 jQuery("#typeid").change(function() {
346 document.newprospect.action.value="create";
347 document.newprospect.submit();
354print
'<table class="border" summary="form to subscribe" id="tablesubscribe">' .
"\n";
363print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
364print
'<input type="hidden" name="ThirdPartyName" value="' . $langs->trans(
'ThirdPartyName') .
'">';
365print
'<span id="TypeName" title="' .dol_escape_htmltag($langs->trans(
"FieldsWithAreMandatory",
'*')) .
'" >' . $form->editfieldkey(
'Company',
'name',
'', $object, 0) .
'<span class="star"> *</span></span>';
367print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="' .
dol_escape_htmltag(
$object->name) .
'" autofocus="autofocus">';
371print
'<tr><td class="classfortooltip" title="' .
dol_escape_htmltag($messagemandatory) .
'">' . $langs->trans(
"Firstname") .
' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="' .
dol_escape_htmltag(
GETPOST(
'firstname')) .
'"></td></tr>' .
"\n";
373print
'<tr><td class="classfortooltip" title="' .
dol_escape_htmltag($messagemandatory) .
'">' . $langs->trans(
"Lastname") .
' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="' .
dol_escape_htmltag(
GETPOST(
'lastname')) .
'"></td></tr>' .
"\n";
376print
'<tr><td class="tdtop">';
377print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
380print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="' . ROWS_2 .
'" wrap="soft">';
383print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
387print
'<tr><td>' . $form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0) .
'</td><td class="maxwidthonsmartphone">';
388print
img_picto(
'',
'country',
'class="pictofixedwidth"');
389print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
391 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
396print
'<tr><td>' . $form->editfieldkey(
'Phone',
'phone',
'', $object, 0) .
'</td>';
397print
'<td>' .
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"') .
' <input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="' . (GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') :
$object->phone) .
'"></td>';
401print
'<td>' . $form->editfieldkey(
'Fax',
'fax',
'', $object, 0) .
'</td>';
402print
'<td>' .
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"') .
' <input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="' . (GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax) .
'"></td>';
406print
'<tr><td>' . $form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' :
$conf->global->SOCIETE_EMAIL_MANDATORY) .
'</td>';
407print
'<td>' .
img_picto(
'',
'object_email',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="' .
$object->email .
'"></td>';
409 if (
$conf->browser->layout ==
'phone') {
412 print
'<td class="individualline noemail">' . $form->editfieldkey($langs->trans(
'No_Email') .
' (' . $langs->trans(
'Contact') .
')',
'contact_no_email',
'', $object, 0) .
'</td>';
413 print
'<td class="individualline" ' . ((
$conf->browser->layout ==
'phone') ?
' colspan="3"' :
'') .
'>' . $form->selectyesno(
'contact_no_email', (GETPOSTISSET(
"contact_no_email") ?
GETPOST(
"contact_no_email",
'alpha') : (empty(
$object->no_email) ? 0 : 1)), 1, false, 1) .
'</td>';
417print
'<tr><td>' . $form->editfieldkey(
'Web',
'url',
'', $object, 0) .
'</td>';
418print
'<td>' .
img_picto(
'',
'globe',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="' .
$object->url .
'"></td></tr>';
423print
'<td class="tdtop">' . $langs->trans(
"Comments") .
'</td>';
424print
'<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="' . ROWS_3 .
'">' .
dol_escape_htmltag(
GETPOST(
'note_private',
'restricthtml'), 0, 1) .
'</textarea></td>';
429$parameters[
'tpl_context'] =
'public';
430include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
437 require_once DOL_DOCUMENT_ROOT .
'/core/lib/security2.lib.php';
438 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans(
"SecurityCode") .
'</span></label></td><td>';
439 print
'<span class="span-icon-security inline-block">';
440 print
'<input id="securitycode" placeholder="' . $langs->trans(
"SecurityCode") .
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
442 print
'<span class="nowrap inline-block">';
443 print
'<img class="inline-block valignmiddle" src="' . DOL_URL_ROOT .
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
444 print
'<a class="inline-block valignmiddle" href="' . $_SERVER[
'PHP_SELF'] .
'" tabindex="4" data-role="button">' .
img_picto($langs->trans(
"Refresh"),
'refresh',
'id="captcha_refresh_img"') .
'</a>';
454print
'<div class="center">';
455print
'<input type="submit" value="' . $langs->trans(
"Send") .
'" id="submitsave" class="button">';
456if (!empty($backtopage)) {
457 print
' <input type="submit" value="' . $langs->trans(
"Cancel") .
'" id="submitcancel" class="button button-cancel">';
if(! $sortfield) if(! $sortorder) $object
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[], $ws='')
Show header for new prospect.
llxFooterVierge()
Show footer for new societe.
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
checkNbPostsForASpeceificIp($object, $nb_post_max)
Check if the object exceeded the number of posts for a specific ip in the same week.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.