mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX php8 compatibility
This commit is contained in:
parent
31c287ec58
commit
5d7c98ea08
|
|
@ -312,7 +312,7 @@ if (empty($reshook)) {
|
|||
|
||||
// Set entity property
|
||||
$entity = GETPOST('entity', 'int');
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
if (GETPOST('superadmin', 'int')) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
|
|
@ -476,7 +476,7 @@ if (empty($reshook)) {
|
|||
$object->lang = GETPOST('default_lang', 'aZ09');
|
||||
|
||||
// Do we update also ->entity ?
|
||||
if (!empty($conf->multicompany->enabled) && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user.
|
||||
if (isModEnabled('multicompany') && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user.
|
||||
if (GETPOST('superadmin', 'int')) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
|
|
@ -886,7 +886,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
print '<td>';
|
||||
print $form->selectyesno('admin', GETPOST('admin'), 1);
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<script type="text/javascript">
|
||||
$(function() {
|
||||
|
|
@ -1181,7 +1181,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && 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
|
||||
|
|
@ -1435,7 +1435,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
|
|
@ -1654,10 +1654,10 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && 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 (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
print '<tr><td>'.$langs->trans("Entity").'</td><td>';
|
||||
if (empty($object->entity)) {
|
||||
print $langs->trans("AllEntities");
|
||||
|
|
@ -2135,12 +2135,12 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
&& ($user->id != $object->id) // Don't downgrade ourself
|
||||
&& (
|
||||
(empty($conf->multicompany->enabled) && $nbAdmin >= 1)
|
||||
|| (!empty($conf->multicompany->enabled) && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone
|
||||
|| (isModEnabled('multicompany') && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone
|
||||
)
|
||||
) {
|
||||
print $form->selectyesno('admin', $object->admin, 1);
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<script type="text/javascript">
|
||||
$(function() {
|
||||
|
|
@ -2186,7 +2186,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
$yn = yn($object->admin);
|
||||
print '<input type="hidden" name="admin" value="'.$object->admin.'">';
|
||||
print '<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).'">';
|
||||
if (!empty($conf->multicompany->enabled) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && empty($object->entity)) {
|
||||
print $form->textwithpicto($yn, $langs->trans("DontDowngradeSuperAdmin"), 1, 'warning');
|
||||
} else {
|
||||
print $yn;
|
||||
|
|
@ -2645,7 +2645,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||
|
||||
// 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 (isModEnabled('multicompany') && 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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user