Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions htdocs/core/actions_massactions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@
$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 = '';
Expand Down Expand Up @@ -573,7 +581,7 @@
$attachedfiles = array('paths' => array(), 'names' => array(), 'mimes' => array());
if ($oneemailperrecipient) {
// if "one email per recipient" is check we must collate $attachedfiles by thirdparty
if (is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) {

Check failure on line 584 in htdocs/core/actions_massactions.inc.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

Call to function is_array() with non-empty-array<array{paths: array{mixed}, names: array{mixed}, mimes: array{mixed}}> will always evaluate to true.
foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles) {
// Create form object
$attachedfiles = array(
Expand Down
Loading