Referring to In-Link in ItemCount method of CategoriesEventHandler class

1 view
Skip to first unread message

Dmitry A.

unread,
Apr 16, 2010, 1:28:46 PM4/16/10
to In-Portal Bugs Team
As you can see below we are referring to In-Link prefix below which is
unacceptable. I came across this issue when there was NO In-Link
installed.

function ItemCount($params)
{
$object =& $this->getObject($params);
$ci_table = $this->Application->getUnitOption('l-ci', 'TableName');

$sql = 'SELECT COUNT(*)
FROM ' . $object->TableName . ' c
LEFT JOIN ' . $ci_table . ' ci ON c.CategoryId = ci.CategoryId
WHERE (c.TreeLeft BETWEEN ' . $object->GetDBField('TreeLeft') . '
AND ' . $object->GetDBField('TreeRight') . ') AND NOT (ci.CategoryId
IS NULL)';
return $this->Conn->GetOne($sql);
}


We should hard code

$ci_table = TABLE_PREFIX . 'CategoryItems';

or find some other elegant solution.

Who else has something to add here?


DA.

--
You received this message because you are subscribed to the Google Groups "In-Portal Bugs Team" group.
To post to this group, send email to in-port...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-bug...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-bugs?hl=en.

Alexander Obuhovich

unread,
Apr 16, 2010, 1:39:52 PM4/16/10
to in-port...@googlegroups.com
Prefix "l-ci" is a clone of "ci" prefix, which we can use here.
--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Dmitry Andrejev

unread,
Apr 16, 2010, 2:38:25 PM4/16/10
to in-port...@googlegroups.com
Thanks for a hit Alex,

Here is a quick patch.


DA.
itemcount_reffering_to_in-link.patch

Alexander Obuhovich

unread,
Apr 16, 2010, 4:30:23 PM4/16/10
to in-port...@googlegroups.com
Looks ok, 10x for the patch.

Dmitry Andrejev

unread,
Apr 16, 2010, 6:12:04 PM4/16/10
to in-port...@googlegroups.com
New task has been filed and needs to be tested:

699: Referring to In-Link in ItemCount method of CategoriesEventHandler class


DA.
Reply all
Reply to author
Forward
0 new messages