Example #1
0
global $mod_strings, $timedate;
$mod_strings = return_module_language($current_language, 'KBDocuments');
$prefix = '';
$do_final_move = 0;
$KBDocument = BeanFactory::getBean('KBDocuments');
$KBRevision = BeanFactory::getBean('KBDocumentRevisions');
if (isset($_REQUEST['record'])) {
    $KBDocument->retrieve($_REQUEST['record']);
}
if (!$KBDocument->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
//Clean the HTML body before we start operating on input.
if (isset($_REQUEST['body_html'])) {
    $_REQUEST['body_html'] = SugarCleaner::getInstance()->cleanHtml($_REQUEST['body_html'], true);
}
$KBDocument = populateFromPost('', $KBDocument);
//set check_notify flag
$check_notify = false;
if (!empty($KBDocument->case_id)) {
    $KBDocument->parent_id = $KBDocument->case_id;
    $KBDocument->parent_type = "Cases";
}
if (!isset($_POST['is_external'])) {
    $KBDocument->is_external_article = 0;
} else {
    $KBDocument->is_external_article = 1;
}
if (isset($KBDocument->id)) {
    //retrieve the existing document before saving the current