34if (!defined(
'NOLOGIN')) {
37if (!defined(
'NOCSRFCHECK')) {
38 define(
"NOCSRFCHECK", 1);
40if (!defined(
'NOBROWSERNOTIF')) {
41 define(
'NOBROWSERNOTIF',
'1');
48$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
49if (is_numeric($entity)) {
50 define(
"DOLENTITY", $entity);
55require
'../../main.inc.php';
56require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
57require_once DOL_DOCUMENT_ROOT .
'/core/lib/payments.lib.php';
58require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
59require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
60require_once DOL_DOCUMENT_ROOT .
'/core/class/extrafields.class.php';
61require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
62require_once DOL_DOCUMENT_ROOT .
'/core/class/cunits.class.php';
63require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
64require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formadmin.class.php';
65require_once DOL_DOCUMENT_ROOT .
'/core/lib/public.lib.php';
67$backtopage =
GETPOST(
'backtopage',
'alpha');
68$action =
GETPOST(
'action',
'aZ09');
75$langs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other",
"errors"));
78if (!isModEnabled(
'societe')) {
89$permissiontoadd = $user->hasRight(
'societe',
'creer');
92$hookmanager->initHooks(array(
'publicnewmembercard',
'globalcard'));
97$user->loadDefaultValues();
99$extrafields->fetch_name_optionals_label($objectsoc->table_element);
113function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
115 global
$conf, $langs, $mysoc;
117 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
119 print
'<body id="mainbody" class="publicnewmemberform">';
122 $urllogo = DOL_URL_ROOT .
'/theme/common/login_logo.png';
124 if (!empty($mysoc->logo_small) && is_readable(
$conf->mycompany->dir_output .
'/logos/thumbs/' . $mysoc->logo_small)) {
125 $urllogo = DOL_URL_ROOT .
'/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode(
'logos/thumbs/' . $mysoc->logo_small);
126 } elseif (!empty($mysoc->logo) && is_readable(
$conf->mycompany->dir_output .
'/logos/' . $mysoc->logo)) {
127 $urllogo = DOL_URL_ROOT .
'/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode(
'logos/' . $mysoc->logo);
128 } elseif (is_readable(DOL_DOCUMENT_ROOT .
'/theme/dolibarr_logo.svg')) {
129 $urllogo = DOL_URL_ROOT .
'/theme/dolibarr_logo.svg';
132 print
'<header class="center">';
136 print
'<div class="backgreypublicpayment">';
137 print
'<div class="logopublicpayment">';
138 print
'<img id="dolpaymentlogo" src="' . $urllogo .
'">';
141 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>';
147 print
'<div class="backimagepublicregistration">';
148 print
'<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'MEMBER_IMAGE_PUBLIC_REGISTRATION') .
'">';
154 print
'<div class="divmainbodylarge">';
164 global
$conf, $langs;
172 if (!empty(
$conf->use_javascript_ajax)) {
173 print
"\n" .
'<!-- Includes JS Footer of Dolibarr -->' .
"\n";
174 print
'<script src="' . DOL_URL_ROOT .
'/core/js/lib_foot.js.php?lang=' . $langs->defaultlang . (!empty($ext) ?
'&' . $ext :
'') .
'"></script>' .
"\n";
187$parameters = array();
189$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
195if (empty($reshook) && $action ==
'add') {
202 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Company")),
null,
'errors');
208 $sessionkey =
'dol_antispam_value';
209 $ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) == strtolower(
GETPOST(
'code'))));
212 $errmsg .= $langs->trans(
"ErrorBadValueForCode") .
"<br>\n";
220 $societe->name =
GETPOST(
'name',
'alphanohtml');
222 $societe->address =
GETPOST(
'address',
'alphanohtml');
223 $societe->country_id =
GETPOSTINT(
'country_id');
224 $societe->phone =
GETPOST(
'phone',
'alpha');
225 $societe->fax =
GETPOST(
'fax',
'alpha');
226 $societe->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
227 $societe->client = 2 ;
228 $societe->code_client =
'-1';
229 $societe->name_alias =
GETPOST(
'name_alias',
'alphanohtml');
230 $societe->note_private =
GETPOST(
'note_private',
'alphanohtml');
242 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
246 $errmsg .= implode(
'<br>', $societe->errors);
250 $result = $societe->create($user);
252 require_once DOL_DOCUMENT_ROOT .
'/core/class/CMailFile.class.php';
253 $objectsoc = $societe;
255 if (!empty($backtopage)) {
256 $urlback = $backtopage;
261 $urlback = $_SERVER[
"PHP_SELF"] .
"?action=added&token=" .
newToken();
265 $errmsg .= implode(
'<br>', $societe->errors);
273 header(
"Location: " . $urlback);
285if (empty($reshook) && $action ==
'added') {
290 print
'<div class="center">';
291 print $langs->trans(
"newSocieteAdded");
304$form =
new Form($db);
313print
load_fiche_titre(
img_picto(
'',
'member_nocolor',
'class="pictofixedwidth"') .
' ' . $langs->trans(
"ContactUs"),
'',
'', 0,
'',
'center');
316print
'<div align="center">';
317print
'<div id="divsubscribe">';
319print
'<div class="center subscriptionformhelptext opacitymedium justify">';
323 print $langs->trans(
"ContactUsDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")) .
"<br>\n";
331print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="newprospect">' .
"\n";
332print
'<input type="hidden" name="token" value="' .
newToken() .
'" / >';
333print
'<input type="hidden" name="entity" value="' . $entity .
'" />';
334print
'<input type="hidden" name="action" value="add" />';
337$messagemandatory =
'<span class="">' . $langs->trans(
"FieldsWithAreMandatory",
'*') .
'</span>';
343print
'<script type="text/javascript">
344jQuery(document).ready(function () {
345 jQuery(document).ready(function () {
346 function initmorphy()
348 console.log("Call initmorphy");
349 if (jQuery("#morphy").val() == \'phy\') {
350 jQuery("#trcompany").hide();
352 if (jQuery("#morphy").val() == \'mor\') {
353 jQuery("#trcompany").show();
357 jQuery("#morphy").change(function() {
360 jQuery("#selectcountry_id").change(function() {
361 document.newprospect.action.value="create";
362 document.newprospect.submit();
364 jQuery("#typeid").change(function() {
365 document.newprospect.action.value="create";
366 document.newprospect.submit();
373print
'<table class="border" summary="form to subscribe" id="tablesubscribe">' .
"\n";
382print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
383print
'<input type="hidden" name="ThirdPartyName" value="' . $langs->trans(
'ThirdPartyName') .
'">';
384print
'<span id="TypeName" class="fieldrequired" title="' .dol_escape_htmltag($langs->trans(
"FieldsWithAreMandatory",
'*')) .
'" >' . $form->editfieldkey(
'Company',
'name',
'', $objectsoc, 0) .
'<span class="star"> *</span></span>';
386print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="' .
dol_escape_htmltag($objectsoc->name) .
'" autofocus="autofocus">';
390print
'<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";
392print
'<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";
395print
'<tr><td class="tdtop">';
396print $form->editfieldkey(
'Address',
'address',
'', $objectsoc, 0);
399print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="' . ROWS_2 .
'" wrap="soft">';
402print $form->widgetForTranslation(
"address", $objectsoc, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
406print
'<tr><td>' . $form->editfieldkey(
'Country',
'selectcountry_id',
'', $objectsoc, 0) .
'</td><td class="maxwidthonsmartphone">';
407print
img_picto(
'',
'country',
'class="pictofixedwidth"');
408print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') : $objectsoc->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
410 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
415print
'<tr><td>' . $form->editfieldkey(
'Phone',
'phone',
'', $objectsoc, 0) .
'</td>';
416print
'<td>' .
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"') .
' <input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="' . (GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') : $objectsoc->phone) .
'"></td>';
420print
'<td>' . $form->editfieldkey(
'Fax',
'fax',
'', $objectsoc, 0) .
'</td>';
421print
'<td>' .
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"') .
' <input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="' . (GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') : $objectsoc->fax) .
'"></td>';
425print
'<tr><td>' . $form->editfieldkey(
'EMail',
'email',
'', $objectsoc, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' :
$conf->global->SOCIETE_EMAIL_MANDATORY) .
'</td>';
426print
'<td>' .
img_picto(
'',
'object_email',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="' . $objectsoc->email .
'"></td>';
427if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
428 if (
$conf->browser->layout ==
'phone') {
431 print
'<td class="individualline noemail">' . $form->editfieldkey($langs->trans(
'No_Email') .
' (' . $langs->trans(
'Contact') .
')',
'contact_no_email',
'', $objectsoc, 0) .
'</td>';
432 print
'<td class="individualline" ' . ((
$conf->browser->layout ==
'phone') || !isModEnabled(
'mailing') ?
' colspan="3"' :
'') .
'>' . $form->selectyesno(
'contact_no_email', (GETPOSTISSET(
"contact_no_email") ?
GETPOST(
"contact_no_email",
'alpha') : (empty($objectsoc->no_email) ? 0 : 1)), 1, false, 1) .
'</td>';
436print
'<tr><td>' . $form->editfieldkey(
'Web',
'url',
'', $objectsoc, 0) .
'</td>';
437print
'<td>' .
img_picto(
'',
'globe',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="' . $objectsoc->url .
'"></td></tr>';
442print
'<td class="tdtop">' . $langs->trans(
"Comments") .
'</td>';
443print
'<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>';
448$parameters[
'tpl_context'] =
'public';
449include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
456 require_once DOL_DOCUMENT_ROOT .
'/core/lib/security2.lib.php';
457 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans(
"SecurityCode") .
'</span></label></td><td>';
458 print
'<span class="span-icon-security inline-block">';
459 print
'<input id="securitycode" placeholder="' . $langs->trans(
"SecurityCode") .
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
461 print
'<span class="nowrap inline-block">';
462 print
'<img class="inline-block valignmiddle" src="' . DOL_URL_ROOT .
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
463 print
'<a class="inline-block valignmiddle" href="' . $php_self .
'" tabindex="4" data-role="button">' .
img_picto($langs->trans(
"Refresh"),
'refresh',
'id="captcha_refresh_img"') .
'</a>';
473print
'<div class="center">';
474print
'<input type="submit" value="' . $langs->trans(
"Send") .
'" id="submitsave" class="button">';
475if (!empty($backtopage)) {
476 print
' <input type="submit" value="' . $langs->trans(
"Cancel") .
'" id="submitcancel" class="button button-cancel">';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for new prospect.
llxFooterVierge()
Show footer for new societe.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
Show picto whatever it's its name (generic function)
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)
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.