two changes to feature request

This commit is contained in:
Quatadah Nasdami 2022-06-22 14:41:46 +02:00
parent 3749d70ae1
commit ce7db0004b
2 changed files with 10 additions and 0 deletions

View File

@ -5516,6 +5516,9 @@ abstract class CommonObject
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) { if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true; $setsharekey = true;
} }
if ($this->element == 'product' && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true;
}
if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) { if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true; $setsharekey = true;
} }

View File

@ -1727,6 +1727,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
} }
} }
// Update table of files
if ($donotupdatesession == 1) {
$sharefile = 0;
if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) $sharefile = 1;
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', $sharefile);
}
$nbok++; $nbok++;
} else { } else {
$langs->load("errors"); $langs->load("errors");