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'));
96$user->loadDefaultValues();
98$extrafields->fetch_name_optionals_label($objectsoc->table_element);
112function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
114 global $conf, $langs, $mysoc;
116 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
118 print
'<body id="mainbody" class="publicnewmemberform">';
121 $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&modulepart=mycompany&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&modulepart=mycompany&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';
131 print
'<header class="center">';
135 print
'<div class="backgreypublicpayment">';
136 print
'<div class="logopublicpayment">';
137 print
'<img id="dolpaymentlogo" src="' . $urllogo .
'">';
140 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>';
146 print
'<div class="backimagepublicregistration">';
147 print
'<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'MEMBER_IMAGE_PUBLIC_REGISTRATION') .
'">';
153 print
'<div class="divmainbodylarge">';
163 global $conf, $langs;
171 if (!empty($conf->use_javascript_ajax)) {
172 print
"\n" .
'<!-- Includes JS Footer of Dolibarr -->' .
"\n";
173 print
'<script src="' . DOL_URL_ROOT .
'/core/js/lib_foot.js.php?lang=' . $langs->defaultlang . (!empty($ext) ?
'&' . $ext :
'') .
'"></script>' .
"\n";
186$parameters = array();
188$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
194if (empty($reshook) && $action ==
'add') {
201 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Company")),
null,
'errors');
207 $sessionkey =
'dol_antispam_value';
208 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) == strtolower(
GETPOST(
'code'))));
211 $errmsg .= $langs->trans(
"ErrorBadValueForCode") .
"<br>\n";
222 $societe->name =
GETPOST(
'name',
'alphanohtml');
224 $societe->address =
GETPOST(
'address',
'alphanohtml');
225 $societe->country_id =
GETPOSTINT(
'country_id');
226 $societe->phone =
GETPOST(
'phone',
'alpha');
227 $societe->fax =
GETPOST(
'fax',
'alpha');
228 $societe->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
229 $societe->client = 2 ;
230 $societe->code_client =
'-1';
231 $societe->name_alias =
GETPOST(
'name_alias',
'alphanohtml');
232 $societe->note_private =
GETPOST(
'note_private',
'alphanohtml');
245 $result = $societe->create($user);
247 require_once DOL_DOCUMENT_ROOT .
'/core/class/CMailFile.class.php';
248 $objectsoc = $societe;
250 if (!empty($backtopage)) {
251 $urlback = $backtopage;
256 $urlback = $_SERVER[
"PHP_SELF"] .
"?action=added&token=" .
newToken();
260 $errmsg .= implode(
'<br>', $societe->errors);
268 header(
"Location: " . $urlback);
280if (empty($reshook) && $action ==
'added') {
285 print
'<div class="center">';
286 print $langs->trans(
"newSocieteAdded");
299$form =
new Form($db);
308print
load_fiche_titre(
img_picto(
'',
'member_nocolor',
'class="pictofixedwidth"') .
' ' . $langs->trans(
"ContactUs"),
'',
'', 0, 0,
'center');
311print
'<div align="center">';
312print
'<div id="divsubscribe">';
314print
'<div class="center subscriptionformhelptext opacitymedium justify">';
318 print $langs->trans(
"ContactUsDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")) .
"<br>\n";
326print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" name="newprospect">' .
"\n";
327print
'<input type="hidden" name="token" value="' .
newToken() .
'" / >';
328print
'<input type="hidden" name="entity" value="' . $entity .
'" />';
329print
'<input type="hidden" name="action" value="add" />';
332$messagemandatory =
'<span class="">' . $langs->trans(
"FieldsWithAreMandatory",
'*') .
'</span>';
338print
'<script type="text/javascript">
339jQuery(document).ready(function () {
340 jQuery(document).ready(function () {
341 function initmorphy()
343 console.log("Call initmorphy");
344 if (jQuery("#morphy").val() == \'phy\') {
345 jQuery("#trcompany").hide();
347 if (jQuery("#morphy").val() == \'mor\') {
348 jQuery("#trcompany").show();
352 jQuery("#morphy").change(function() {
355 jQuery("#selectcountry_id").change(function() {
356 document.newprospect.action.value="create";
357 document.newprospect.submit();
359 jQuery("#typeid").change(function() {
360 document.newprospect.action.value="create";
361 document.newprospect.submit();
368print
'<table class="border" summary="form to subscribe" id="tablesubscribe">' .
"\n";
377print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
378print
'<input type="hidden" name="ThirdPartyName" value="' . $langs->trans(
'ThirdPartyName') .
'">';
379print
'<span id="TypeName" class="fieldrequired" title="' .dol_escape_htmltag($langs->trans(
"FieldsWithAreMandatory",
'*')) .
'" >' . $form->editfieldkey(
'Company',
'name',
'', $objectsoc, 0) .
'<span class="star"> *</span></span>';
381print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="' .
dol_escape_htmltag($objectsoc->name) .
'" autofocus="autofocus">';
385print
'<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";
387print
'<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";
390print
'<tr><td class="tdtop">';
391print $form->editfieldkey(
'Address',
'address',
'', $objectsoc, 0);
394print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="' . ROWS_2 .
'" wrap="soft">';
397print $form->widgetForTranslation(
"address", $objectsoc, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
401print
'<tr><td>' . $form->editfieldkey(
'Country',
'selectcountry_id',
'', $objectsoc, 0) .
'</td><td class="maxwidthonsmartphone">';
402print
img_picto(
'',
'country',
'class="pictofixedwidth"');
403print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') : $objectsoc->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
405 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
410print
'<tr><td>' . $form->editfieldkey(
'Phone',
'phone',
'', $objectsoc, 0) .
'</td>';
411print
'<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>';
415print
'<td>' . $form->editfieldkey(
'Fax',
'fax',
'', $objectsoc, 0) .
'</td>';
416print
'<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>';
420print
'<tr><td>' . $form->editfieldkey(
'EMail',
'email',
'', $objectsoc, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' : $conf->global->SOCIETE_EMAIL_MANDATORY) .
'</td>';
421print
'<td>' .
img_picto(
'',
'object_email',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="' . $objectsoc->email .
'"></td>';
422if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
423 if ($conf->browser->layout ==
'phone') {
426 print
'<td class="individualline noemail">' . $form->editfieldkey($langs->trans(
'No_Email') .
' (' . $langs->trans(
'Contact') .
')',
'contact_no_email',
'', $objectsoc, 0) .
'</td>';
427 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>';
431print
'<tr><td>' . $form->editfieldkey(
'Web',
'url',
'', $objectsoc, 0) .
'</td>';
432print
'<td>' .
img_picto(
'',
'globe',
'class="pictofixedwidth"') .
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="' . $objectsoc->url .
'"></td></tr>';
437print
'<td class="tdtop">' . $langs->trans(
"Comments") .
'</td>';
438print
'<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>';
443$parameters[
'tpl_context'] =
'public';
444include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
451 require_once DOL_DOCUMENT_ROOT .
'/core/lib/security2.lib.php';
452 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans(
"SecurityCode") .
'</span></label></td><td>';
453 print
'<span class="span-icon-security inline-block">';
454 print
'<input id="securitycode" placeholder="' . $langs->trans(
"SecurityCode") .
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
456 print
'<span class="nowrap inline-block">';
457 print
'<img class="inline-block valignmiddle" src="' . DOL_URL_ROOT .
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
458 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>';
468print
'<div class="center">';
469print
'<input type="submit" value="' . $langs->trans(
"Send") .
'" id="submitsave" class="button">';
470if (!empty($backtopage)) {
471 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.