Skip to content

Commit

Permalink
Merge pull request #291 from Easya-Solutions/2022.5.3_rc_fix-substitu…
Browse files Browse the repository at this point in the history
…te-project-variables

FIX substitute project variables in document with free text
  • Loading branch information
thomas-Ngr authored Feb 10, 2023
2 parents ef74349 + f52380c commit e3bebfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions htdocs/core/actions_massactions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,6 @@
dol_syslog("We have set an array of ".count($looparray)." emails to send. oneemailperrecipient=".$oneemailperrecipient);
//var_dump($oneemailperrecipient); var_dump($listofqualifiedobj); var_dump($listofqualifiedref);
foreach ($looparray as $objectid => $objecttmp) { // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object
// Make substitution in email content
if (!empty($conf->projet->enabled) && method_exists($objecttmp, 'fetch_projet') && is_null($objecttmp->project)) {
$objecttmp->fetch_projet();
}
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $objecttmp);
$substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id);
$substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref);
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7049,6 +7049,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__RECEPTIONTRACKNUMURL__'] = 'Shipping tracking url';
}
} else {
// can substitute variables for project
if (!empty($conf->projet->enabled) && method_exists($object, 'fetch_project') && is_null($object->project)) {
$object->fetch_project();
}

$substitutionarray['__ID__'] = $object->id;
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__LABEL__'] = (isset($object->label) ? $object->label : (isset($object->title) ? $object->title : null));
Expand Down

0 comments on commit e3bebfe

Please sign in to comment.