3 * Table Definition for Office
5 require_once 'DB/DataObject.php';
7 class Pman_Core_DataObjects_Office extends DB_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'Office'; // table name
13 public $id; // int(11) not_null primary_key auto_increment
14 public $company_id; // int(11) not_null
15 public $name; // string(64) not_null
16 public $address; // blob(65535) not_null blob
17 public $address2; // blob(65535) not_null blob
18 public $address3; // blob(65535) not_null blob
19 public $phone; // string(32) not_null
20 public $fax; // string(32) not_null
21 public $email; // string(128) not_null
22 public $role; // string(32) not_null
23 public $country; // string(4)
25 /* the code above is auto generated do not remove the tag below */
27 function applyFilters($q, $au)
29 //DB_DataObject::debugLevel(1);
31 if(!empty($q['_join_country_with_person'])){
32 $tn = $this->tableName();
33 //$this->selectAdd(" i18n_translate('c' , 'CN', 'en') as country_name");
34 $p = DB_DataObject::factory('Person');
35 $p->whereAdd("office_id > 0");
37 $p->selectAdd("DISTINCT(office_id) as office_id");
38 $officeIds = $p->fetchAll('office_id');
39 $this->whereAddIn('Office.id', $officeIds, 'INT');
40 //$this->joinAddCountryWithPerson();
44 function joinAddCountryWithPerson()
50 (join_country.lkey = Office.country AND join_country.inlang = 'en')
54 $item = DB_DataObject::Factory('I18n');
55 $this->selectAs($item, 'country_id_%s', 'join_country');
57 function toEventString() {
61 * check who is trying to access this. false == access denied..
63 function checkPerm($lvl, $au)
65 return $au->hasPerm("Core.Offices", $lvl);