From 6f4c1ef972fac9df2e94aedb633dbf0f833d1d53 Mon Sep 17 00:00:00 2001 From: Rikard Bosnjakovic Date: Sun, 15 Mar 2026 12:24:15 +0100 Subject: [PATCH] Whitespace in the middle of a tracking number will break the link when (#37501) the user tries to follow the shipping, so we remove all whitespace. --- htdocs/expedition/card.php | 1 + htdocs/expedition/class/expedition.class.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f256fda9907..39e9cf0412a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -769,6 +769,7 @@ if (empty($reshook)) { if ($action == 'settracking_number') { // Test on permission not required $object->tracking_number = trim(GETPOST('tracking_number', 'alpha')); + $object->tracking_number = preg_replace('/\s+/', '', $object->tracking_number); } if ($action == 'settracking_url') { // Test on permission not required $object->tracking_url = trim(GETPOST('tracking_url', 'restricthtml')); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4896d1c0890..c3d93d1aa44 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -432,6 +432,8 @@ class Expedition extends CommonObject // Clean parameters $this->tracking_number = dol_sanitizeFileName((string) $this->tracking_number); + $this->tracking_number = preg_replace('/\s+/', '', $this->tracking_number); + if (empty($this->fk_project)) { $this->fk_project = 0; }