This commit is contained in:
florian HENRY 2017-04-27 09:02:06 +02:00
commit 23e2cbb7f9
2 changed files with 18 additions and 2 deletions

View File

@ -680,7 +680,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code
{
$_POST["code"]=preg_replace('/\s/','',$_POST["code"]);
}
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd'))
{

View File

@ -1385,7 +1385,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$sqlprotectagainstexternals='';
$ret=array();
// find the subdirectory name as the reference
// Find the subdirectory name as the reference. For exemple original_file='10/myfile.pdf' -> refname='10'
if (empty($refname)) $refname=basename(dirname($original_file)."/");
$relative_original_file = $original_file;
@ -1553,6 +1553,18 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
}
// Wrapping for users
else if ($modulepart == 'user' && !empty($conf->user->dir_output))
{
$canreaduser=(! empty($fuser->admin) || $fuser->rights->user->user->lire);
if ($fuser->id == (int) $refname) { $canreaduser=1; } // A user can always read its own card
if ($canreaduser || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
$original_file=$conf->user->dir_output.'/'.$original_file;
}
// Wrapping for third parties
else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output))
{