Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -N -r1009 -r1019 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1009) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1019) @@ -994,7 +994,7 @@ function Query_Item($sql, $offset=-1,$rows=-1) { - global $Errors; + global $Errors, $objConfig; //echo "Method QItem [".get_class($this).'], sql: ['.$sql.']
'; $dummy =& $this->GetDummy(); if( !$dummy->TableExists() ) @@ -1003,14 +1003,15 @@ $this->Clear(); return false; } - + //echo "".get_class($this)."
"; + //echo "Rows = $rows && Offset = $offset
"; if($rows>-1 && $offset>-1) { //print_pre(debug_backtrace()); //echo "Executing SelectLimit $sql Offset: $offset,$rows
\n"; $result = $this->adodbConnection->SelectLimit($sql, $rows,$offset); } - else { + else { $result = $this->adodbConnection->Execute($sql); } @@ -1544,7 +1545,7 @@ $Start = ($this->Page - 1) * $PerPage; } else - { + { if((int)$this->MaxListCount == 0) $Start = -1; } return $Start; @@ -1555,6 +1556,7 @@ if($this->EnablePaging) { if($this->Page < 1) $this->Page = 1; + //echo "Got PerPage: ".$this->GetPerPage()."
"; return $this->GetPerPage(); } else @@ -1623,11 +1625,14 @@ } function GetPerPage() - { + { + //echo "Getting Per Page ".get_class($this)."
"; // return category perpage global $objConfig; $PerPage = $objConfig->Get( $this->PerPageVar ); if( !is_numeric($PerPage) ) $PerPage = $this->DefaultPerPage ? $this->DefaultPerPage : 10; + //print_pre(debug_backtrace()); + //echo "Returning: $PerPage
"; return $PerPage; } @@ -1638,14 +1643,14 @@ // or first possible "set_first" $PerPage = $this->GetPerPage(); $NumPages = ceil( $this->GetNumPages($PerPage) ); -/* +/* echo "=====
"; echo "Class ".get_class($this).": Page ".$this->Page." of $NumPages
"; echo "PerPage: $PerPage
"; echo "Items Queries: ".$this->QueryItemCount."
"; echo "=====
"; */ - if($this->Page > $NumPages) + if($this->Page > $NumPages && $PerPage != -1) { switch($fix_method) { @@ -1917,7 +1922,7 @@ if(count($this->Query_SortField)>0) { - for($x=0; $xQuery_SortField); $x++) + for($x = 0; $x < count($this->Query_SortField); $x++) { $FieldVar = $this->Query_SortField[$x]; $OrderVar = $this->Query_SortOrder[$x]; @@ -1940,7 +1945,7 @@ } else $OrderBy=""; - + //echo "ORDER BY: $OrderBy
"; return $OrderBy; } @@ -2408,7 +2413,12 @@ echo htmlentities($sql,ENT_NOQUOTES)."
\n"; if($attribs["_shortlist"]) { - $this->PerPageVar = $this->PerPageShortVar; + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong; @@ -2464,15 +2474,20 @@ function LoadPickItems($attribs) { - global $objSession, $objCountCache; + global $objSession, $objCountCache, $objConfig; $sql = $this->SqlPickItems($attribs); if($objSession->HasSystemPermission("DEBUG.LIST")) echo htmlentities($sql,ENT_NOQUOTES)."
\n"; if($attribs["_shortlist"]) - { - $this->PerPageVar = $this->PerPageShortVar; + { + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong; @@ -2519,7 +2534,12 @@ echo htmlentities($sql,ENT_NOQUOTES)."
\n"; if($attribs["_shortlist"]) { - $this->PerPageVar = $this->PerPageShortVar; + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong; @@ -2608,7 +2628,12 @@ echo htmlentities($sql,ENT_NOQUOTES)."
\n"; if( getArrayValue($attribs,'_shortlist') ) { - $this->PerPageVar = $this->PerPageShortVar; + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong; @@ -2675,7 +2700,12 @@ echo htmlentities($sql,ENT_NOQUOTES)."
\n"; if($attribs["_shortlist"]) { - $this->PerPageVar = $this->PerPageShortVar; + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong; @@ -2745,7 +2775,12 @@ if($attribs["_shortlist"]) { - $this->PerPageVar = $this->PerPageShortVar; + if ($objConfig->Get($this->PerPageShortVar) > 0) { + $this->PerPageVar = $this->PerPageShortVar; + } + else { + $this->PerPageVar = $this->PerPageVarLong; + } } else $this->PerPageVar = $this->PerPageVarLong;