Update setup.php
This commit is contained in:
parent
f7d9975b66
commit
dbdf34c7da
@ -77,8 +77,9 @@ $label = GETPOST('label', 'alpha');
|
|||||||
$scandir = GETPOST('scan_dir', 'alpha');
|
$scandir = GETPOST('scan_dir', 'alpha');
|
||||||
$type = 'myobject';
|
$type = 'myobject';
|
||||||
|
|
||||||
|
$useFormSetup = 0;
|
||||||
|
|
||||||
if ((float) DOL_VERSION >= 15) {
|
if ($useFormSetup && (float) DOL_VERSION >= 15) {
|
||||||
// For Dolibarr v15+ compatibility
|
// For Dolibarr v15+ compatibility
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||||
$formSetup = new FormSetup($db);
|
$formSetup = new FormSetup($db);
|
||||||
@ -263,8 +264,11 @@ if ($action == 'edit') {
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
print $formSetup->generateOutput(true);
|
if ($useFormSetup && (float) DOL_VERSION >= 15) {
|
||||||
|
print $formSetup->generateOutput(true);
|
||||||
|
} else {
|
||||||
|
// Add input fields here
|
||||||
|
}
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
|
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -272,10 +276,18 @@ if ($action == 'edit') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
} else {
|
} else {
|
||||||
if (!empty($formSetup->items)) {
|
if ($useFormSetup && (float) DOL_VERSION >= 15) {
|
||||||
print $formSetup->generateOutput();
|
print $formSetup->generateOutput();
|
||||||
$setupnotempty++;
|
$setupnotempty = count($formSetup->items);
|
||||||
|
} else {
|
||||||
|
// Show fields here
|
||||||
|
foreach ($arrayofparameters as $key => $val) {
|
||||||
|
$setupnotempty++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($setupnotempty) {
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user