Move matching of categories in SQL statements to a separate functions

This commit is contained in:
Alexander Nicolaysen Sørnes
2009-08-09 15:38:38 +02:00
parent e40aec5d84
commit 0fe5512f08
2 changed files with 19 additions and 16 deletions

View File

@@ -1022,14 +1022,7 @@ class Application {
if($aOptions['appCategory'])
{
$oCategory = new Category($aOptions['appCategory']);
$aSubCats = $oCategory->getSubCatList();
$sWhereFilter .= " AND ( catId = '{$aOptions['appCategory']}' ";
foreach($aSubCats as $oCat)
{
$iCatId = $oCat->objectGetId();
$sWhereFilter .= " OR catId = '$iCatId' ";
}
$sWhereFilter .= ") ";
$sWhereFilter .= ' AND ' . $oCategory->getSqlQueryPart();
}
/* Should we add a limit clause to the query? */
if($iRows || $iStart)
@@ -1278,14 +1271,7 @@ class Application {
if($aOptions['appCategory'])
{
$oCategory = new Category($aOptions['appCategory']);
$aSubCats = $oCategory->getSubCatList();
$sWhereFilter .= " AND ( catId = '{$aOptions['appCategory']}' ";
foreach($aSubCats as $oCat)
{
$iCatId = $oCat->objectGetId();
$sWhereFilter .= " OR catId = '$iCatId' ";
}
$sWhereFilter .= ") ";
$sWhereFilter .= ' AND ' . $oCategory->getSqlQueryPart();
}
if($sState != 'accepted' && !application::canEdit())