public $__table = 'Companies'; // table name
public $code; // string(32) not_null
- public $name; // string(128) multiple_key
+ public $name; // string(128)
public $remarks; // blob(65535) blob
public $owner_id; // int(11) not_null
public $address; // blob(65535) blob
public $logo_id; // int(11) not_null
public $background_color; // string(8) not_null
public $comptype; // string(8) not_null
- public $ava_craft; // string(254)
public $url; // string(254) not_null
public $main_office_id; // int(11) not_null
public $created_by; // int(11) not_null
public $updated_by; // int(11) not_null
public $updated_dt; // datetime(19) not_null binary
public $passwd; // string(64) not_null
+ public $dispatch_port; // string(255) not_null
+ public $province; // string(255) not_null
+ public $country; // string(4) not_null
/* the code above is auto generated do not remove the tag below */
function applyFilters($q, $au)
{
+
+ //DB_DataObject::debugLevel(1);
$x = DB_DataObject::factory('Companies');
- $x->isOwner = 1;
+ $x->comptype= 'OWNER';
$x->find(true);
if (!empty($q['query']['company_project_id'])) {
SELECT distinct(company_id) FROM ProjectDirectory where project_id IN ($pids)
) $add" );
- // DB_DataObject::debugLevel(1);
+
+ }
+ if (!empty($q['query']['comptype'])) {
+
+ $this->whereAddIn('comptype', explode(',', $q['query']['comptype']), 'string');
}
-
+
+ if (!empty($q['query']['province'])) {
+ $prov = $this->escape($q['query']['province']);
+ $this->whereAdd("province LIKE '$prov%'");
+
+
+ }
+
}
function toEventString() {
return $this->name;
return $au->hasPerm("Core.".$this->tableName(), $lvl);
}
- function whereAddIn($key, $list, $type= 'int')
- {
- $ar = array();
- foreach($list as $k) {
- $ar[] = $type =='int' ? (int)$k : $this->escape($k);
- }
- if (!$ar) {
- return;
- }
- return $this->whereAdd("$key IN (". implode(',', $ar). ')');
- }
- function fetchAll($k= false, $v = false)
- {
- if ($k !== false) {
- $this->selectAdd();
- $this->selectAdd($k);
- if ($v !== false) {
- $this->selectAdd($v);
- }
- }
-
- $this->find();
- $ret = array();
- while ($this->fetch()) {
- if ($v !== false) {
- $ret[$this->$k] = $this->$v;
- continue;
- }
- $ret[] = $k === false ? clone($this) : $this->$k;
- }
- return $ret;
-
- }
+
}