From 165df931f1ae4f6b1a7126944cf8aebe4e1db2c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Apr 2020 03:14:12 +0200 Subject: [PATCH] Complete fix #13491 --- htdocs/core/class/commonobject.class.php | 3 +- htdocs/core/tpl/extrafields_add.tpl.php | 2 +- htdocs/user/card.php | 81 ++---------------------- 3 files changed, 6 insertions(+), 80 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3781d66b0db..57d9db22861 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6592,7 +6592,7 @@ abstract class CommonObject * This function is responsible to output the and according to correct number of columns received into $params['colspan'] * * @param Extrafields $extrafields Extrafield Object - * @param string $mode Show output (view) or input (edit) for extrafield + * @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield * @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan) * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) @@ -6666,7 +6666,6 @@ abstract class CommonObject break; case "create": case "edit": - $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values. // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php index 2ef606afa0b..38f1cb2b8de 100644 --- a/htdocs/core/tpl/extrafields_add.tpl.php +++ b/htdocs/core/tpl/extrafields_add.tpl.php @@ -45,7 +45,7 @@ if (empty($reshook)) { $params = array(); if (isset($tpl_context)) $params['tpl_context'] = $tpl_context; $params['cols']=$parameters['colspanvalue']; - print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params + print $object->showOptionals($extrafields, 'create', $params); } ?> diff --git a/htdocs/user/card.php b/htdocs/user/card.php index d12f6064131..152103cc5db 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1243,13 +1243,8 @@ if ($action == 'create' || $action == 'adduserldap') } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - } + $parameters = array('colspan' => ' colspan="3"'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Note print ''; @@ -2515,74 +2510,6 @@ else } } - // // Skype - // if (! empty($conf->socialnetworks->enabled)) - // { - // print ''.$langs->trans("Skype").''; - // print ''; - // if ($caneditfield && empty($object->ldap_sid)) - // { - // print ''; - // } - // else - // { - // print ''; - // print $object->skype; - // } - // print ''; - // } - - // // Twitter - // if (! empty($conf->socialnetworks->enabled)) - // { - // print ''.$langs->trans("Twitter").''; - // print ''; - // if ($caneditfield && empty($object->ldap_sid)) - // { - // print ''; - // } - // else - // { - // print ''; - // print $object->twitter; - // } - // print ''; - // } - - // // Facebook - // if (! empty($conf->socialnetworks->enabled)) - // { - // print ''.$langs->trans("Facebook").''; - // print ''; - // if ($caneditfield && empty($object->ldap_sid)) - // { - // print ''; - // } - // else - // { - // print ''; - // print $object->facebook; - // } - // print ''; - // } - - // // LinkedIn - // if (! empty($conf->socialnetworks->enabled)) - // { - // print ''.$langs->trans("LinkedIn").''; - // print ''; - // if ($caneditfield && empty($object->ldap_sid)) - // { - // print ''; - // } - // else - // { - // print ''; - // print $object->linkedin; - // } - // print ''; - // } - // OpenID url if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) { @@ -2738,12 +2665,12 @@ else // Other attributes $parameters = array('colspan' => ' colspan="2"'); + //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; // We do not use common tpl here because we need a special test on $caneditfield $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { - if ($caneditfield) - { + if ($caneditfield) { print $object->showOptionals($extrafields, 'edit'); } else { print $object->showOptionals($extrafields, 'view');