vtenext/modules/Faq/DetailViewAjax.php
2021-04-28 20:10:26 +02:00

56 lines
1.5 KiB
PHP

<?php
/*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only
************************************/
// crmv@67410
global $currentModule, $current_user;
$modObj = CRMEntity::getInstance($currentModule);
$ajaxaction = $_REQUEST["ajxaction"];
if($ajaxaction == "DETAILVIEW")
{
$crmid = $_REQUEST["recordid"];
$tablename = $_REQUEST["tableName"];
$fieldname = $_REQUEST["fldName"];
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
if($crmid != "")
{
$permEdit = isPermitted($currentModule, 'DetailViewAjax', $crmid);
$permField = getFieldVisibilityPermission($currentModule, $current_user->id, $fieldname);
if ($permEdit == 'yes' && $permField == 0) {
$modObj->retrieve_entity_info($crmid,$currentModule);
//Added to avoid the comment save, when we edit other fields through ajax edit
if($fieldname != 'comments')
$modObj->column_fields['comments'] = '';
$modObj->column_fields[$fieldname] = $fieldvalue;
$modObj->id = $crmid;
$modObj->mode = "edit";
$modObj->save($currentModule);
if($modObj->id != "") {
if($fieldname == "comments") {
$comments = $modObj->getFAQComments($modObj->id);
echo ":#:SUCCESS".$comments;
} else {
echo ":#:SUCCESS";
}
} else {
echo ":#:FAILURE";
}
} else {
echo ":#:FAILURE";
}
}else
{
echo ":#:FAILURE";
}
}elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){
require_once 'include/ListView/RelatedListViewContents.php';
}
?>