From: Alan Knowles Date: Wed, 25 Feb 2015 06:18:46 +0000 (+0800) Subject: DataObjects/Custinfo.php X-Git-Url: http://git.roojs.org/?p=Pman.Xtuple;a=commitdiff_plain;h=21841076e885f5ca76e959720c7801c6034b4b3a DataObjects/Custinfo.php --- diff --git a/DataObjects/Custinfo.php b/DataObjects/Custinfo.php index 4ea8fd6a..c74a4178 100644 --- a/DataObjects/Custinfo.php +++ b/DataObjects/Custinfo.php @@ -487,7 +487,7 @@ class Pman_Xtuple_DataObjects_Custinfo extends DB_DataObject } - function initDatabase() + function initDatabase($roo) { if ($this->count()) { return; @@ -510,11 +510,12 @@ class Pman_Xtuple_DataObjects_Custinfo extends DB_DataObject $companies->find(true); - $this->setFrom($this->defaults()); + $this->setFrom(array( 'cust_name' => $companies->name, 'cust_number' => empty($companies->code) ? strtoupper(preg_replace('/[^a-z0-9]+/i', '', $companies->name)) : $companies->code, )); + $this->beforeInsert(array(), $roo); $this->insert();