var $do = false; // the dataobject being worked on..
+
+ var $countWhat; // set in loadMap
+ var $colsJname;
+ var $old;
+
function getAuth()
{
parent::getAuth(); // load company!
* lookup[key]=value single fetch based on a single key value lookup.
* multiple key/value can be used. eg. ontable+onid..
* _columns what to return.
+ *
+ * _no_count skip the default count query.
+ * use the number of records in the query result as the total
*
*
* JOINS:
$this->init(); // from pman.
//DB_DataObject::debuglevel(1);
HTML_FlexyFramework::get()->generateDataobjectsCache($this->isDev && !empty($_REQUEST['isDev']));
-
-
-
+
// debugging...
-
-
-
+
if ( $this->checkDebugPost()) {
$tab = array_shift($tt);
$x = $this->dataObject($tab);
- $_columns = !empty($_REQUEST['_columns']) ? explode(',', $_REQUEST['_columns']) : false;
+ $_columns = !empty($_REQUEST['_columns']) && is_string($_REQUEST['_columns']) ? explode(',', $_REQUEST['_columns']) : false;
+
if (isset( $_REQUEST['lookup'] ) && is_array($_REQUEST['lookup'] )) { // single fetch based on key/value pairs
$this->selectSingle($x, $_REQUEST['lookup'],$_REQUEST);
$xx=clone($x);
}
-
- $total = $xx->count($this->countWhat);
+ $total = false;
+ if (!isset($_REQUEST['_no_count'])) {
+ $total = $xx->count($this->countWhat);
+ }
+ if (isset($xx->_real_total)) { // this is used when we subquery the search.
+ $total = $xx->_real_total;
+ }
// sorting..
//
- //var_dump($total);exit;
+ // var_dump($total);exit;
$this->applySort($x);
$fake_limit = false;
- if (!empty($_REQUEST['_distinct']) && $total < 400) {
+ if (!empty($_REQUEST['_distinct']) && $total !== false && $total < 400) {
$fake_limit = true;
}
if (!empty($_REQUEST['query']['add_blank'])) {
$ret[] = array( 'id' => 0, 'name' => '----');
- $total+=1;
+ $total === false ? false : $total+1;
}
$rooar = method_exists($x, 'toRooArray');
// filter results, and add any data that is needed...
if (method_exists($x,'postListFilter')) {
- $ret = $x->postListFilter($ret, $this->authUser, $_REQUEST);
+ $ret = $x->postListFilter($ret, $this->authUser, $_REQUEST, $this);
}
// this make take some time...
$this->sessionState(0);
// echo "<PRE>"; print_r($ret);
- $this->jdata($ret, max(count($ret), $total), $extra );
+ $this->jdata($ret, max(count($ret), $total === false ? 0 : $total), $extra );
}
{
// Db_DataObject::debugLevel(1);
- $sort = empty($_REQUEST['sort']) ? $sort : $_REQUEST['sort'];
- $dir = empty($_REQUEST['dir']) ? $dir : $_REQUEST['dir'];
+ $sort = empty($_REQUEST['sort']) || !is_string($_REQUEST['sort']) ? $sort : $_REQUEST['sort'];
+ $dir = empty($_REQUEST['dir']) || !is_string($_REQUEST['dir']) ? $dir : $_REQUEST['dir'];
$dir = $dir == 'ASC' ? 'ASC' : 'DESC';
- $ms = empty($_REQUEST['_multisort']) ? false : $_REQUEST['_multisort'];
+ $ms = empty($_REQUEST['_multisort']) || !is_string($_REQUEST['_multisort']) ? false : $_REQUEST['_multisort'];
//var_Dump($ms);exit;
$sorted = false;
if (method_exists($x, 'applySort')) {
}
if ( $with_perm_check && !$this->checkPerm($x,'A', $req)) {
- $this->jerr("PERMISSION DENIED (i)");
+ $this->jerr("PERMISSION DENIED {$x->tableName()}:checkPerm(A)");
}
$cols = $x->tableColumns();
function loadMap($do, $cfg =array()) //$onlycolumns=false, $distinct = false)
{
-
- //DB_DataObject::debugLevel(5);
+ //DB_DataObject::debugLevel(5);
$onlycolumns = !empty($cfg['columns']) ? $cfg['columns'] : false;
$distinct = !empty($cfg['distinct']) ? $cfg['distinct'] : false;
$excludecolumns = !empty($cfg['exclude']) ? $cfg['exclude'] : array();