projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DataObjects/Events.php
[Pman.Core]
/
DataObjects
/
Events.php
diff --git
a/DataObjects/Events.php
b/DataObjects/Events.php
index
6b54a7c
..
2e32b9f
100644
(file)
--- a/
DataObjects/Events.php
+++ b/
DataObjects/Events.php
@@
-25,7
+25,7
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
public $person_id; // int(11)
public $remarks; // blob(65535) blob
public $person_table; // string(64)
public $person_id; // int(11)
public $remarks; // blob(65535) blob
public $person_table; // string(64)
- public $
investor_id; // int(11)
+ public $
dupe_id; // int(11)
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
@@
-38,14
+38,18
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
{
$tn = $this->tableName();
// if not empty on_table
{
$tn = $this->tableName();
// if not empty on_table
+
if(!empty($q['person_table'])){
$jt = DB_DataObject::factory($q['person_table']);
if(!empty($q['person_table'])){
$jt = DB_DataObject::factory($q['person_table']);
+
+
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)";
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();
$this->selectAs();
@@
-70,12
+74,12
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
}
$jt = DB_DataObject::factory($person);
}
$jt = DB_DataObject::factory($person);
- $this->whereAdd("
- person_table = '{$jt->tableName()}'
- OR
- person_table = ''
- OR person_table IS NULL"
- ); // default to our standard.. - unless otherwise requested..
+
//
$this->whereAdd("
+
//
person_table = '{$jt->tableName()}'
+
//
OR
+
//
person_table = ''
+
//
OR person_table IS NULL"
+
//
); // default to our standard.. - unless otherwise requested..
}
}
@@
-87,6
+91,11
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
$dt = date('Y-m-d' , strtotime($q['query']['to']));
$this->whereAdd(" {$tn}.event_when <= '$dt' ");
}
$dt = date('Y-m-d' , strtotime($q['query']['to']));
$this->whereAdd(" {$tn}.event_when <= '$dt' ");
}
+
+ if(!empty($q['_with_dupe_count'])){
+ $this->dupe_id = 0;
+ $this->selectAdd("(select count(*)+1 from Events ev_cnt where ev_cnt.dupe_id = {$tn}.id) as dupe_count");
+ }
/*
if (!empty($q['query']['grouped']) && $q['query']['grouped'] == 'gr') {
// grouped..
/*
if (!empty($q['query']['grouped']) && $q['query']['grouped'] == 'gr') {
// grouped..
@@
-101,7
+110,8
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
if (!$au->hasPerm("Admin.Admin_Tab", 'S')) {
//DB_DataObject::DebugLevel(1);
// they can only view their changes..
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...
}
// _join = tablename,tablename...
@@
-116,13
+126,7
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
// empty ontable queries.. these are valid..
$this->whereAdd("$tn.on_table = ''");
}
// empty ontable queries.. these are valid..
$this->whereAdd("$tn.on_table = ''");
}
-
- if (!empty($q['coba_investor_id'])) {
- $coba_investor_id = $this->escape($q['coba_investor_id']);
- //$dt = date('Y-m-d' , strtotime($q['query']['to']));
- $this->whereAdd(" {$tn}.coba_investor_id <= '$coba_investor_id' ");
- }
-
+
if (isset($q['query']['person_sum'])) {
//DB_DataObject::debugLevel(1);
$this->_extra_cols = array('qty' );
if (isset($q['query']['person_sum'])) {
//DB_DataObject::debugLevel(1);
$this->_extra_cols = array('qty' );
@@
-213,6
+217,7
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
if (!$obj) {
$roo->jerr("ontable is invalid");
}
if (!$obj) {
$roo->jerr("ontable is invalid");
}
+ /*
if (!method_exists($obj,'relatedWhere')) {
$roo->jerr( $q['_related_on_table'] . " Does not have method relatedWhere :" .
implode(',', get_class_methods($obj)));
if (!method_exists($obj,'relatedWhere')) {
$roo->jerr( $q['_related_on_table'] . " Does not have method relatedWhere :" .
implode(',', get_class_methods($obj)));
@@
-236,12
+241,17
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
}
$this->whereAdd(implode(' OR ' , $w));
}
$this->whereAdd(implode(' OR ' , $w));
+ }*/
+ if ($obj && method_exists($obj,'relatedEventsWhere')) {
+ $a = $obj->relatedEventsWhere($q,$roo);
+ if($a){
+ $this->whereAdd($a);
+ }
}
}
-
}
// since roo does not support autojoin yet..
if (!isset($q['_distinct'])) {
}
// since roo does not support autojoin yet..
if (!isset($q['_distinct'])) {
@@
-311,6
+321,7
@@
class Pman_Core_DataObjects_Events extends DB_DataObject
}
$this->person_name = $au && !empty($au->name) ? $au->name : '';
}
$this->person_name = $au && !empty($au->name) ? $au->name : '';
+ $this->who = $au && !empty($au->name) ? $au->name : '';
if (empty($au) || (isset($au->id) && empty($au->id))) {
// not authenticated - and a standard id based object
$this->person_id = 0;
if (empty($au) || (isset($au->id) && empty($au->id))) {
// not authenticated - and a standard id based object
$this->person_id = 0;