NEW : Add global MAIL_MASS_ACTION_SEARCH_MOST_RECENT_FILE_IF_NOT_FOUND for search and attach the most recent file if none file found when send email in mass action (#36813)
Co-authored-by: Kamel Khelifa <kkhelifa@open-dsi.fr>
This commit is contained in:
parent
a35d180c16
commit
c4dc8b9276
1 changed files with 8 additions and 0 deletions
|
|
@ -429,6 +429,14 @@ if (!$error && $massaction == 'confirm_presend') {
|
|||
$filepath = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
if (getDolGlobalInt('MAIL_MASS_ACTION_SEARCH_MOST_RECENT_FILE_IF_NOT_FOUND') && isset($filepath) && !dol_is_file($filepath)) {
|
||||
$fileparams = dol_most_recent_file($filedir, preg_quote($objectobj->ref, '/') . '([^\-])+' . (getDolGlobalInt('MAIN_ODT_AS_PDF') ? '\.pdf$' : ''));
|
||||
if (isset($fileparams)) {
|
||||
$filepath = $fileparams['fullname'];
|
||||
$filename = $fileparams['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// try to find other files generated for this object (last_main_doc)
|
||||
$filename_found = '';
|
||||
$filepath_found = '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue