SiT! Bugs - SiT!
View Issue Details
0001968SiT!portalpublic2015-06-15 06:292015-11-01 12:45
rockell 
paulh 
normalminoralways
resolvedfixed 
LinuxLinux2.6+later
3.67 LTS 
Current GIT 
0001968: Incorrect software name appears above Title in portal knowledgebase
The name for the first record in the software table appears for all articles.
Add a knowledge base item with a different skill from the first record in the software table. When you view it in the portal it will have the name of the first record.
The query in kb.php is incorrect. I changed mine to this and it now works as expected. i am not sure what the code inside the if statement does so i left it as-is. The first commented query was already commented, the second commented query was in the delivered code but was incorrect. The query below my initials works for me and i have tried it using all the options available on the page.

$filter = array('start' => $start, 'view' => $view);

// $sql = "SELECT k.*, s.name FROM `{$dbKBArticles}` AS k,
// $dbKBSoftware,
// `{$dbSoftware}` as s
// WHERE ((k.docid = kbs.docid AND kbs.softwareid = s.id) OR 1=1) AND k.distribution = 'public' ";
// $sql = "
// SELECT k.*, s.name FROM `{$dbKBArticles}` AS k,
// LEFT OUTER JOIN `$dbKBSoftware`, `{$dbSoftware}`
// ON k.docid = kbs.docid AND kbs.softwareid = s.id ";


//$sql = "SELECT k.*, s.name FROM `{$dbKBArticles}` AS k, `{$dbSoftware}` as s ";
//$sql .= "LEFT OUTER JOIN `{$dbKBSoftware}` as kbs ";
//$sql .= "ON kbs.softwareid=s.id ";
//$sql .= "WHERE (k.docid = kbs.docid OR 1=1) AND k.distribution='public' ";

//CR - 2015-06-15 Corrected query so it brings up the right name
$sql = "SELECT k.*, s.name FROM `{$dbKBArticles}` AS k inner join `{$dbKBSoftware}` as ks inner join `{$dbSoftware}` as s ";
$sql .= "ON ks.docid=k.docid and s.id=ks.softwareid ";
$sql .= "WHERE k.distribution='public' ";

if ($CONFIG['portal_kb_enabled'] != 'Public')
{
    if ($view != 'all')
    {
        $softwares = contract_software();
        $sql .= "AND (1=1 ";
        if (is_array($softwares))
        {
            foreach ($softwares AS $software)
            {
                $sql .= "OR kbs.softwareid={$software} ";
            }
        }
        $sql .= ")";

        echo "<p class='info'>{$strShowingOnlyRelevantArticles} - ";
        echo "<a href='{$_SERVER['PHP_SELF']}?view=all'>{$strShowAll}</a>

";
    }
    else
    {
        echo "<p class='info'>{$strShowingAllArticles} - ";
        echo "<a href='{$_SERVER['PHP_SELF']}'>{$strShowOnlyRelevant}</a>

";
    }
}
$sql .= "GROUP BY k.docid ";
No tags attached.
Issue History
2015-06-15 06:29rockellNew Issue
2015-11-01 12:33paulhNote Added: 0004983
2015-11-01 12:33paulhAssigned To => paulh
2015-11-01 12:33paulhStatusnew => confirmed
2015-11-01 12:45paulhNote Added: 0004984
2015-11-01 12:45paulhStatusconfirmed => resolved
2015-11-01 12:45paulhResolutionopen => fixed
2015-11-01 12:45paulhFixed in Version => Current GIT

Notes
(0004983)
paulh   
2015-11-01 12:33   
Thanks for this, reproduced in current git
(0004984)
paulh   
2015-11-01 12:45   
4570303eb2853c70dde208b777aa3f097c5b6e9d fixes