#397 Additional ability in criteria setOrder

XOOPS_2.6
open
nobody
Core (214)
5
2012-09-25
2012-08-23
zyspec
No

Currently the only options for the setOrder method in the Criteria element is to set it to DESC. The object is created with the order set to 'ASC' but if setOrder is called with 'DESC' then it can't be changed back without destroying the object. SetOrder should allow both ASC & DESCas possible order as values passed to the method. Recommend changing method to:

/**
 * @param string $order
 */
public function setOrder($order)
{
    if ('DESC' == strtoupper($order)) {
        $this->order = 'DESC';
    } else {
        $this->order = 'ASC';
    }
}

Discussion