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';
66$backtopage =
GETPOST(
'backtopage',
'alpha');
67$action =
GETPOST(
'action',
'aZ09');
74$langs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other",
"errors"));
77if (!isModEnabled(
'societe')) {
88$permissiontoadd = $user->hasRight(
'societe',
'creer');
91$hookmanager->initHooks(array(
'publicnewmembercard',
'globalcard'));
97$user->loadDefaultValues();
111function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
113 global $conf, $langs, $mysoc;
115 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
117 print
'<body id="mainbody" class="publicnewmemberform">';
120 $urllogo = DOL_URL_ROOT .
'/theme/common/login_logo.png';
122 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output .
'/logos/thumbs/' . $mysoc->logo_small)) {
123 $urllogo = DOL_URL_ROOT .
'/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode(
'logos/thumbs/' . $mysoc->logo_small);
124 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output .
'/logos/' . $mysoc->logo)) {
125 $urllogo = DOL_URL_ROOT .
'/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode(
'logos/' . $mysoc->logo);
126 } elseif (is_readable(DOL_DOCUMENT_ROOT .
'/theme/dolibarr_logo.svg')) {
127 $urllogo = DOL_URL_ROOT .
'/theme/dolibarr_logo.svg';
130 print
'<header class="center">';
134 print
'<div class="backgreypublicpayment">';
135 print
'<div class="logopublicpayment">';
136 print
'<img id="dolpaymentlogo" src="' . $urllogo .
'">';
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>';
145 print
'<div class="backimagepublicregistration">';
146 print
'<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'MEMBER_IMAGE_PUBLIC_REGISTRATION') .
'">';
152 print
'<div class="divmainbodylarge">';
162 global $conf, $langs;
170 if (!empty($conf->use_javascript_ajax)) {
171 print
"\n" .
'<!-- Includes JS Footer of Dolibarr -->' .
"\n";
172 print
'<script src="' . DOL_URL_ROOT .
'/core/js/lib_foot.js.php?lang=' . $langs->defaultlang . (!empty($ext) ?
'&' . $ext :
'') .
'"></script>' .
"\n";
185$parameters = array();
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
193if (empty($reshook) && $action ==
'add') {
200 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Company")),
null,
'errors');
206 $sessionkey =
'dol_antispam_value';
207 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) == strtolower(
GETPOST(
'code'))));
210 $errmsg .= $langs->trans(
"ErrorBadValueForCode") .
"<br>\n";
218 $societe->name =
GETPOST(
'name',
'alphanohtml');
222 $societe->address =
GETPOST(
'address',
'alphanohtml');
224 $societe->country_id =
GETPOSTINT(
'country_id');
226 $societe->phone =
GETPOST(
'phone',
'alpha');
228 $societe->fax =
GETPOST(
'fax',
'alpha');
230 $societe->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
232 $societe->client = 2 ;
234 $societe->code_client =
'-1';
236 $societe->name_alias =
GETPOST(
'name_alias',
'alphanohtml');
238 $societe->note_private =
GETPOST(
'note_private');
240 $result = $societe->create($user);
242 require_once DOL_DOCUMENT_ROOT .
'/core/class/CMailFile.class.php';
243 $objectsoc = $societe;
245 if (!empty($backtopage)) {
246 $urlback = $backtopage;
251 $urlback = $_SERVER[
"PHP_SELF"] .
"?action=added&token=" .
newToken();
255 $errmsg .= implode(
'<br>', $societe->errors);
263 header(
"Location: " . $urlback);
275if (empty($reshook) && $action ==
'added') {
280 print
'<div class="center">';
281 print $langs->trans(
"newSocieteAdded");
294$form =
new Form($db);
298$extrafields->fetch_name_optionals_label($objectsoc->table_element);
304print
load_fiche_titre(
img_picto(
'',
'member_nocolor',
'class="pictofixedwidth"') .
' ' . $langs->trans(
"ContactUs"),
'',
'', 0, 0,
'center');
307print
'<div align="center">';
308print
'<div id="divsubscribe">';
310print
'<div class="center subscriptionformhelptext opacitymedium justify">';
314 print $langs->trans(
"ContactUsDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")) .
"<br>\n";
322print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="newprospect">' .
"\n";
323print
'<input type="hidden" name="token" value="' .
newToken() .
'" / >';
324print
'<input type="hidden" name="entity" value="' . $entity .
'" />';
325print
'<input type="hidden" name="action" value="add" />';
328$messagemandatory =
'<span class="">' . $langs->trans(
"FieldsWithAreMandatory",
'*') .
'</span>';
334print
'<script type="text/javascript">
335jQuery(document).ready(function () {
336 jQuery(document).ready(function () {
337 function initmorphy()
339 console.log("Call initmorphy");
340 if (jQuery("#morphy").val() == \'phy\') {
341 jQuery("#trcompany").hide();
343 if (jQuery("#morphy").val() == \'mor\') {
344 jQuery("#trcompany").show();
348 jQuery("#morphy").change(function() {
351 jQuery("#selectcountry_id").change(function() {
352 document.newprospect.action.value="create";
353 document.newprospect.submit();
355 jQuery("#typeid").change(function() {
356 document.newprospect.action.value="create";
357 document.newprospect.submit();
364print
'<table class="border" summary="form to subscribe" id="tablesubscribe">' .
"\n";
373print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
374print
'<input type="hidden" name="ThirdPartyName" value="' . $langs->trans(
'ThirdPartyName') .
'">';
375print
'<span id="TypeName" class="fieldrequired" title="' .dol_escape_htmltag($langs->trans(
"FieldsWithAreMandatory",
'*')) .
'" >' . $form->editfieldkey(
'Company',
'name',
'', $objectsoc, 0) .
'<span class="star"> *</span></span>';
377print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="' .
dol_escape_htmltag($objectsoc->name) .
'" autofocus="autofocus">';
381print
'<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";
383print
'<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";
386print
'<tr><td class="tdtop">';
387print $form->editfieldkey(
'Address',
'address',
'', $objectsoc, 0);
390print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="' . ROWS_2 .
'" wrap="soft">';
393print $form->widgetForTranslation(
"address", $objectsoc, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
397print
'<tr><td>' . $form->editfieldkey(
'Country',
'selectcountry_id',
'', $objectsoc, 0) .
'</td><td class="maxwidthonsmartphone">';
398print
img_picto(
'',
'country',
'class="pictofixedwidth"');
399print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') : $objectsoc->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
401 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
406print
'<tr><td>' . $form->editfieldkey(
'Phone',
'phone',
'', $objectsoc, 0) .
'</td>';
407print
'<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>';
411print
'<td>' . $form->editfieldkey(
'Fax',
'fax',
'', $objectsoc, 0) .
'</td>';
412print
'<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>';
416print
'<tr><td>' . $form->editfieldkey(
'EMail',
'email',
'', $objectsoc, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' : $conf->global->SOCIETE_EMAIL_MANDATORY) .
'</td>';
417print
'<td>' .
img_picto(
'',
'object_email',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="' . $objectsoc->email .
'"></td>';
418if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
419 if ($conf->browser->layout ==
'phone') {
422 print
'<td class="individualline noemail">' . $form->editfieldkey($langs->trans(
'No_Email') .
' (' . $langs->trans(
'Contact') .
')',
'contact_no_email',
'', $objectsoc, 0) .
'</td>';
423 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>';
427print
'<tr><td>' . $form->editfieldkey(
'Web',
'url',
'', $objectsoc, 0) .
'</td>';
428print
'<td>' .
img_picto(
'',
'globe',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="' . $objectsoc->url .
'"></td></tr>';
433print
'<td class="tdtop">' . $langs->trans(
"Comments") .
'</td>';
434print
'<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>';
442 require_once DOL_DOCUMENT_ROOT .
'/core/lib/security2.lib.php';
443 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans(
"SecurityCode") .
'</span></label></td><td>';
444 print
'<span class="span-icon-security inline-block">';
445 print
'<input id="securitycode" placeholder="' . $langs->trans(
"SecurityCode") .
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
447 print
'<span class="nowrap inline-block">';
448 print
'<img class="inline-block valignmiddle" src="' . DOL_URL_ROOT .
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
449 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>';
459print
'<div class="center">';
460print
'<input type="submit" value="' . $langs->trans(
"Send") .
'" id="submitsave" class="button">';
461if (!empty($backtopage)) {
462 print
' <input type="submit" value="' . $langs->trans(
"Cancel") .
'" id="submitcancel" class="button button-cancel">';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge()
Header function.
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
llxFooterVierge()
Show footer for new societe.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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-...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return 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.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.