Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#357 Bug in ImageFilterForm.class.php

2.2.1
open-fixed
HIKAWA Kilica
Legacy (179)
5
2012-07-03
2012-06-04
naao
No

Found a bug in ImageFilterForm.class.php

Default Image Manager's image list order is 'IMAGE_SORT_KEY_IMAGE_WEIGHT'.
as in html/modules/legacy/forms/ImageFilterForm.class.php line 26 :
define('IMAGE_SORT_KEY_DEFAULT', IMAGE_SORT_KEY_IMAGE_WEIGHT);

I changed this line as
define('IMAGE_SORT_KEY_DEFAULT', IMAGE_SORT_KEY_IMAGE_CREATED);
but sql error occured as below.

SELECT * FROM `cdfc1f_image` WHERE (imgcat_id = 1 AND image_display = 1) ORDER BY `image_created` ASC,`7` ASC LIMIT 20
Unknown column '7' in 'order clause'

I found the mistake at line 62 as

if (abs($this->mSort) != IMAGE_SORT_KEY_IMAGE_WEIGHT) {
$this->_mCriteria->addSort(IMAGE_SORT_KEY_IMAGE_WEIGHT, $this->getOrder());
}

it might be as following ?

if (abs($this->mSort) != IMAGE_SORT_KEY_IMAGE_WEIGHT) {
$this->_mCriteria->addSort($this->mSortKeys[IMAGE_SORT_KEY_IMAGE_WEIGHT], $this->getOrder());
}

and next, I think the latest uploaded image must be displayed the first upper column, because I want to select the image just after uploaded.
So, I added a line as

$this->_mCriteria->addSort($this->mSortKeys[IMAGE_SORT_KEY_IMAGE_CREATED], "DESC");

Best regards,

Discussion

  • HIKAWA Kilica
    HIKAWA Kilica
    2012-07-03

    • milestone: --> 2.2.1
    • assigned_to: nobody --> kilica
     
  • HIKAWA Kilica
    HIKAWA Kilica
    2012-07-03

    • status: open --> open-fixed