mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #15277 from OPEN-DSI/add_new_hook_download_page
NEW: Add new hook on document.php page
This commit is contained in:
commit
63ae623da8
|
|
@ -243,6 +243,23 @@ if (!file_exists($fullpath_original_file_osencoded))
|
|||
exit;
|
||||
}
|
||||
|
||||
// Hooks
|
||||
if (!is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('document'));
|
||||
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
|
||||
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
|
||||
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
|
||||
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
|
||||
if ($reshook < 0) {
|
||||
$errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . join($separator, $hookmanager->errors) : '');
|
||||
dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors);
|
||||
print "ErrorDownloadDocumentHooks: " . $errors;
|
||||
exit;
|
||||
}
|
||||
|
||||
// Permissions are ok and file found, so we return it
|
||||
top_httphead($type);
|
||||
header('Content-Description: File Transfer');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user