diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e5c24fbac04..635e14f7bd4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1053,22 +1053,23 @@ if ($action == 'create' || $action == 'adduserldap') } // Multicompany - // This is now done with hook formObjectOptions - /* - if (! empty($conf->multicompany->enabled) && is_object($mc)) - { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode - { - print "".''.$langs->trans("Entity").''; - print "".$mc->select_entities($conf->entity); - print "\n"; - } - else - { - print ''; - } - } - */ + 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 + { + print "".''.$langs->trans("Entity").''; + print "".$mc->select_entities($conf->entity); + print "\n"; + } + else + { + print ''; + } + } + } // Other attributes $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); @@ -1558,23 +1559,25 @@ else print ''.dol_print_date($object->datepreviouslogin,"dayhour").''; print "\n"; - // 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) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '' . $langs->trans("Entity") . ''; - if (empty($object->entity)) { - print $langs->trans("AllEntities"); - } else { - $mc->getInfo($object->entity); - print $mc->label; - } - print "\n"; - } - }*/ + // Multicompany + 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) + { + print '' . $langs->trans("Entity") . ''; + if (empty($object->entity)) { + print $langs->trans("AllEntities"); + } else { + $mc->getInfo($object->entity); + print $mc->label; + } + print "\n"; + } + } + } // Other attributes include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -1731,7 +1734,7 @@ else } } } - + print "\n"; @@ -2322,24 +2325,25 @@ else print "\n"; } - // Multicompany - // This is now done with hook formObjectOptions - /* + // Multicompany // 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->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module + if (! method_exists($mc, 'formObjectOptions')) { - print "".''.$langs->trans("Entity").''; - print "".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' - print "\n"; - } - else - { - print ''; - } - } - */ + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print "".''.$langs->trans("Entity").''; + print "".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' + print "\n"; + } + else + { + print ''; + } + } + } // Other attributes $parameters=array('colspan' => ' colspan="2"');