From b3d43d754bbd2bdad8e0ff1b4d39aa2049c272b3 Mon Sep 17 00:00:00 2001 From: abijah Date: Tue, 2 Mar 2010 18:35:09 +0000 Subject: [PATCH] Fixed a bug with customer lease counts after editing the customer. git-svn-id: file:///svn-source/pmgr/branches/v0.2_work@946 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/models/customer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/site/models/customer.php b/site/models/customer.php index efaeb19..31f87f7 100644 --- a/site/models/customer.php +++ b/site/models/customer.php @@ -192,6 +192,13 @@ class Customer extends AppModel { } $id = $this->id; + // Appears that $this->save() "helpfully" choses to add in + // any missing data fields, populated with default values. + // So, after saving is complete, the fields 'lease_count', + // 'past_lease_count', and 'current_lease_count' have all + // been reset to zero. Gee, thanks Cake... + $this->update($id); + // Remove all associated Customer Contacts, as it ensures // any entries deleted by the user actually get deleted // in the system. We'll recreate the needed ones anyway.