From 931ce8be4a78871015e723839400b19b1e1d97bd Mon Sep 17 00:00:00 2001 From: marc Date: Mon, 16 Jan 2023 18:06:23 +0100 Subject: [PATCH 1/5] NEW #23436 Group social networks field Group social networks field on a thirdparty creation into one link --- htdocs/contact/card.php | 75 ++++++++++++++++++++++++---------------- htdocs/societe/card.php | 76 +++++++++++++++++++++++++---------------- 2 files changed, 91 insertions(+), 60 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 6cf7d3051f3..e0c263572cb 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -864,21 +864,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (isModEnabled('socialnetworks')) { - foreach ($socialnetworks as $key => $value) { - if ($value['active']) { - print ''; - print ''; - print ''; - if (!empty($value['icon'])) { - print ''; - } - print ''; - print ''; - print ''; - } elseif (!empty($object->socialnetworks[$key])) { - print ''; - } - } + showSocialNetwork(); } // Visibility @@ -1151,21 +1137,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if (isModEnabled('socialnetworks')) { - foreach ($socialnetworks as $key => $value) { - if ($value['active']) { - print ''; - print ''; - print ''; - if (!empty($value['icon'])) { - print ''; - } - print ''; - print ''; - print ''; - } elseif (!empty($object->socialnetworks[$key])) { - print ''; - } - } + showSocialNetwork(); } // Visibility @@ -1620,6 +1592,49 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } +function showSocialNetwork() { + global $socialnetworks, $object, $form, $object, $langs; + echo ''; + + print ' '; + foreach ($socialnetworks as $key => $value) { + if ($value['active']) { + print ''; + print ''; + print ''; + if (!empty($value['icon'])) { + print ''; + } + print ''; + print ''; + print ''; + } elseif (!empty($object->socialnetworks[$key])) { + print ''; + } + } + + print ''; +} + llxFooter(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8b5dcd251d2..2d6356394dd 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1663,21 +1663,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Social networks if (isModEnabled('socialnetworks')) { - foreach ($socialnetworks as $key => $value) { - if ($value['active']) { - print ''; - print ''; - print ''; - if (!empty($value['icon'])) { - print ''; - } - print ''; - print ''; - print ''; - } elseif (!empty($object->socialnetworks[$key])) { - print ''; - } - } + showSocialNetwork(); } // Prof ids @@ -2395,21 +2381,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Social network if (isModEnabled('socialnetworks')) { - foreach ($socialnetworks as $key => $value) { - if ($value['active']) { - print ''; - print ''; - print ''; - if (!empty($value['icon'])) { - print ''; - } - print ''; - print ''; - print ''; - } elseif (!empty($object->socialnetworks[$key])) { - print ''; - } - } + showSocialNetwork(); } // Prof ids @@ -3326,6 +3298,50 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } } + +function showSocialNetwork() { + global $socialnetworks, $object, $form, $object, $langs; + echo ''; + + print ' '; + foreach ($socialnetworks as $key => $value) { + if ($value['active']) { + print ''; + print ''; + print ''; + if (!empty($value['icon'])) { + print ''; + } + print ''; + print ''; + print ''; + } elseif (!empty($object->socialnetworks[$key])) { + print ''; + } + } + + print ''; +} + // End of page llxFooter(); $db->close(); From b2df3e47f84c87388590fb77dfb401a8916b9670 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 16 Jan 2023 17:09:34 +0000 Subject: [PATCH 2/5] Fixing style errors. --- htdocs/contact/card.php | 3 ++- htdocs/societe/card.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e0c263572cb..8c061020dc3 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1592,7 +1592,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } -function showSocialNetwork() { +function showSocialNetwork() +{ global $socialnetworks, $object, $form, $object, $langs; echo ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2d6356394dd..f06a4c14eee 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3299,7 +3299,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } -function showSocialNetwork() { +function showSocialNetwork() +{ global $socialnetworks, $object, $form, $object, $langs; echo ''; From 8909d7ba9c32c13e47e5e15a6b26d7746e72f826 Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 17 Jan 2023 12:44:58 +0100 Subject: [PATCH 3/5] Add doc comment --- htdocs/contact/card.php | 3 +++ htdocs/societe/card.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 8c061020dc3..dffd0fa9021 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1592,6 +1592,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } +/** + * Show social network part if the module is enabled with hiding functionality + */ function showSocialNetwork() { global $socialnetworks, $object, $form, $object, $langs; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index f06a4c14eee..869e5dcf262 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3299,6 +3299,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } +/** + * Show social network part if the module is enabled with hiding functionality + */ function showSocialNetwork() { global $socialnetworks, $object, $form, $object, $langs; From 698306e8a6334e043de03752d11c45a957124b4b Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 17 Jan 2023 12:50:06 +0100 Subject: [PATCH 4/5] Add return in doc comment --- htdocs/contact/card.php | 2 ++ htdocs/societe/card.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index dffd0fa9021..56d2d539e90 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1594,6 +1594,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { /** * Show social network part if the module is enabled with hiding functionality + * + * @return void */ function showSocialNetwork() { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 869e5dcf262..b8971033b2e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3301,6 +3301,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { /** * Show social network part if the module is enabled with hiding functionality + * + * @return void */ function showSocialNetwork() { From cc691383f26a775161c59853c48b4ac1001f09cc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 17 Jan 2023 11:50:35 +0000 Subject: [PATCH 5/5] Fixing style errors. --- htdocs/contact/card.php | 2 +- htdocs/societe/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 56d2d539e90..3e7f5fdb1f1 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1594,7 +1594,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { /** * Show social network part if the module is enabled with hiding functionality - * + * * @return void */ function showSocialNetwork() diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b8971033b2e..6ef8d929361 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3301,7 +3301,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { /** * Show social network part if the module is enabled with hiding functionality - * + * * @return void */ function showSocialNetwork()