22if (!defined(
'NOTOKENRENEWAL')) {
23 define(
'NOTOKENRENEWAL',
'1');
25if (!defined(
'NOREQUIREHTML')) {
26 define(
'NOREQUIREHTML',
'1');
28if (!defined(
'NOREQUIREAJAX')) {
29 define(
'NOREQUIREAJAX',
'1');
31if (!defined(
'NOREQUIRESOC')) {
32 define(
'NOREQUIRESOC',
'1');
35if (!defined(
'NOREQUIREMENU')) {
36 define(
'NOREQUIREMENU',
'1');
39if (!empty($_GET[
'public'])) {
40 if (!defined(
"NOLOGIN")) {
41 define(
"NOLOGIN",
'1');
44if (!defined(
'NOIPCHECK')) {
45 define(
'NOIPCHECK',
'1');
47if (!defined(
'NOBROWSERNOTIF')) {
48 define(
'NOBROWSERNOTIF',
'1');
50include
'../../main.inc.php';
52$action =
GETPOST(
'action',
'aZ09');
53$idticketgroup =
GETPOST(
'idticketgroup',
'aZ09');
54$idticketgroup =
GETPOST(
'idticketgroup',
'aZ09');
58if (!defined(
"NOLOGIN")) {
59 restrictedArea($user,
'knowledgemanagement', 0,
'knowledgemanagement_knowledgerecord',
'knowledgerecord');
76if ($action ==
"getKnowledgeRecord") {
78 $sql =
"SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code";
79 $sql .=
" FROM ".MAIN_DB_PREFIX.
"knowledgemanagement_knowledgerecord as kr ";
80 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
81 $sql .=
" WHERE ctc.code = '".$db->escape($idticketgroup).
"'";
82 $sql .=
" AND ctc.active = 1";
83 if (defined(
"NOLOGIN")) {
84 $sql .=
" AND ctc.public = 1";
86 $sql .=
" AND (kr.lang = '".$db->escape($lang).
"' OR kr.lang = 0 OR kr.lang IS NULL)";
87 $sql .=
" AND kr.status = 1 AND (kr.answer IS NOT NULL AND kr.answer <> '')";
89 $resql = $db->query($sql);
91 $num = $db->num_rows($resql);
95 $obj = $db->fetch_object($resql);
96 $response[] = array(
'title'=>$obj->question,
'ref'=>$obj->ref,
'answer'=>
dol_escape_htmltag(preg_replace(
'/\\r|\\r\\n|\\n/',
"", $obj->answer)),
'url'=>$obj->url);
102 $response =json_encode($response);
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.