diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 32c3d67a18b..33e33301cfd 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3549,10 +3549,10 @@ class Propal extends CommonObject * @param string $get_params Parametres added to url * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param int $addlinktonotes Add linkt to notes + * @param int $addlinktonotes -1=Disable, 0=Just add label show notes, 1=Add private note (only internal user), 2=Add public note (internal or external user), 3=Add private (internal user) and public note (internal and external user) * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1) { global $langs, $conf, $user; @@ -3618,21 +3618,45 @@ class Propal extends CommonObject if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; - if ($addlinktonotes) - { - $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); - if ($txttoshow) - { - $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); - $result .= ' '; - $result .= ''; - $result .= img_picto('', 'note'); - $result .= ''; - //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); - //$result.=''; - $result .= ''; - } - } + if ($addlinktonotes >= 0) { + $txttoshow = ''; + + if ($addlinktonotes == 0) { + if (!empty($this->note_private) || !empty($this->note_public)) { + $txttoshow = $langs->trans('ViewPrivateNote'); + } + } elseif ($addlinktonotes == 1) { + if (!empty($this->note_private)) { + $txttoshow .= ($user->socid > 0 ? '' : dol_string_nohtmltag($this->note_private, 1)); + } + } elseif ($addlinktonotes == 2) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } elseif ($addlinktonotes == 3) { + if ($user->socid > 0) { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + } else { + if (!empty($this->note_public)) { + $txttoshow .= dol_string_nohtmltag($this->note_public, 1); + } + if (!empty($this->note_private)) { + if (!empty($txttoshow)) $txttoshow .= '

'; + $txttoshow .= dol_string_nohtmltag($this->note_private, 1); + } + } + } + + if ($txttoshow) { + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + $result .= ''; + } + } return $result; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 13ab3a1ae17..b9fefe3d78b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -776,8 +776,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; - $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; + $objectstatic->note_public = $obj->note_public; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -798,7 +798,7 @@ if ($resql) print ''; // Picto + Ref print ''; // Warning $warnornote = '';
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1, 1); + print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); print '