FIX php8 compatibility
This commit is contained in:
parent
31c287ec58
commit
5d7c98ea08
@ -312,7 +312,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Set entity property
|
// Set entity property
|
||||||
$entity = GETPOST('entity', 'int');
|
$entity = GETPOST('entity', 'int');
|
||||||
if (!empty($conf->multicompany->enabled)) {
|
if (isModEnabled('multicompany')) {
|
||||||
if (GETPOST('superadmin', 'int')) {
|
if (GETPOST('superadmin', 'int')) {
|
||||||
$object->entity = 0;
|
$object->entity = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -476,7 +476,7 @@ if (empty($reshook)) {
|
|||||||
$object->lang = GETPOST('default_lang', 'aZ09');
|
$object->lang = GETPOST('default_lang', 'aZ09');
|
||||||
|
|
||||||
// Do we update also ->entity ?
|
// 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')) {
|
if (GETPOST('superadmin', 'int')) {
|
||||||
$object->entity = 0;
|
$object->entity = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -886,7 +886,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectyesno('admin', GETPOST('admin'), 1);
|
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)) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -1181,7 +1181,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multicompany
|
// 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
|
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||||
if (!method_exists($mc, 'formObjectOptions')) {
|
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
|
||||||
@ -1435,7 +1435,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$addadmin = '';
|
$addadmin = '';
|
||||||
if (property_exists($object, 'admin')) {
|
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"');
|
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||||
} elseif (!empty($object->admin)) {
|
} elseif (!empty($object->admin)) {
|
||||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||||
@ -1654,10 +1654,10 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multicompany
|
// 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
|
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||||
if (!method_exists($mc, 'formObjectOptions')) {
|
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>';
|
print '<tr><td>'.$langs->trans("Entity").'</td><td>';
|
||||||
if (empty($object->entity)) {
|
if (empty($object->entity)) {
|
||||||
print $langs->trans("AllEntities");
|
print $langs->trans("AllEntities");
|
||||||
@ -2135,12 +2135,12 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
&& ($user->id != $object->id) // Don't downgrade ourself
|
&& ($user->id != $object->id) // Don't downgrade ourself
|
||||||
&& (
|
&& (
|
||||||
(empty($conf->multicompany->enabled) && $nbAdmin >= 1)
|
(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);
|
print $form->selectyesno('admin', $object->admin, 1);
|
||||||
|
|
||||||
if (!empty($conf->multicompany->enabled) && !$user->entity) {
|
if (isModEnabled('multicompany') && !$user->entity) {
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -2186,7 +2186,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
$yn = yn($object->admin);
|
$yn = yn($object->admin);
|
||||||
print '<input type="hidden" name="admin" value="'.$object->admin.'">';
|
print '<input type="hidden" name="admin" value="'.$object->admin.'">';
|
||||||
print '<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).'">';
|
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');
|
print $form->textwithpicto($yn, $langs->trans("DontDowngradeSuperAdmin"), 1, 'warning');
|
||||||
} else {
|
} else {
|
||||||
print $yn;
|
print $yn;
|
||||||
@ -2645,7 +2645,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
|||||||
|
|
||||||
// Multicompany
|
// Multicompany
|
||||||
// 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 (isModEnabled('multicompany') && is_object($mc)) {
|
||||||
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||||
if (!method_exists($mc, 'formObjectOptions')) {
|
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) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user