Fix backward compatibility with old multicompany module

This commit is contained in:
Laurent Destailleur 2018-07-05 22:15:55 +02:00
parent b369585e61
commit af3ab84ebb

View File

@ -1053,9 +1053,10 @@ if ($action == 'create' || $action == 'adduserldap')
} }
// Multicompany // Multicompany
// This is now done with hook formObjectOptions
/*
if (! empty($conf->multicompany->enabled) && is_object($mc)) if (! empty($conf->multicompany->enabled) && is_object($mc))
{
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
if (! method_exists($mc, 'formObjectOptions'))
{ {
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode
{ {
@ -1068,7 +1069,7 @@ if ($action == 'create' || $action == 'adduserldap')
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
} }
} }
*/ }
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
@ -1559,9 +1560,10 @@ else
print "</tr>\n"; print "</tr>\n";
// Multicompany // Multicompany
// This is now done with hook formObjectOptions (included into /core/tpl/extrafields_view.tpl.php)
/*
if (! empty($conf->multicompany->enabled) && is_object($mc)) if (! empty($conf->multicompany->enabled) && is_object($mc))
{
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
if (! method_exists($mc, 'formObjectOptions'))
{ {
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
@ -1574,7 +1576,8 @@ else
} }
print "</td></tr>\n"; print "</td></tr>\n";
} }
}*/ }
}
// Other attributes // Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -2323,10 +2326,11 @@ else
} }
// Multicompany // Multicompany
// This is now done with hook formObjectOptions
/*
// TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !!
if (! empty($conf->multicompany->enabled) && is_object($mc)) if (! empty($conf->multicompany->enabled) && is_object($mc))
{
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
if (! method_exists($mc, 'formObjectOptions'))
{ {
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
@ -2339,7 +2343,7 @@ else
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
} }
} }
*/ }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="2"'); $parameters=array('colspan' => ' colspan="2"');