1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-29 17:19:56 +02:00

Fixes #780 - Media Manager category insert issue when greater than 10.

This commit is contained in:
Cameron
2014-10-14 15:35:53 -07:00
parent d99c03f39d
commit dc4a6c938f

View File

@@ -210,7 +210,7 @@ class media_cat_ui extends e_admin_ui
$sql = e107::getDb(); $sql = e107::getDb();
if($sql->gen("SELECT media_cat_owner, MAX(media_cat_category) as maxnum, count(media_cat_id) as number FROM `#core_media_cat` GROUP BY media_cat_owner")) if($sql->gen("SELECT media_cat_owner, MAX(CAST(SUBSTRING_INDEX(media_cat_category, '_', -1 ) AS UNSIGNED)) as maxnum, count(media_cat_id) as number FROM `#core_media_cat` GROUP BY media_cat_owner"))
{ {
while($row = $sql->fetch()) while($row = $sql->fetch())
{ {
@@ -220,10 +220,9 @@ class media_cat_ui extends e_admin_ui
{ {
$this->fields['media_cat_owner']['writeParms'][$own] = $own; $this->fields['media_cat_owner']['writeParms'][$own] = $own;
list($tmp,$tmp2,$maxnum) = explode("_",$row['maxnum']); // check for highest value. if($row['maxnum'] > 0)
if($maxnum > 0)
{ {
$this->ownerCount[$row['media_cat_owner']] = $maxnum; $this->ownerCount[$row['media_cat_owner']] = $row['maxnum']; // $maxnum;
} }
} }
} }