From c6ccb92a51f77b6f11a3b3e92a433d0b0f352403 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 01:41:42 +0200 Subject: [PATCH] Fix table shown when there is no perm Fix edit admin status of another admin --- htdocs/comm/propal/card.php | 16 ++++-- .../modulebuilder/template/myobject_card.php | 54 +++++++++++++++++++ htdocs/user/card.php | 4 +- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index abed072bc2c..4950efb19ab 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2421,10 +2421,15 @@ $formquestion = array_merge($formquestion, array( } print '
'; - print ''; + if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) + { + print '
'; + } if (! empty($object->lines)) + { $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + } // Form to add new line if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') @@ -2439,16 +2444,21 @@ $formquestion = array_merge($formquestion, array( } } - print '
'; + if (! empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) + { + print ''; + } print '
'; print "\n"; dol_fiche_end(); + /* - * Boutons Actions + * Button Actions */ + if ($action != 'presend') { print '
'; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 212e86ca93c..e5223c86608 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -361,6 +361,60 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea dol_fiche_end(); + /* + * Lines + */ + + if (! empty($object->table_element_line)) + { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + '; + + if (! empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print ''; + } + + if (! empty($object->lines)) + { + $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') + { + if ($action != 'editline') + { + // Add products/services form + $object->formAddObjectLine(1, $mysoc, $soc); + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } + } + + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print '
'; + } + print '
'; + + print "
\n"; + } + + // Buttons for actions if ($action != 'presend' && $action != 'editline') { print '
'."\n"; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 926cb50836e..a86a4a428f0 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2123,7 +2123,7 @@ else && ($user->id != $object->id) // Don't downgrade ourself && ( (empty($conf->multicompany->enabled) && $nbAdmin >= 1) - || (! empty($conf->multicompany->enabled) && ($object->entity > 0 || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone + || (! empty($conf->multicompany->enabled) && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone ) ) { @@ -2543,7 +2543,7 @@ else 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 "".$mc->select_entities($object->entity, 'entity', '', 0, 1, false, false, 1); // last parameter 1 means, show also a choice 0=>'all entities' print "\n"; } else