Merge pull request #36699 from W1W1-M/fix-document-api-agenda-event-list-download
FIX document API agenda event list and download
This commit is contained in:
commit
d7f9c0157e
3 changed files with 36 additions and 18 deletions
|
|
@ -587,8 +587,8 @@ class Documents extends DolibarrApi
|
|||
throw new RestException(500, 'Error while fetching object: '.$object->error);
|
||||
}
|
||||
|
||||
$upload_dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product');
|
||||
} elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') {
|
||||
$upload_dir = getMultidirOutput($object) . '/'.dol_sanitizeFileName($object->ref);
|
||||
} elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event' || $modulepart == 'actioncomm') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'read') && !DolibarrApiAccess::$user->hasRight('agenda', 'allactions', 'read')) {
|
||||
|
|
|
|||
|
|
@ -3254,7 +3254,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
}
|
||||
$modulepartsuffix = str_replace('tax-', '', $modulepart);
|
||||
$original_file = $conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file;
|
||||
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
|
||||
} elseif (($modulepart == 'actions' || $modulepart == 'actioncomm') && !empty($conf->agenda->dir_output)) {
|
||||
// Wrapping for events
|
||||
if ($fuser->hasRight('agenda', 'myactions', $read)) {
|
||||
$accessallowed = 1;
|
||||
|
|
|
|||
|
|
@ -146,21 +146,39 @@ function getMultidirOutput($object, $module = '', $forobject = 0, $mode = 'outpu
|
|||
}
|
||||
|
||||
// Special case for backward compatibility
|
||||
if ($module == 'fichinter') {
|
||||
$module = 'ficheinter';
|
||||
} elseif ($module == 'invoice_supplier') {
|
||||
$module = 'supplier_invoice';
|
||||
} elseif ($module == 'order_supplier') {
|
||||
$module = 'supplier_order';
|
||||
} elseif ($module == 'recruitmentjobposition') {
|
||||
$module = 'recruitment';
|
||||
$subdirectory = '/recruitmentjobposition';
|
||||
} elseif ($module == 'recruitmentcandidature') {
|
||||
$module = 'recruitment';
|
||||
$subdirectory = '/recruitmentcandidature';
|
||||
} elseif ($module == 'knowledgerecord') {
|
||||
$module = 'knowledgemanagement';
|
||||
$subdirectory = '/knowledgerecord';
|
||||
switch ($module) {
|
||||
case 'fichinter':
|
||||
$module = 'ficheinter';
|
||||
break;
|
||||
case 'invoice_supplier':
|
||||
$module = 'supplier_invoice';
|
||||
break;
|
||||
case 'order_supplier':
|
||||
$module = 'supplier_order';
|
||||
break;
|
||||
case 'recruitmentjobposition':
|
||||
$module = 'recruitment';
|
||||
$subdirectory = '/recruitmentjobposition';
|
||||
break;
|
||||
case 'recruitmentcandidature':
|
||||
$module = 'recruitment';
|
||||
$subdirectory = '/recruitmentcandidature';
|
||||
break;
|
||||
case 'knowledgerecord':
|
||||
$module = 'knowledgemanagement';
|
||||
$subdirectory = '/knowledgerecord';
|
||||
break;
|
||||
case 'service':
|
||||
case 'produit':
|
||||
$module = 'product';
|
||||
break;
|
||||
case 'action':
|
||||
case 'actioncomm':
|
||||
case 'event':
|
||||
$module = 'agenda';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the relative path of directory
|
||||
|
|
|
|||
Loading…
Reference in a new issue