From 89e6b5a6cdfba2762fc85345e1cf3beb27dd6594 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 25 Aug 2016 12:22:17 +0200 Subject: [PATCH 1/3] add color of type for URL background --- htdocs/comm/action/class/actioncomm.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a5016de7ec4..68943525ca6 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -513,7 +513,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; - $sql.= " c.id as type_id, c.code as type_code, c.libelle,"; + $sql.= " c.id as type_id, c.code as type_code, c.libelle, c.color,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; @@ -541,6 +541,7 @@ class ActionComm extends CommonObject // Properties of parent table llx_c_actioncomm (will be deprecated in future) $this->type_id = $obj->type_id; $this->type_code = $obj->type_code; + $this->color = $obj->color; $transcode=$langs->trans("Action".$obj->type_code); $type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle); $this->type = $type_libelle; @@ -1109,7 +1110,11 @@ class ActionComm extends CommonObject if (! empty($this->location)) $tooltip .= '
' . $langs->trans('Location') . ': ' . $this->location; - $linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">'; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) + $linkclose = ' style="background-color:#'.$this->type_color.'" class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">'; + else + $linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">'; + if (! is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; From 223eed0cba92f60f094806ae687dceb31abe6571 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 25 Aug 2016 12:24:38 +0200 Subject: [PATCH 2/3] Update index.php --- htdocs/comm/action/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5306300e7b1..f70b8d171a1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -440,7 +440,7 @@ $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; -$sql.= ' ca.code as type_code, ca.libelle as type_label'; +$sql.= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; // We must filter on resource table @@ -531,6 +531,8 @@ if ($resql) $event->type_code=$obj->type_code; $event->type_label=$obj->type_label; + $event->type_color=$obj->type_color; + $event->libelle=$obj->label; $event->percentage=$obj->percent; $event->authorid=$obj->fk_user_author; // user id of creator From f6a7838c800aaaeca7e1441ea58c53f0e7f156cd Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 28 Aug 2016 07:59:47 +0200 Subject: [PATCH 3/3] Update actioncomm.class.php the variable name defined on the class is type_color --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 68943525ca6..c4739845042 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -513,7 +513,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; - $sql.= " c.id as type_id, c.code as type_code, c.libelle, c.color,"; + $sql.= " c.id as type_id, c.code as type_code, c.libelle, c.color as type_color,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; @@ -541,7 +541,7 @@ class ActionComm extends CommonObject // Properties of parent table llx_c_actioncomm (will be deprecated in future) $this->type_id = $obj->type_id; $this->type_code = $obj->type_code; - $this->color = $obj->color; + $this->type_color = $obj->type_color; $transcode=$langs->trans("Action".$obj->type_code); $type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle); $this->type = $type_libelle;