protected function sortCalcDateCheck(\MUtil_Model_ModelAbstract $model)
    {
        $sort = $model->getSort();

        if (isset($sort['calc_used_date'])) {
            $add        = true;
            $resultSort = array();

            foreach ($sort as $key => $asc) {
                if ('calc_used_date' === $key) {
                    if ($add) {
                        $resultSort['is_completed']        = $asc;
                        $resultSort['gto_completion_time'] = $asc == SORT_ASC ? SORT_DESC : SORT_ASC;
                        $resultSort['calc_valid_from']     = $asc;
                        $add = false; // We can add this only once
                    }
                } else {
                    $resultSort[$key] = $asc;
                }
            }

            if (! $add) {
                $model->setSort($resultSort);
            }
        }
    }
protected function sortCalcDateCheck(\MUtil_Model_ModelAbstract $model)
    {
        $sort = $model->getSort();

        if (isset($sort['calc_used_date'])) {
            $add        = true;
            $resultSort = array();

            foreach ($sort as $key => $asc) {
                if ('calc_used_date' === $key) {
                    if ($add) {
                        $resultSort['is_completed']        = $asc;
                        $resultSort['gto_completion_time'] = $asc == SORT_ASC ? SORT_DESC : SORT_ASC;
                        $resultSort['calc_valid_from']     = $asc;
                        $add = false; // We can add this only once
                    }
                } else {
                    $resultSort[$key] = $asc;
                }
            }

            if (! $add) {
                $model->setSort($resultSort);
            }
        }
    }
protected function sortCalcDateCheck ( \ MUtil_Model_ModelAbstract $ model ) { $ sort = $ model -> getSort ( ) ; if ( isset ( $ sort [ 'calc_used_date' ] ) ) { $ add = true ; $ resultSort = array ( ) ; foreach ( $ sort as $ key => $ asc ) { if ( 'calc_used_date' === $ key ) { if ( $ add ) { $ resultSort [ 'is_completed' ] = $ asc ; $ resultSort [ 'gto_completion_time' ] = $ asc == SORT_ASC ? SORT_DESC : SORT_ASC ; $ resultSort [ 'calc_valid_from' ] = $ asc ; $ add = false ; // We can add this only once } } else { $ resultSort [ $ key ] = $ asc ; } } if ( ! $ add ) { $ model -> setSort ( $ resultSort ) ; } } }
calc_used_date has special sort, see bugs 108 and 127

@param \MUtil_Model_ModelAbstract $model
calc_used_date has special sort see bugs 108 and 127