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:
ThomasNgr-OpenDSI 2026-01-07 18:30:16 +01:00 committed by GitHub
parent a35d180c16
commit c4dc8b9276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 = '';