Complete fix #13491

This commit is contained in:
Laurent Destailleur 2020-04-05 03:14:12 +02:00
parent 22a8c207f4
commit 165df931f1
3 changed files with 6 additions and 80 deletions

View File

@ -6592,7 +6592,7 @@ abstract class CommonObject
* This function is responsible to output the <tr> and <td> 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))

View File

@ -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);
}
?>

View File

@ -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 '<tr><td class="tdtop">';
@ -2515,74 +2510,6 @@ else
}
}
// // Skype
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Skype").'</td>';
// print '<td>';
// if ($caneditfield && empty($object->ldap_sid))
// {
// print '<input size="40" type="text" name="skype" class="flat" value="'.$object->skype.'">';
// }
// else
// {
// print '<input type="hidden" name="skype" value="'.$object->skype.'">';
// print $object->skype;
// }
// print '</td></tr>';
// }
// // Twitter
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Twitter").'</td>';
// print '<td>';
// if ($caneditfield && empty($object->ldap_sid))
// {
// print '<input size="40" type="text" name="twitter" class="flat" value="'.$object->twitter.'">';
// }
// else
// {
// print '<input type="hidden" name="twitter" value="'.$object->twitter.'">';
// print $object->twitter;
// }
// print '</td></tr>';
// }
// // Facebook
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("Facebook").'</td>';
// print '<td>';
// if ($caneditfield && empty($object->ldap_sid))
// {
// print '<input size="40" type="text" name="facebook" class="flat" value="'.$object->facebook.'">';
// }
// else
// {
// print '<input type="hidden" name="facebook" value="'.$object->facebook.'">';
// print $object->facebook;
// }
// print '</td></tr>';
// }
// // LinkedIn
// if (! empty($conf->socialnetworks->enabled))
// {
// print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
// print '<td>';
// if ($caneditfield && empty($object->ldap_sid))
// {
// print '<input size="40" type="text" name="linkedin" class="flat" value="'.$object->linkedin.'">';
// }
// else
// {
// print '<input type="hidden" name="linkedin" value="'.$object->linkedin.'">';
// print $object->linkedin;
// }
// print '</td></tr>';
// }
// 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');