Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
ldestailleur
2025-06-22 13:00:55 +02:00
5 changed files with 39 additions and 29 deletions

View File

@@ -760,10 +760,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
// We must filter on resource table
if ($resourceid > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
}
// We must filter on assignment table // We must filter on assignment table
if ($filtert > 0 || $usergroup > 0) { if ($filtert > 0 || $usergroup > 0) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar";
@@ -775,6 +772,10 @@ if ($filtert > 0 || $usergroup > 0) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup); $sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
} }
} }
// We must filter on resource table
if ($resourceid > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
}
$sql .= ' WHERE a.fk_action = ca.id'; $sql .= ' WHERE a.fk_action = ca.id';
$sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // bookcal is a "virtual view" of agenda $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // bookcal is a "virtual view" of agenda
// Condition on actioncode // Condition on actioncode

View File

@@ -2187,17 +2187,22 @@ function dolPrintHTML($s, $allowiframe = 0)
* *
* @param string $s String to print * @param string $s String to print
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents. * @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @param string[] $allowothertags List of other tags allowed
* @return string String ready for HTML output * @return string String ready for HTML output
* @see dolPrintHTML(), dolPrintHTMLFortextArea() * @see dolPrintHTML(), dolPrintHTMLFortextArea()
*/ */
function dolPrintHTMLForAttribute($s, $escapeonlyhtmltags = 0) function dolPrintHTMLForAttribute($s, $escapeonlyhtmltags = 0, $allowothertags = array())
{ {
$allowedtags = array('br', 'b', 'font', 'hr', 'span');
if (!empty($allowothertags) && is_array($allowothertags)) {
$allowedtags = array_merge($allowedtags, $allowothertags);
}
// The dol_htmlentitiesbr will convert simple text into html, including switching accent into HTML entities // The dol_htmlentitiesbr will convert simple text into html, including switching accent into HTML entities
// The dol_escape_htmltag will escape html tags. // The dol_escape_htmltag will escape html tags.
if ($escapeonlyhtmltags) { if ($escapeonlyhtmltags) {
return dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 1, 1); return dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 0, 0, 0, $allowedtags), 1, -1, '', 1, 1);
} else { } else {
return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1); return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, $allowedtags), 1, -1, '', 0, 1);
} }
} }
@@ -5286,10 +5291,11 @@ function getPictoForType($key, $morecss = '')
* @param string $alt Force alt for blind people * @param string $alt Force alt for blind people
* @param string $morecss Add more class css on img tag (For example 'myclascss'). * @param string $morecss Add more class css on img tag (For example 'myclascss').
* @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only. * @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only.
* @param string[] $allowothertags List of other tags allowed in title and alt attribute
* @return string Return img tag * @return string Return img tag
* @see img_object(), img_picto_common() * @see img_object(), img_picto_common()
*/ */
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2) function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2, $allowothertags = array())
{ {
global $conf; global $conf;
@@ -5552,7 +5558,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
} }
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for blind people // tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for blind people
return '<img src="'.$fullpathpicto.'"'.($notitle ? '' : ' alt="'.dol_escape_htmltag($alt).'"').(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup return '<img src="'.$fullpathpicto.'"'.($notitle ? '' : ' alt="'.dolPrintHTMLForAttribute($alt, 0, $allowothertags).'"').(($notitle || empty($titlealt)) ? '' : ' title="'.dolPrintHTMLForAttribute($titlealt, 0, $allowothertags).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
} }
/** /**
@@ -5682,15 +5688,16 @@ function getImgPictoConv($mode = 'fa')
* @param int $pictoisfullpath If 1, image path is a full path * @param int $pictoisfullpath If 1, image path is a full path
* @param int $srconly Return only content of the src attribute of img. * @param int $srconly Return only content of the src attribute of img.
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @param string[] $allowothertags List of other tags allowed in title attribute
* @return string Return img tag * @return string Return img tag
* @see img_picto(), img_picto_common() * @see img_picto(), img_picto_common()
*/ */
function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srconly = 0, $notitle = 0) function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srconly = 0, $notitle = 0, $allowothertags = array())
{ {
if (strpos($picto, '^') === 0) { if (strpos($picto, '^') === 0) {
return img_picto($titlealt, str_replace('^', '', $picto), $moreatt, $pictoisfullpath, $srconly, $notitle); return img_picto($titlealt, str_replace('^', '', $picto), $moreatt, $pictoisfullpath, $srconly, $notitle, '', '', 2, $allowothertags);
} else { } else {
return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle); return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle, '', '', 2, $allowothertags);
} }
} }

View File

@@ -49,6 +49,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$this->description = "Triggers of this module allows to manage workflows"; $this->description = "Triggers of this module allows to manage workflows";
$this->version = self::VERSIONS['prod']; $this->version = self::VERSIONS['prod'];
$this->picto = 'technic'; $this->picto = 'technic';
$this->errors = [];
} }
/** /**

View File

@@ -1419,13 +1419,14 @@ class ProductFournisseur extends Product
} }
} }
$allowothertags = array('table', 'tr', 'td');
$linkclose = ''; $linkclose = '';
if (empty($notooltip)) { if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("SupplierRef"); $label = $langs->trans("SupplierRef");
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"'; $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label, 0, $allowothertags).'"';
} }
$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"'; $linkclose .= ' title="'.dolPrintHTMLForAttribute($label, 0, $allowothertags).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else { } else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@@ -1437,7 +1438,7 @@ class ProductFournisseur extends Product
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1, $allowothertags);
} }
if ($withpicto != 2) { if ($withpicto != 2) {
$result .= $newref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : ''); $result .= $newref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : '');

View File

@@ -171,10 +171,10 @@ $out = '';
$permok = $user->hasRight('agenda', 'myactions', 'create'); $permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
$out .= '&amp;originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&amp;socid='.$objthirdparty->id : '').'&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
} }
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : ''); $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel');
} }
$morehtmlright = ''; $morehtmlright = '';