// if not empty on_table
if(!empty($q['person_table'])){
$jt = DB_DataObject::factory($q['person_table']);
+
+ $et = DB_DataObject::factory($tn);
if(!array_key_exists("{$jt->tableName()}_id", $this->tableColumns())){ // coz we have triiger on mysql...
$keys = $jt->keys();
$this->_join = "LEFT JOIN {$jt->tableName()} AS join_person_id_id ON (join_person_id_id.{$keys[0]}=Events.person_id)";
- $this->selectAdd();
- $this->selectAs();
+ $this->selectAdd("(select count(*) from Events where Events.dup_id = evet.id) as cnt ");
+ $this->selectAs($et,'%s','evet');
$this->selectAs($jt, 'person_id_%s', 'join_person_id_id');
if (!$au->hasPerm("Admin.Admin_Tab", 'S')) {
//DB_DataObject::DebugLevel(1);
// they can only view their changes..
- $this->person_id = $au->id;
+ $this->whereAdd("($tn.person_id = {$au->id} OR $tn.person_id = 0)");
+// $this->person_id = $au->id;
}
// _join = tablename,tablename...