Move matching of categories in SQL statements to a separate functions
This commit is contained in:
@@ -1022,14 +1022,7 @@ class Application {
|
|||||||
if($aOptions['appCategory'])
|
if($aOptions['appCategory'])
|
||||||
{
|
{
|
||||||
$oCategory = new Category($aOptions['appCategory']);
|
$oCategory = new Category($aOptions['appCategory']);
|
||||||
$aSubCats = $oCategory->getSubCatList();
|
$sWhereFilter .= ' AND ' . $oCategory->getSqlQueryPart();
|
||||||
$sWhereFilter .= " AND ( catId = '{$aOptions['appCategory']}' ";
|
|
||||||
foreach($aSubCats as $oCat)
|
|
||||||
{
|
|
||||||
$iCatId = $oCat->objectGetId();
|
|
||||||
$sWhereFilter .= " OR catId = '$iCatId' ";
|
|
||||||
}
|
|
||||||
$sWhereFilter .= ") ";
|
|
||||||
}
|
}
|
||||||
/* Should we add a limit clause to the query? */
|
/* Should we add a limit clause to the query? */
|
||||||
if($iRows || $iStart)
|
if($iRows || $iStart)
|
||||||
@@ -1278,14 +1271,7 @@ class Application {
|
|||||||
if($aOptions['appCategory'])
|
if($aOptions['appCategory'])
|
||||||
{
|
{
|
||||||
$oCategory = new Category($aOptions['appCategory']);
|
$oCategory = new Category($aOptions['appCategory']);
|
||||||
$aSubCats = $oCategory->getSubCatList();
|
$sWhereFilter .= ' AND ' . $oCategory->getSqlQueryPart();
|
||||||
$sWhereFilter .= " AND ( catId = '{$aOptions['appCategory']}' ";
|
|
||||||
foreach($aSubCats as $oCat)
|
|
||||||
{
|
|
||||||
$iCatId = $oCat->objectGetId();
|
|
||||||
$sWhereFilter .= " OR catId = '$iCatId' ";
|
|
||||||
}
|
|
||||||
$sWhereFilter .= ") ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sState != 'accepted' && !application::canEdit())
|
if($sState != 'accepted' && !application::canEdit())
|
||||||
|
|||||||
@@ -176,6 +176,23 @@ class Category {
|
|||||||
return $aCats;
|
return $aCats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns an SQL statement that will match items in the current category
|
||||||
|
and all sub-categories */
|
||||||
|
public function getSqlQueryPart()
|
||||||
|
{
|
||||||
|
$sRet = '';
|
||||||
|
$aSubCats = $this->getSubCatList();
|
||||||
|
$sRet .= " ( catId = '{$this->iCatId}' ";
|
||||||
|
foreach($aSubCats as $oCat)
|
||||||
|
{
|
||||||
|
$iCatId = $oCat->objectGetId();
|
||||||
|
$sRet .= " OR catId = '$iCatId' ";
|
||||||
|
}
|
||||||
|
$sRet .= ") ";
|
||||||
|
|
||||||
|
return $sRet;
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
{
|
{
|
||||||
/* We don't send notification mails */
|
/* We don't send notification mails */
|
||||||
|
|||||||
Reference in New Issue
Block a user