Merge pull request #12317 from OPEN-DSI/new-propal-tooltip-note

NEW add public and private notes in propal list
This commit is contained in:
Laurent Destailleur 2020-02-05 21:41:17 +01:00 committed by GitHub
commit 1344ce06a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 19 deletions

View File

@ -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").':<br>'.dol_string_nohtmltag($txttoshow, 1);
$result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
//$result.='</a>';
$result .= '</span>';
}
}
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 .= '<br><br>';
$txttoshow .= dol_string_nohtmltag($this->note_private, 1);
}
}
}
if ($txttoshow) {
$result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($txttoshow).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
$result .= '</span>';
}
}
return $result;
}

View File

@ -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 '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
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 '</td>';
// Warning
$warnornote = '';