Ok, I'm using Sugar version 4.2.0a and the problem is the code in include/ListView/ListView.php in the function processUnionBeans() which is at line 772 or so. This code is sloppy as hell - it isn't indented consistently, contains a duplicate if statement (let's check twice, just in case!), and doesn't follow Sugar's stated coding standards. I'd love to submit a patch but in the meantime this fixed the problem.
Starting after $response = array(); at line 778, replace this:
Code:
if(isset($_REQUEST['sort_order'])) {
$this->sort_order = $_REQUEST['sort_order'];
}
$this->sort_order = 'asc';
if(isset($_REQUEST['sort_order'])) {
$this->sort_order = $_REQUEST['sort_order'];
}
else if(isset($_REQUEST['subpanel'])){
if(isset($_SESSION['last_sub' .$this->subpanel_module. '_url']) && $_SESSION['last_sub' .$this->subpanel_module. '_url'] == $this->getBaseURL('CELL')) {
if(isset($_SESSION['last_sub' .$this->subpanel_module. '_order']) && $_SESSION['last_sub' .$this->subpanel_module. '_order'] == 'asc') {
$this->sort_order = 'desc';
}
}
else if(isset($subpanel_def->_instance_properties['sort_order'])) {
$this->sort_order = $subpanel_def->_instance_properties['sort_order'];
}
} with this:
Code:
$this->sort_order = 'asc';
if (isset($_SESSION['sort_order'])) {
$this->sort_order = $_SESSION['sort_order']; #TODO: it isn't in _SESSION either. I wonder where 'sort_order' is? The hunt continues.
}
else if (isset($this->subpanel_module) and $this->subpanel_module != '') {
if (isset($_SESSION['last_sub' .$this->subpanel_module. '_url']) and $_SESSION['last_sub' .$this->subpanel_module. '_url'] == $this->getBaseURL('CELL')) {
if (isset($_SESSION['last_sub' .$this->subpanel_module. '_order']) and $_SESSION['last_sub' .$this->subpanel_module. '_order'] == 'asc') {
$this->sort_order = 'desc';
}
}
else if (isset($subpanel_def->_instance_properties['sort_order'])) {
$this->sort_order = $subpanel_def->_instance_properties['sort_order'];
}
}
Bookmarks