2
0
forked from Wavyzz/dolibarr

Merge pull request #22695 from FHenry/dev_new_allowdownloadlink_option_in_conf_module

NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
This commit is contained in:
Laurent Destailleur
2022-11-02 00:43:23 +01:00
committed by GitHub
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>';
/*

View File

@@ -55,6 +55,8 @@ if (empty($conf->global->CONTRACT_ADDON)) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$error=0;
if ($action == 'updateMask') {
$maskconst = GETPOST('maskconstcontract', 'alpha');
$maskvalue = GETPOST('maskcontract', 'alpha');
@@ -158,10 +160,37 @@ if ($action == 'updateMask') {
if (!dolibarr_set_const($db, "CONTRACT_ALLOW_ONLINESIGN", $value, 0, 'int', $conf->entity)) {
$error++;
}
} elseif ($action == "allowexternaldownload") {
if (!dolibarr_set_const($db, "CONTRACT_ALLOW_EXTERNAL_DOWNLOAD", $value, 0, 'int', $conf->entity)) {
} 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();
}
}
@@ -504,16 +533,8 @@ print '</tr>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowexternaldownload&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowexternaldownload&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '<td class="center" colspan="2">';
print ajax_constantonoff('CONTRACT_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td>';
print '</tr>';
print '</table>';

View File

@@ -232,6 +232,37 @@ if ($action == 'updateMask') {
if (!($res > 0)) {
$error++;
}
} 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();
}
}
@@ -771,20 +802,15 @@ print '</form>';
print '<tr class="oddeven"><td>'.$langs->trans("InvoiceCheckPosteriorDate"). '&nbsp;' ;
print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
} else {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_INVOICE_CHECK_POSTERIOR_DATE" />';
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE);
print '</td>';
print '<td class="center">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '</form>';
}
print '<td class="left" colspan="2">';
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
print '</td></tr>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
print '<td class="left" colspan="2">';
print ajax_constantonoff('INVOICE_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
print '</table>';

View File

@@ -625,6 +625,15 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
print '</tr>';
print '</form>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
print '<td class="center" colspan="2">';
print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
// default update prices on cloning a proposal
/*
print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';

View File

@@ -178,6 +178,37 @@ if ($action == 'set') {
// par appel methode canBeActivated
dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON", $value, 'chaine', 0, '', $conf->entity);
} 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();
}
}
@@ -502,21 +533,20 @@ print '</form>';
if (isModEnabled('banque')) {
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
} else {
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
}
}
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
print '</td></tr>';
} else {
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td><td>&nbsp;</td>';
print '<td class="right">';
print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
print '</table>';

View File

@@ -102,7 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Follow-up customer contact
TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact
HideClosedServiceByDefault=Hide closed services by default
AllowOnlineSign=Allow online signing
AllowExternalDownload=Allow external download
ShowClosedServices=Show Closed Services
HideClosedServices=Hide Closed Services
UserStartingService=User starting service

View File

@@ -3,3 +3,4 @@ OperationParamDesc=Define the rules to use to extract or set values.<br>Example
EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it.<br>For example, if you want to create a thirdparty with a name extracted from a string 'Name: name to find' present into the body, use the sender email as email, you can set the parameter field like this:<br>'email=HEADER:^From:(.*);name=EXTRACT:BODY:Name:\\s([^\\s]*);client=SET:2;'<br>
IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sale tax
IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sale tax
AllowExternalDownload=Allow external download

View File

@@ -2330,3 +2330,4 @@ HelpCssOnViewDesc=Le CSS utilisé lors de l'affichage du champ.
HelpCssOnListDesc=Le CSS utilisé lorsque le champ est à l'intérieur du tableau d'une liste. <br> Exemple : "tdoverflowmax200"
RECEPTION_PDF_HIDE_ORDERED=Masquer la quantité commandée sur les documents générés pour les réceptions
MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Afficher le prix sur les documents générés pour les réceptions
AllowExternalDownload=Autoriser le téléchargement externe

View File

@@ -102,7 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Contact client suivi contrat
TypeContact_contrat_external_SALESREPSIGN=Contact client signataire contrat
HideClosedServiceByDefault=Masquer les services fermés par défaut
AllowOnlineSign=Autoriser la signature en ligne
AllowExternalDownload=Autoriser le téléchargement externe
ShowClosedServices=Afficher les services fermés
HideClosedServices=Masquer les services fermés
UserStartingService=Utilisateur démarrant le service