diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2865533aafd..a0f70b06ebd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12494,21 +12494,21 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param int|boolean $userRight User action right * // phpcs:disable * @param array{confirm?:array{url?:string,title?:string,content?:string,action-btn-label?:string,cancel-btn-label?:string,modal?:bool},attr?:array,areDropdownButtons?:bool,backtopage?:string,lang?:string,enabled?:bool,perm?:int<0,1>,label?:string,url?:string,isDropdown?:int<0,1>,isDropDown?:int<0,1>} $params = [ // Various params for future : recommended rather than adding more function arguments - * 'attr' => [ // to add or override button attributes - * 'xxxxx' => '', // your xxxxx attribute you want - * 'class' => 'reposition', // to add more css class to the button class attribute - * 'classOverride' => '' // to replace class attribute of the button - * ], - * 'confirm' => [ - * 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm. - * 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key - * 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key - * 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key - * 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key - * 'modal' => true, // true|false to display dialog as a modal (with dark background) - * 'isDropDown' => false, // true|false to display dialog as a dropdown list (css dropdown-item with dark background) - * ], - * ] + * 'attr' => [ // to add or override button attributes + * 'xxxxx' => '', // your xxxxx attribute you want + * 'class' => 'reposition', // to add more css class to the button class attribute + * 'classOverride' => '' // to replace class attribute of the button + * ], + * 'confirm' => [ + * 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm. + * 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key + * 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key + * 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key + * 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key + * 'modal' => true, // true|false to display dialog as a modal (with dark background) + * 'isDropDown' => false, // true|false to display dialog as a dropdown list (css dropdown-item with dark background) + * ], + * ] * // phpcs:enable * Example: array('attr' => array('class' => 'reposition')) * @return string html button diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 2df2255e322..864a582c752 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -462,4 +462,5 @@ IDOfPaymentInAnExternalSystem=ID of the payment mode into an external system (li AADEWebserviceCredentials=AADE Webservice Credentials ThirdPartyMustBeACustomerToCreateBANOnStripe=The third-party must be a customer to allow the creation of its bank info on Stripe side NewSocNameForClone=New company name -ConfirmCloneThirdparties=Are you sure that you want to clone %s company ? \ No newline at end of file +ConfirmCloneThirdparties=Are you sure that you want to clone %s company ? +SocialNetworksBusiness=Social networks for company \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 282e8c4d589..1e38f080351 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -137,3 +137,4 @@ ExcludedByFilter=Non qualified by filters but shown to see its hierarchy UserEnabledDisabled=User status changed: %s AlternativeEmailForOAuth2=Alternative Email for OAuth2 login ErrorUpdateCanceledDueToDuplicatedUniqueValue=Error, The update was canceled because one of the pieces of data, that should be unique, already exists +SocialNetworksUser=Social networks for user \ No newline at end of file diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 038241b8ef6..bb77b44c587 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -342,11 +342,12 @@ if (getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object) && $object->address) { } // Social networks -if (!empty($object->socialnetworks) && is_array($object->socialnetworks) && count($object->socialnetworks) > 0) { - if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { - foreach ($object->socialnetworks as $key => $value) { - if ($value) { - $usersection .= '
'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'
'; +if (!empty($object->socialnetworks) && is_array($object->socialnetworks)) { + if (!getDolGlobalInt('USER_PUBLIC_HIDE_SOCIALNETWORKS')) { + $listOfSocialNetworks = $object->socialnetworks; + foreach ($listOfSocialNetworks as $key => $value) { + if (getDolGlobalString('USER_SOCIALNETWORK_'.strtoupper($key))) { + $usersection .= '
'.dol_print_socialnetworks($key, 0, $object->id, strtolower($key), $socialnetworksdict).'
'; } } } @@ -413,9 +414,9 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { // Social networks if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) { - if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object)) { + if (!getDolGlobalInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0)) { foreach ($mysoc->socialnetworks as $key => $value) { - if ($value) { + if (getDolGlobalString('SOCIETE_PUBLIC_SOCIALNETWORKS_'.strtoupper($key))) { $companysection .= '
'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'
'; } } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 3a38189e786..55848110a70 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -24,6 +24,7 @@ // Load Dolibarr environment require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -70,20 +71,9 @@ $permissiontoedit = ((($object->id == $user->id) && $user->hasRight('user', 'sel if ($action == 'update' && $permissiontoedit) { $tmparray = array(); - $tmparray['USER_PUBLIC_HIDE_PHOTO'] = (GETPOST('USER_PUBLIC_HIDE_PHOTO') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_EMAIL'] = (GETPOST('USER_PUBLIC_HIDE_EMAIL') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0); - $tmparray['USER_PUBLIC_SHOW_BIRTH'] = (GETPOST('USER_PUBLIC_SHOW_BIRTH') ? 1 : 0); - $tmparray['USER_PUBLIC_SHOW_ADDRESS'] = (GETPOST('USER_PUBLIC_SHOW_ADDRESS') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_JOBPOSITION'] = (GETPOST('USER_PUBLIC_HIDE_JOBPOSITION') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_OFFICE_FAX'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_FAX') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0); - $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS') ? 1 : 0); $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); - dol_set_user_param($db, $conf, $object, $tmparray); + dolibarr_set_const($db, 'USER_PUBLIC_MORE', $tmparray['USER_PUBLIC_MORE'], 'chaine', 0, '', $conf->entity); } if ($action == 'setUSER_ENABLE_PUBLIC' && $permissiontoedit) { @@ -153,6 +143,9 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); $fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); + $showUserSocialNetworks = getDolGlobalString('USER_PUBLIC_HIDE_SOCIALNETWORKS'); + $showSocieteSocialNetworks = getDolGlobalString('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS'); + print '