###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
- public $__table = 'Projects'; // table name
+ public $__table = 'Projects'; // table name
public $id; // int(11) not_null primary_key auto_increment
public $name; // string(254) not_null
public $remarks; // blob(65535) not_null blob
public $countries; // string(128) not_null
public $languages; // string(128) not_null
public $agency_id; // int(11) not_null
+ public $updated_dt; // datetime(19) not_null binary
/* the code above is auto generated do not remove the tag below */
$oo = clone($this);
if (empty($this->code)) {
$this->code = 'C' + $this->client_id + '-P' + $this->id;
+ $dt = new DateTime();
+ $this->updated_dt = $dt->format('Y-m-d H:i:s');
$this->update($oo);
}
}
$oo = clone($this);
if (empty($this->code)) {
$this->code = 'C' + $this->client_id + '-P' + $this->id;
+ $dt = new DateTime();
+ $this->updated_dt = $dt->format('Y-m-d H:i:s');
$this->update($oo);
}
}
-
- function i18toArray($type, $str)
- {
- if (empty($str)) {
- return array();
- }
- static $au;
- static $langs;
- static $cts;
-
- if (!$au) {
- $u = DB_DataObject::factory('Person');
- $au =$u->getAuthUser();
- $lang = empty($au->lang ) ? 'en' : $au->lang;
- $lbits = explode('_', strtoupper($lang));
- // no validation here!!!!
- require_once 'I18Nv2/Language.php';
- require_once 'I18Nv2/Country.php';
- $langs = new I18Nv2_Language($lbits[0]); // locale support not there??
- $cts = new I18Nv2_Country($lbits[0]); // lo
-
- }
- $lk = $type == 'c' ? $cts : $langs;
- $ar =explode(',', $str);
- $ret = array();
- foreach($ar as $k) {
- $ret[] = array('code'=>$k, 'title' => $lk->getName($k));
- }
- return $ret;
- // work out locale...
-
-
-
-
- }
+
- function toRooArray($req= array()) {
- $ret = parent::toArray();
- // sor tout
- $ret['countrylist'] = $this->I18toArray('c',$ret['countries']);
- $ret['languagelist'] = $this->I18toArray('l',$ret['languages']);
- return $ret;
- }
+
function setFromRoo($q)
{
$this->setFrom($q);
*/
function userProjects($au, $data='id') // COMPANY BASED!!!!
{
+
$id = (int) $au->company_id;
+
$this->whereAdd("
(client_id= $id) OR (agency_id= $id)
");