From b27d4fa524ad43e2e8a18e2c2fad3a65ad446172 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 5 Dec 2022 16:00:45 +0100 Subject: [PATCH 1/3] FIX data too long in ticket message --- htdocs/ticket/class/ticket.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2aacffefcd1..73dd93a6c49 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -381,6 +381,7 @@ class Ticket extends CommonObject if (isset($this->message)) { $this->message = trim($this->message); + if (dol_strlen($this->message) > 65000) $this->message = dol_substr($this->message, 0, 65000, 'UTF-8') . '...'; } if (isset($this->fk_statut)) { @@ -915,6 +916,7 @@ class Ticket extends CommonObject if (isset($this->message)) { $this->message = trim($this->message); + if (dol_strlen($this->message) > 65000) $this->message = dol_substr($this->message, 0, 65000, 'UTF-8') . '...'; } if (isset($this->fk_statut)) { From a5933e24d38b88596d5c09143e29c67962784f73 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 15 Dec 2022 15:05:29 +0100 Subject: [PATCH 2/3] FIX data too long for ticket message --- htdocs/ticket/class/ticket.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 73dd93a6c49..f4bb84cc9a1 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -381,7 +381,11 @@ class Ticket extends CommonObject if (isset($this->message)) { $this->message = trim($this->message); - if (dol_strlen($this->message) > 65000) $this->message = dol_substr($this->message, 0, 65000, 'UTF-8') . '...'; + if (dol_strlen($this->message) > 65000) { + $this->errors[] = 'ErrorFieldTooLong'; + dol_syslog(get_class($this).'::create error -1 message too long', LOG_ERR); + $result = -1; + } } if (isset($this->fk_statut)) { From 73202215c0c754d5858d184666c6ad799b3703fe Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 15 Dec 2022 15:08:14 +0100 Subject: [PATCH 3/3] FIX data too long for ticket message on update --- htdocs/ticket/class/ticket.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f4bb84cc9a1..2a3160b3b67 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -920,7 +920,11 @@ class Ticket extends CommonObject if (isset($this->message)) { $this->message = trim($this->message); - if (dol_strlen($this->message) > 65000) $this->message = dol_substr($this->message, 0, 65000, 'UTF-8') . '...'; + if (dol_strlen($this->message) > 65000) { + $this->errors[] = 'ErrorFieldTooLong'; + dol_syslog(get_class($this).'::update error -1 message too long', LOG_ERR); + return -1; + } } if (isset($this->fk_statut)) {