NEW: Allow download link in module configuration (propal,invoice,supplier proposal, order)

This commit is contained in:
Florian HENRY
2022-10-28 10:40:43 +02:00
parent 3077af47cd
commit b3c7d64cb2
9 changed files with 165 additions and 39 deletions

View File

@@ -182,7 +182,39 @@ if ($action == 'updateMask') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$value = (GETPOST($code) ? GETPOST($code) : 1);
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if ($error) {
setEventMessages($langs->trans('Error'), null, 'errors');
} else {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
header("Location: " . $_SERVER["PHP_SELF"]);
exit();
}
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!($res > 0)) {
$error++;
}
if ($error) {
setEventMessages($langs->trans('Error'), null, 'errors');
} else {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
header("Location: " . $_SERVER["PHP_SELF"]);
exit();
}
}
/*elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
// Activate ask for payment bank
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
@@ -208,7 +240,8 @@ if ($action == 'updateMask') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
} */
/*
@@ -636,6 +669,13 @@ print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMAR
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
print '<td class="center" colspan="2">';
print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
print '</form>';
/*