This commit is contained in:
Laurent Destailleur 2021-01-30 13:57:42 +01:00
parent 1063b97c22
commit ca7738c9b3
2 changed files with 2 additions and 2 deletions

View File

@ -425,7 +425,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error while fetching object: '.$object->error);
}
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product');
}
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{

View File

@ -5652,7 +5652,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '
$arrayforoldpath = array('cheque', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment');
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[] = 'product';
if (!empty($level) && in_array($modulepart, $arrayforoldpath)) {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided.
// This part should be removed once all code is using "get_exdir" to forge path, with parameter $object and $modulepart provided.
if (empty($alpha)) $num = preg_replace('/([^0-9])/i', '', $num);
else $num = preg_replace('/^.*\-/i', '', $num);
$num = substr("000".$num, -$level);