From ef88eeeffda05f2c4ebf896997a77600be795b5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Nov 2024 15:30:19 +0100 Subject: [PATCH 01/22] Debug v21 --- htdocs/theme/eldy/global.inc.php | 6 +++++- htdocs/user/virtualcard.php | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..97b87c5faf0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8700,7 +8700,11 @@ table.jPicker { .side-nav { z-index: 200; background: var(--colorbackvmenu1); - padding-top: 70px; + /* padding-top: 70px; */ + position: relative; + top: 70px; + width: 245px; /* must be same than div.login_block */ + box-shadow: none; } #id-left { z-index: 201; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 95644a080fc..a83bc200025 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -131,7 +131,7 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; - $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'

'; + $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'
'; } else { // Button on, click to disable $enabledisablehtml .= ''; @@ -139,13 +139,14 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= ''; } print $enabledisablehtml; -print ''; +print ''; -print '

'; print '
'; if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print '

'; + print ''; print ''; print ''; From fb3c464555c3ea0fded626b5c3b9e71ba908c813 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2024 13:00:08 +0100 Subject: [PATCH 02/22] Debug v21 --- htdocs/core/lib/ajax.lib.php | 18 +++++++++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/public/users/view.php | 36 ++++++++++++++++++++++++------- htdocs/user/virtualcard.php | 29 ++++++++++++------------- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 20ebd6464df..8fa4576ad8c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -639,14 +639,14 @@ function ajax_event($htmlname, $events) * @param string $suffix Suffix to use on the name of the switch picto when option is on. Example: '', '_red' * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS - * @param int $userconst 1=OnOff for user constant of user $userconst + * @param User|int $userconst If set, use the ajax On/Off for user or user ID $userconst * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { - global $conf, $langs, $user; + global $conf, $langs, $user, $db; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); if (!isset($input)) { @@ -660,6 +660,14 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof $out = ''.img_picto($langs->trans("Enabled"), 'on').''; } } else { + if (is_object($userconst)) { + $userconstid = $userconst->id; + } elseif (is_numeric($userconstid) && $userconstid > 0) { + $userconstid = $userconst; + $userconst = new User($db); + $userconst->fetch($userconstid); + } + $out = "\n".' '."\n"; - if ($userconst) { - $value = getDolUserString($code); + if (!empty($userconst) && $userconst instanceof User) { + $value = getDolUserString($code, '', $userconst); } else { $value = getDolGlobalString($code); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2609495d49..1c91d3d0b2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4039,7 +4039,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname)); if (preg_match('/^https?:\/\//i', $link)) { $htmllink .= ''.dol_escape_htmltag($value).''; - } else { + } elseif ($link) { $htmllink .= ''.dol_escape_htmltag($value).''; } } elseif (!empty($dictsocialnetworks[$type]['url'])) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index f0b759fa668..deec8d448ed 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -99,7 +99,6 @@ if ($cancel) { * View */ -$form = new Form($db); $v = new vCard(); $company = $mysoc; @@ -157,9 +156,20 @@ if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { $object->socialnetworks = []; +} else { + // Show list of social networks for company + $listofnetworks = $object->socialnetworks; + + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($object->socialnetworks[$key]); + } + } + } } -// By default, personal address not visible +// By default, personal birthdate and address is not visible if (!getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object)) { $object->birth = null; } @@ -176,8 +186,18 @@ if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) && is_object($company)) { $company->socialnetworks = []; -} +} else { + // Show list of social networks for company + $listofnetworks = $mysoc->socialnetworks; + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($mysoc->socialnetworks[$key]); + } + } + } +} // Output vcard if ($mode == 'vcard') { @@ -220,7 +240,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'onlinepaymentbody'.(GETPOST('mode') == 'preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print '