From 4220d6b253d1626d73920072de291ef30c97aeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Apr 2020 00:38:42 +0200 Subject: [PATCH] actioncomm note deprecated --- htdocs/comm/action/class/actioncomm.class.php | 15 +++++++-------- test/phpunit/ActionCommTest.php | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8c1e2051a81..09c114375b1 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -380,7 +380,7 @@ class ActionComm extends CommonObject // Clean parameters $this->label = dol_trunc(trim($this->label), 128); $this->location = dol_trunc(trim($this->location), 128); - $this->note = dol_htmlcleanlastbr(trim($this->note)); + $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private)); if (empty($this->percentage)) $this->percentage = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; @@ -488,7 +488,7 @@ class ActionComm extends CommonObject $sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", "; $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; - $sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', "; + $sql .= " '".$this->db->escape($this->note_private)."', "; $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; @@ -993,7 +993,7 @@ class ActionComm extends CommonObject // Clean parameters $this->label = trim($this->label); - $this->note = trim($this->note); + $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private)); if (empty($this->percentage)) $this->percentage = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->transparency)) $this->transparency = 0; @@ -1027,7 +1027,7 @@ class ActionComm extends CommonObject $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated - $sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'"; + $sql .= ", note = '".$this->db->escape($this->note_private)."'"; $sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", fk_soc =".($socid > 0 ? $socid : "null"); $sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null"); @@ -1406,8 +1406,8 @@ class ActionComm extends CommonObject $tooltip .= '
'.$langs->trans('Type').': '.$labeltype; if (!empty($this->location)) $tooltip .= '
'.$langs->trans('Location').': '.$this->location; - if (!empty($this->note)) - $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '
', $this->note)); + if (!empty($this->note_private)) + $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '
', $this->note_private)); $linkclose = ''; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; @@ -1940,8 +1940,7 @@ class ActionComm extends CommonObject $this->location = 'Location'; $this->transparency = 1; // 1 means opaque $this->priority = 1; - $this->note = "This is a 'public' note"; - $this->note_public = "This is a 'public' note."; + //$this->note_public = "This is a 'public' note."; $this->note_private = "This is a 'private' note."; $this->userownerid = $user->id; diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 6bb7f12250d..34d67341afb 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -140,7 +140,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $localobject->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $localobject->code = 'AC_PHPUNITTEST'; $localobject->label = 'This is a description'; - $localobject->note = 'This is note'; + $localobject->note_private = 'This is note'; $localobject->fk_project = 0; $localobject->datep = $now; $localobject->datef = $now;