.
*/
require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php");
$_SESSION['error'] = "";
$core_tools = new core_tools();
$func = new functions();
$db = new dbquery();
$core_tools->load_lang();
$db->connect();
$what = $_REQUEST['what'];
$value = $_REQUEST['value'];
switch ($what)
{
case 'showHideBox':
$_SESSION['postindexing']['showHideBox'] = $value;
echo "{status : 'true' , what : '".$what."'}";
break;
case 'addNote':
if (strlen(trim($_REQUEST['notes'])) > 0)
{
//Get the table
if(!empty($_SESSION['current_basket']['view']))
{
$table = $_SESSION['current_basket']['view'];
}
else
{
$table = $_SESSION['current_basket']['table'];
}
$coll_id = $_SESSION['current_basket']['coll_id'];
$basket_id = $_SESSION['current_basket']['id'];
$res_id = $_REQUEST['rid'];
$text = $func->protect_string_db($_REQUEST['notes']);
$sql = "INSERT INTO ".$_SESSION['tablename']['not_notes']."
( identifier, note_text, date_note, user_id, coll_id, tablename) VALUES (
".$res_id.",
'".$text."',
'".date("Y")."-".date("m")."-".date("d")." ".date("H:i:s")."',
'".$_SESSION['user']['UserId']."',
'".$_SESSION['tablename']['postindexing_collection']."',
'".$basket_id."')";
$db->query($sql);
if($_SESSION['history']['noteadd'])
{
$hist = new history();
$hist->add($table, $res_id, "ADD", 'noteadd', _POSTINDEXING_NOTE_ADDED._ON_DOC_NUM.$res_id , $_SESSION['config']['databasetype'],'notes');
}
$divContent = '
';
$divContent .= ''._VIEW_POSTINDEXING_NOTE.'';
//echo $sql;
echo "{status : 'true' , what : '".$what."', noteDiv : 'notebox', divLink : 'div_add_note', divLinkContent : '".addslashes($divContent)."'}";
}
else
{
echo "{status : 'false' , what : '".$what."' , errorMsg: '"._POSTINDEXING_NOTE_MANDATORY."'}";
}
break;
case 'viewNote':
if(!empty($_SESSION['current_basket']['view']))
{
$table = $_SESSION['current_basket']['view'];
}
else
{
$table = $_SESSION['current_basket']['table'];
}
$coll_id = $_SESSION['current_basket']['coll_id'];
$basket_id = $_SESSION['current_basket']['id'];
$res_id = $_REQUEST['resId'];
$db->query("select n.date_note, n.user_id, n.note_text, u.lastname, u.firstname from ".$_SESSION['tablename']['not_notes']." n
inner join ".$_SESSION['tablename']['users']." u on n.user_id = u.user_id
where n.identifier = ".$res_id." and tablename = '".$basket_id."' and coll_id = '".$_SESSION['tablename']['postindexing_collection']."'");
$divContent = '';
if($db->nb_result() != 0)
{
$line = $db->fetch_object();
$user = $func->show_string($line->lastname." ".$line->firstname);
$text = $func->show_string($line->note_text);
$user_id = $line->user_id;
$date = $line->date_note;
$divContent .= ''._POSTINDEXING_NOTE_OF.': '.$user.' ('.$date.')';
$divContent .= '