Index: trunk/kernel/include/item.php =================================================================== diff -u -r3260 -r3261 --- trunk/kernel/include/item.php (.../item.php) (revision 3260) +++ trunk/kernel/include/item.php (.../item.php) (revision 3261) @@ -1128,11 +1128,13 @@ $db =& GetADODBConnection(); $sql = 'SELECT '.$this->IdField().' FROM '.$this->tablename.' WHERE Filename = '.$db->qstr($filename); - $found_item_id = $db->GetOne($sql); + $found_item_ids = $db->GetCol($sql); $has_page = preg_match('/(.*)_([\d]+)([a-z]*)$/', $filename, $rets); - if( ($found_item_id != $this->UniqueId()) || $has_page ) // other category has same filename as ours OR we have filename, that ends with _number + + $duplicates_found = (count($found_item_ids) > 1); + if ($duplicates_found || $has_page) // other category has same filename as ours OR we have filename, that ends with _number { - $append = $found_item_id ? 'a' : ''; + $append = $duplicates_found ? 'a' : ''; if($has_page) { $filename = $rets[1].'_'.$rets[2];