X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_company.php;h=cb0af57500e0197cbfa2ee8ae22517f84e9e9d96;hb=1007a3d809e851a97b49343af72cfb91079e7b21;hp=7e056a1289d633a906643750cd3287de80c60b3f;hpb=11b99f95930656ca7bbe069d4f3ef4f943130328;p=Pman.Core diff --git a/DataObjects/Core_company.php b/DataObjects/Core_company.php index 7e056a12..cb0af575 100644 --- a/DataObjects/Core_company.php +++ b/DataObjects/Core_company.php @@ -12,7 +12,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject public $__table = 'core_company'; // table name public $code; // string(32) not_null public $name; // string(128) - public $remarks; // blob(65535) blob + public $remarks; // blob(65535) blobeforeDeleteb public $owner_id; // int(11) not_null public $address; // blob(65535) blob public $tel; // string(32) @@ -104,20 +104,19 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject ) as comptype_display_name "); - if(!empty($q['query']['name'])){ - $s = $this->escape($q['query']['name']); - $this->whereAdd(" - {$tn}.name LIKE '%$s%' - "); - } - if(!empty($q['search']['name'])){ - $s = $this->escape($q['search']['name']); + if(!empty($q['query']['name']) || !empty($q['search']['name'])){ + + $s = (!empty($q['query']['name'])) ? $this->escape($q['query']['name']) : $this->escape($q['search']['name']); + $this->whereAdd(" {$tn}.name LIKE '%$s%' "); } - if(!empty($q['search']['name_starts'])){ - $s = $this->escape($q['search']['name_starts']); + + if(!empty($q['query']['name_starts']) || !empty($q['search']['name_starts'])){ + + $s = (!empty($q['query']['name_starts'])) ? $this->escape($q['query']['name_starts']) : $this->escape($q['search']['name_starts']); + $this->whereAdd(" {$tn}.name LIKE '$s%' "); @@ -299,6 +298,10 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject $roo->jerr('EXIST'); } + if(!empty($q['_merge_id'])){ + $this->merge($q['_merge_id'], $roo); + } + if(!empty($this->is_system) && ($old->code != $this->code ) // used to be not allowed to change name.. ){ @@ -325,7 +328,7 @@ class Pman_Core_DataObjects_Core_Company extends DB_DataObject $img->onid = $this->id; $img->find(); while ($img->fetch()) { - $img->beforeDelete(); + $img->beforeDelete(array(), $roo); $img->delete(); } return true;