From 01be799d20268b8f91356ca8ef5d664ff090ced0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 11 Feb 2022 14:57:22 +0100 Subject: [PATCH] Fixed: Customer do not call update if there are no updated fields --- changelog.md | 1 + src/Models/Customer.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index d1ec7f6..b62963d 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ### All notable changes to `CRM CLient V2` will be documented in this file. # version 3.0.1 +- Fixed : Customer do not call update if there are no updated fields - Fixed : WPCrm bootSessionIfNeeded trying to access $_SESSION['wpcrm'] before session was started - Fixed : WPCrm now only returns a boolean - Fixed : get crm info when client used in laravel diff --git a/src/Models/Customer.php b/src/Models/Customer.php index 78ba1b3..3d715f4 100644 --- a/src/Models/Customer.php +++ b/src/Models/Customer.php @@ -445,10 +445,14 @@ class Customer extends CrmClientModel Utils::setRawProperty($this, 'password', null); } return $saved; - } - if ($saved = $this->update()) { - $this->updatedValues = []; - Utils::setRawProperty($this, 'password', null); + } else { + if (empty($this->updatedValues)) { + return true; + } + if ($saved = $this->update()) { + $this->updatedValues = []; + Utils::setRawProperty($this, 'password', null); + } } return $saved; }