';
- } elseif (!empty($object->socialnetworks[$key])) {
- print '';
- }
- }
-
- print '';
-}
-
llxFooter();
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index e55f123a540..c9d62c410b3 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -32,6 +32,7 @@
* \brief File of contacts class
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonsocialnetworks.class.php';
/**
@@ -39,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class Contact extends CommonObject
{
+ use CommonSocialNetworks;
+
/**
* @var string ID to identify managed object
*/
diff --git a/htdocs/core/class/commonsocialnetworks.class.php b/htdocs/core/class/commonsocialnetworks.class.php
new file mode 100644
index 00000000000..eeb6583ca65
--- /dev/null
+++ b/htdocs/core/class/commonsocialnetworks.class.php
@@ -0,0 +1,102 @@
+
+ *
+ * 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/core/class/commonincoterm.class.php
+ * \ingroup core
+ * \brief File of the superclass of object classes that support incoterm (customer and supplier)
+ */
+
+
+/**
+ * Superclass for social networks
+ */
+trait CommonSocialNetworks
+{
+ /**
+ * Show social network part if the module is enabled with hiding functionality
+ *
+ * @param array $socialnetworks Array of social networks
+ * @param int $colspan Colspan
+ * @return void
+ */
+ public function showSocialNetwork($socialnetworks, $colspan = 4)
+ {
+ global $object, $form, $langs;
+
+ $nbofnetworks = count($socialnetworks);
+ $nbactive = 0;
+ foreach ($socialnetworks as $key => $value) {
+ if (!empty($object->socialnetworks[$key])) {
+ $nbactive++;
+ }
+ }
+
+ if ($nbofnetworks > 1) {
+ print '
';
+
+ if ($nbofnetworks > 1) {
+ print '';
+ }
+ }
+}
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 38b6892dbae..911ba31bc25 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -500,4 +500,6 @@ CurrentOutstandingBillLate=Current outstanding bill late
BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS.
EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name
TwoRecordsOfCompanyName=more than one record exists for this company, please contact us to complete your partnership request
-CompanySection=Company section
\ No newline at end of file
+CompanySection=Company section
+ShowSocialNetworks=Show social networks
+HideSocialNetworks=Hide social networks
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 6ef8d929361..02d0b042aab 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1663,7 +1663,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Social networks
if (isModEnabled('socialnetworks')) {
- showSocialNetwork();
+ $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
}
// Prof ids
@@ -2381,7 +2381,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Social network
if (isModEnabled('socialnetworks')) {
- showSocialNetwork();
+ $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
}
// Prof ids
@@ -3299,54 +3299,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
-/**
- * Show social network part if the module is enabled with hiding functionality
- *
- * @return void
- */
-function showSocialNetwork()
-{
- global $socialnetworks, $object, $form, $object, $langs;
- echo '';
-
- print '
';
- foreach ($socialnetworks as $key => $value) {
- if ($value['active']) {
- print '