From 597e8ef671c499e6ecf0ec25e423977d13a34f48 Mon Sep 17 00:00:00 2001 From: a-schild Date: Thu, 17 Jun 2021 18:17:08 +0200 Subject: [PATCH 1/2] Allow to update ref_ext via webservices See issue #17967 --- htdocs/contact/class/contact.class.php | 2 ++ htdocs/webservices/server_contact.php | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7ca69871238..f3a5f170380 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -549,6 +549,7 @@ class Contact extends CommonObject $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); $this->town = (empty($this->town) ? '' : trim($this->town)); + $this->ref_ext = trim($this->ref_ext); $this->setUpperOrLowerCase(); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); if (empty($this->statut)) { @@ -571,6 +572,7 @@ class Contact extends CommonObject $sql .= ", address='".$this->db->escape($this->address)."'"; $sql .= ", zip='".$this->db->escape($this->zip)."'"; $sql .= ", town='".$this->db->escape($this->town)."'"; + $sql .= ", ref_ext = ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", fk_pays=".($this->country_id > 0 ? $this->country_id : 'NULL'); $sql .= ", fk_departement=".($this->state_id > 0 ? $this->state_id : 'NULL'); $sql .= ", poste='".$this->db->escape($this->poste)."'"; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 37d86dcded9..3a1a627863a 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -626,6 +626,7 @@ function updateContact($authentication, $contact) if (!empty($object->id)) { $objectfound = true; + $object->ref_ext = $contact['ref_ext']; $object->firstname = $contact['firstname']; $object->lastname = $contact['lastname']; From d4fa284f67ca6fb96ed5906d711e99af907dbae1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 17 Jun 2021 16:18:55 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/contact/class/contact.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f3a5f170380..bf65adc437a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -549,7 +549,7 @@ class Contact extends CommonObject $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); $this->town = (empty($this->town) ? '' : trim($this->town)); - $this->ref_ext = trim($this->ref_ext); + $this->ref_ext = trim($this->ref_ext); $this->setUpperOrLowerCase(); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); if (empty($this->statut)) {