projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DataObjects/Core_person.php
[Pman.Core]
/
DataObjects
/
Core_project.php
diff --git
a/DataObjects/Core_project.php
b/DataObjects/Core_project.php
index
517fdac
..
de9db55
100644
(file)
--- a/
DataObjects/Core_project.php
+++ b/
DataObjects/Core_project.php
@@
-2,7
+2,7
@@
/**
* Table Definition for Projects
*/
/**
* Table Definition for Projects
*/
-require_once 'DB/DataObject.php';
+
class_exists('DB_DataObject') ? '' :
require_once 'DB/DataObject.php';
class Pman_Core_DataObjects_Core_project extends DB_DataObject
{
class Pman_Core_DataObjects_Core_project extends DB_DataObject
{
@@
-33,7
+33,7
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
###END_AUTOCODE
function getProjectManagers()
{
###END_AUTOCODE
function getProjectManagers()
{
- $c = DB_DataObject::factory('
Companies
');
+ $c = DB_DataObject::factory('
core_company
');
$c->isOwner = 1;
if (!$c->find(true)) {
return array();
$c->isOwner = 1;
if (!$c->find(true)) {
return array();
@@
-57,7
+57,7
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
}
$ret = array();
}
$ret = array();
- $p = DB_DataObject::factory('
P
erson');
+ $p = DB_DataObject::factory('
core_p
erson');
$p->whereAdd('id IN ('. implode(',', $pmids) .')');
$p->find();
while ($p->fetch()) {
$p->whereAdd('id IN ('. implode(',', $pmids) .')');
$p->find();
while ($p->fetch()) {
@@
-90,9
+90,15
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
function applyFilters($q, $au)
{
function applyFilters($q, $au)
{
+ $tn = $this->tableName();
if (!empty($q['query']['project_search'])) {
$s = $this->escape($q['query']['project_search']);
if (!empty($q['query']['project_search'])) {
$s = $this->escape($q['query']['project_search']);
- $this->whereAdd(" (Projects.code LIKE '$s%') OR (Projects.name LIKE '%$s%')");
+ $this->whereAdd(" ({$tn}.code LIKE '$s%')
+ OR
+ ({$tn}.name LIKE '%$s%')
+ OR
+ join_client_id_id.name LIKE '%$s%'
+ ");
}
// types of project to list ... - default is only the open ones...
if (!empty($q['query']['project_indaterange'])) {
}
// types of project to list ... - default is only the open ones...
if (!empty($q['query']['project_indaterange'])) {
@@
-100,10
+106,10
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
case 'A': // all
break;
case 'C': // current
case 'A': // all
break;
case 'C': // current
- $this->whereAdd(
'Projects.close_date >= NOW()'
);
+ $this->whereAdd(
"{$tn}.close_date >= NOW()"
);
break;
case 'O': // old
break;
case 'O': // old
- $this->whereAdd(
'Projects.close_date < NOW()'
);
+ $this->whereAdd(
"{$tn}.close_date < NOW()"
);
break;
}
}
break;
}
}
@@
-115,7
+121,7
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
- $this->whereAddIn("
Projects
.type", explode(',', $pf), 'string');
+ $this->whereAddIn("
{$tn}
.type", explode(',', $pf), 'string');
}
// user projects!!!! - make sure they can only see project they are suppsed to..
// only applies to document stuff..
}
// user projects!!!! - make sure they can only see project they are suppsed to..
// only applies to document stuff..
@@
-126,20
+132,20
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
- $pr = DB_DataObject::factory(
'Projects'
);
- $pr->whereAdd("
Projects
.type IN ('N','X')");
+ $pr = DB_DataObject::factory(
$tn
);
+ $pr->whereAdd("
{$tn}
.type IN ('N','X')");
$prjs = $pr->fetchAll('id');
//DB_DataObject::debugLevel(1);
$pd = DB_DataObject::factory('ProjectDirectory');
$prjs = $pr->fetchAll('id');
//DB_DataObject::debugLevel(1);
$pd = DB_DataObject::factory('ProjectDirectory');
- $pd->joinAdd(DB_DataObject::factory(
'Projects'
), 'LEFT');
- $pd->whereAdd("
Projects
.type NOT IN ('N','X')");
+ $pd->joinAdd(DB_DataObject::factory(
$tn
), 'LEFT');
+ $pd->whereAdd("
{$tn}
.type NOT IN ('N','X')");
$pd->person_id = $au->id;
$prjs = array_merge($prjs, $pd->fetchAll('project_id'));
if (count($prjs)) {
$this->whereAdd("
$pd->person_id = $au->id;
$prjs = array_merge($prjs, $pd->fetchAll('project_id'));
if (count($prjs)) {
$this->whereAdd("
- (
Projects
.id IN (".implode(',', $prjs)."))
+ (
{$tn}
.id IN (".implode(',', $prjs)."))
");
} else {
$this->whereAdd("1=0"); // can see nothing!!!
");
} else {
$this->whereAdd("1=0"); // can see nothing!!!
@@
-150,7
+156,7
@@
class Pman_Core_DataObjects_Core_project extends DB_DataObject
// DB_DataObjecT::debuglevel(1);
$this->selectAdd();
$this->selectAdd('distinct(client_id)');
// DB_DataObjecT::debuglevel(1);
$this->selectAdd();
$this->selectAdd('distinct(client_id)');
- $this->selectAs(DB_DataObject::factory('
Companies
'), 'client_id_%s','join_client_id_id');
+ $this->selectAs(DB_DataObject::factory('
core_company
'), 'client_id_%s','join_client_id_id');
$this->groupBy('client_id');
}
$this->groupBy('client_id');
}