diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index e8292ac8a1a..d7144f50b24 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -565,6 +565,13 @@ function societe_admin_prepare_head()
$head[$h][2] = 'attributes_contacts';
$h++;
+ if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) {
+ $head[$h][0] = DOL_URL_ROOT . '/societe/admin/public_interface.php';
+ $head[$h][1] = $langs->trans("PublicUrl");
+ $head[$h][2] = 'publicurl';
+ $h++;
+ }
+
complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove');
return $head;
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index f2a9d77b0f3..6aed1d92cf1 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -473,3 +473,5 @@ NewSocNameForClone=New company name
ConfirmCloneThirdparties=Are you sure that you want to clone %s company ?
SocialNetworksBusiness=Social networks for company
ErrorCommercialNotAllowedForThirdparty=The user %s has not the permission to see all thirdparties and is not an allowed sale representative of the company.
+EnablePublicCompanyPages=Enable the public contact page
+PublicInterfaceCompanyDesc=This page is a public page to offer contact form to allow visitors to send you a message (creating a thirdparty and contact automatically).
diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php
index 0262efb2781..cf173a80cbd 100644
--- a/htdocs/public/company/new.php
+++ b/htdocs/public/company/new.php
@@ -207,6 +207,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$societe->code_client = '-1';
$societe->name_alias = GETPOST('name_alias', 'alphanohtml');
$societe->note_private = GETPOST('note_private', 'alphanohtml');
+ $societe->ip = getUserRemoteIP();
// Fill array 'array_options' with data from add form
/*
diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php
index 60853b43687..3696065ed00 100644
--- a/htdocs/recruitment/admin/public_interface.php
+++ b/htdocs/recruitment/admin/public_interface.php
@@ -27,16 +27,17 @@
// Load Dolibarr environment
require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
-
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
+ *
+ * @var string $dolibarr_main_url_root
*/
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "recruitment"));
diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php
index c3bb1d819af..2c791fbde92 100644
--- a/htdocs/recruitment/lib/recruitment.lib.php
+++ b/htdocs/recruitment/lib/recruitment.lib.php
@@ -51,11 +51,6 @@ function recruitmentAdminPrepareHead()
$head[$h][2] = 'settings_candidatures';
$h++;
- $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/public_interface.php';
- $head[$h][1] = $langs->trans("PublicUrl");
- $head[$h][2] = 'publicurl';
- $h++;
-
$head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/jobposition_extrafields.php';
$head[$h][1] = $langs->trans("ExtrafieldsJobPosition");
$nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count'];
@@ -74,6 +69,11 @@ function recruitmentAdminPrepareHead()
$head[$h][2] = 'candidature_extrafields';
$h++;
+ $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/public_interface.php';
+ $head[$h][1] = $langs->trans("PublicUrl");
+ $head[$h][2] = 'publicurl';
+ $h++;
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(
diff --git a/htdocs/societe/admin/public_interface.php b/htdocs/societe/admin/public_interface.php
new file mode 100644
index 00000000000..66b90608314
--- /dev/null
+++ b/htdocs/societe/admin/public_interface.php
@@ -0,0 +1,162 @@
+
+ * Copyright (C) 2006-2020 Laurent Destailleur
+ * Copyright (C) 2006-2012 Regis Houssin
+ * Copyright (C) 2011 Juanjo Menent
+ * Copyright (C) 2024 Frédéric France
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/societe/admin/public_interface.php
+ * \ingroup societe
+ * \brief File of main public page to record a new thidparty
+ */
+
+// Load Dolibarr environment
+require '../../main.inc.php';
+/**
+ * @var Conf $conf
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ *
+ * @var string $dolibarr_main_url_root
+ */
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("admin", "accountancy", "companies", "other"));
+
+$action = GETPOST('action', 'aZ09');
+
+if (!$user->admin) {
+ accessforbidden();
+}
+
+$error = 0;
+
+
+/*
+ * Actions
+ */
+
+if ($action == 'setSOCIETE_ENABLE_PUBLIC') {
+ if (GETPOST('value')) {
+ dolibarr_set_const($db, 'SOCIETE_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
+ } else {
+ dolibarr_set_const($db, 'SOCIETE_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
+ }
+}
+
+if ($action == 'update') {
+ $public = GETPOST('SOCIETE_ENABLE_PUBLIC');
+
+ $res = dolibarr_set_const($db, "SOCIETE_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
+
+ if (!($res > 0)) {
+ $error++;
+ }
+
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+//$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+$help_url = '';
+llxHeader('', $langs->trans("CompanySetup"), $help_url);
+
+$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").'';
+
+print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup');
+
+$head = societe_admin_prepare_head();
+
+
+
+print '';
+
+
+if (getDolGlobalString('SOCIETE_ENABLE_PUBLIC')) {
+ print '
';
+ //print $langs->trans('FollowingLinksArePublic').'
';
+ print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
';
+ if (isModEnabled('multicompany')) {
+ $entity_qr = '?entity='.$conf->entity;
+ } else {
+ $entity_qr = '';
+ }
+
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
+ print '';
+ print ajax_autoselect('publicurlmember');
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index e04c68f2ec4..aa7f7bba6ff 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -29,11 +29,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
-
/**
* @var Conf $conf
* @var DoliDB $db
@@ -42,6 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
* @var Translate $langs
* @var User $user
*/
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->loadLangs(array("admin", "accountancy", "companies", "other"));
@@ -60,6 +59,7 @@ $formcompany = new FormCompany($db);
/*
* Actions
*/
+
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';