function get_kbdoc_body($kbdoc_id, $is_revision = false) { if (empty($kbdoc_id)) { return null; } $db = DBManagerFactory::getInstance(); if ($is_revision) { //if content is under a revision. old query //$query="select kbdocument_body from kbcontents where document_revision_id in // ( select id from document_revisions where kbdocument_revision_id in(select id from kbdocument_revisions where kbdocument_id = '$kbdoc_id'))"; //new query $query = "select kbdocument_body from kbcontents where document_revision_id in\n\t\t\t\t\t(select document_revision_id from kbdocument_revisions where kbdocument_id = '{$kbdoc_id}' and deleted=0) and deleted=0"; } else { //if content is under the main document. old query //$query="select kbdocument_body from kbcontents where id in // ( select kbcontent_id from kbdocument_revisions where kbdocument_id = '$kbdoc_id')"; //new query $query = "select kbdocument_body from kbcontents where id in\n\t\t\t\t(select kbcontent_id from kbdocument_revisions where kbdocument_id = '{$kbdoc_id}' and deleted=0 and latest=1) and deleted=0"; } $result = $db->query($query); if (!empty($result)) { //increment count require_once 'modules/KBDocuments/SearchUtils.php'; updateKBView($kbdoc_id); $row = $db->fetchByAssoc($result); if (!empty($row)) { $body = $row['kbdocument_body']; return $body; } } return null; }
* install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ //Request object must have these property values: // Module: module name, this module should have a file called TreeData.php // Function: name of the function to be called in TreeData.php, the function will be called statically. // PARAM prefixed properties: array of these property/values will be passed to the function as parameter. require_once 'include/JSON.php'; require_once 'include/upload_file.php'; require_once 'vendor/ytree/Tree.php'; require_once 'vendor/ytree/Node.php'; require_once 'modules/KBTags/TreeData.php'; $json = getJSONobj(); $kb_id = $json->decode(html_entity_decode($_REQUEST['selectedKBId'])); if (isset($kb_id['jsonObject']) && $kb_id['jsonObject'] != null) { $kb_id = $kb_id['jsonObject']; } if (!empty($kb_id)) { require_once "modules/KBDocuments/SearchUtils.php"; updateKBView($kb_id); } $response = $kb_id; if (!empty($response)) { echo $response; //$json = getJSONobj(); //print $json->encode($response); //return the parameters } sugar_cleanup(); exit;