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);
30 $tn = $this->tableName();
31 $this->selectAdd(" i18n_translate('c' , {$tn}.country, 'en') as office_id_country_name");
35 function toEventString() {
39 * check who is trying to access this. false == access denied..
41 function checkPerm($lvl, $au)
43 return $au->hasPerm("Core.Offices", $lvl);
48 $c = DB_DataObject::Factory('Companies');
49 $c->get($this->company_id);
54 function beforeDelete($dependants_array, $roo)
56 if (count($dependants_array) != 1) {
57 //$roo->jerr("more than one dependant type....");
58 return true; // standard error message.
61 $p = DB_DAtaObject::Factory('Person');
63 if (!is_a($dependants_array[0], get_class($p))) {
64 $roo->jerr("dep is not a person..");
68 $p->office_id = $this->id;
69 if ($p->count() > 1) {
70 return true; // default err..