From 1c5d97f06d041d2609b6e071c5c40e79d7550243 Mon Sep 17 00:00:00 2001 From: abijah Date: Mon, 17 Aug 2009 06:32:32 +0000 Subject: [PATCH] Modified the customer update() function to update all customers if passed null. This would not be a typcial scenario, but it useful at the moment during development. git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@603 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/models/customer.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/site/models/customer.php b/site/models/customer.php index 10fcd41..3df1ebb 100644 --- a/site/models/customer.php +++ b/site/models/customer.php @@ -233,6 +233,18 @@ class Customer extends AppModel { function update($id) { $this->prEnter(compact('id')); + if (empty($id)) { + $customers = $this->find('all', array('contain' => false, 'fields' => array('id'))); + foreach ($customers AS $customer) { + // This SHOULDN'T happen, but check to be sure + // or we'll get infinite recursion. + if (empty($customer['Customer']['id'])) + continue; + $this->update($customer['Customer']['id']); + } + return; + } + // REVISIT : 20090812 // updateLeaseCount is handled directly when needed. // Should we simplify by just doing it anyway?