diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4f1b14336b9..6c53a251fd3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8252,33 +8252,36 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ATTENDEE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : ''; } - $project = null; - if (is_object($object->project)) { - $project = $object->project; - } elseif (is_object($object->projet)) { // Deprecated, for backward compatibility - $project = $object->projet; - } - if ($project) { - $substitutionarray['__PROJECT_ID__'] = $project->id; - $substitutionarray['__PROJECT_REF__'] = $project->ref; - $substitutionarray['__PROJECT_NAME__'] = $project->title; - } else { - // can substitute variables for project : uses lazy load in "make_substitutions" method - $project_id = 0; - if ($object->fk_project > 0) { - $project_id = $object->fk_project; - } elseif ($object->fk_projet > 0) { - $project_id = $object->fk_project; - } - if ($project_id > 0) { - // path:class:method:id - $substitutionarray['__PROJECT_ID__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; - $substitutionarray['__PROJECT_REF__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; - $substitutionarray['__PROJECT_NAME__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; - } - } if (is_object($object) && $object->element == 'project') { + $substitutionarray['__PROJECT_ID__'] = $object->id; + $substitutionarray['__PROJECT_REF__'] = $object->ref; $substitutionarray['__PROJECT_NAME__'] = $object->title; + } elseif (is_object($object)) { + $project = null; + if (!empty($object->project)) { + $project = $object->project; + } elseif (!empty($object->projet)) { // Deprecated, for backward compatibility + $project = $object->projet; + } + if (!is_null($project) && is_object($project)) { + $substitutionarray['__PROJECT_ID__'] = $project->id; + $substitutionarray['__PROJECT_REF__'] = $project->ref; + $substitutionarray['__PROJECT_NAME__'] = $project->title; + } else { + // can substitute variables for project : uses lazy load in "make_substitutions" method + $project_id = 0; + if (!empty($object->fk_project) && $object->fk_project > 0) { + $project_id = $object->fk_project; + } elseif (!empty($object->fk_projet) && $object->fk_projet > 0) { + $project_id = $object->fk_project; + } + if ($project_id > 0) { + // path:class:method:id + $substitutionarray['__PROJECT_ID__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; + $substitutionarray['__PROJECT_REF__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; + $substitutionarray['__PROJECT_NAME__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:' . $project_id; + } + } } if (is_object($object) && $object->element == 'shipping') { diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index fcfd1f535dc..da56228b019 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -93,7 +93,7 @@ ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions SeeExamples=See examples here EnabledDesc=Condition to have this field active.

Examples:
1
isModEnabled('anothermodule')
getDolGlobalString('MYMODULE_OPTION')==2 -VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list and view form only (not create, not update).

Using a negative value means field is not shown by default on list but can be selected for viewing). +VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not on lists), 4=Visible on lists and update/view form only (not create), 5=Visible on list and view form only (not create, not update).

Using a negative value means field is not shown by default on list but can be selected for viewing). ItCanBeAnExpression=It can be an expression. Example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
$user->hasRight('holiday', 'define_holiday')?1:5 DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.
For document :
0 = not displayed
1 = display
2 = display only if not empty

For document lines :
0 = not displayed
1 = displayed in a column
3 = display in line description column after the description
4 = display in description column after the description only if not empty DisplayOnPdf=On PDF