if ($id_h == '') { Addincomming($id_p, $phone, $person_name, $type_id, $call_type_id, $product_type_id, $card_id, $department_id, $information_category_id, $information_sub_category_id, $production_category_id, $genre_id, $production_id, $content, $sum_pirce, $shipping_id, $module_id, $call_comment, $call_status_id, $task_department_id, $source_id, $c_date, $persons_id, $priority_id, $done_start_time, $done_end_time, $comment, $task_type_id, $status_2, $status_1); $incomming_call_id = mysql_fetch_array(mysql_query("SELECT id FROM incomming_call WHERE phone = '{$phone}' ORDER BY date DESC LIMIT 1")); if ($task_type_id > 0) { AddTask($incomming_call_id[0], $task_type_id, $task_department_id, $c_date, $done_start_time, $done_end_time, $comment, $persons_id, $priority_id); } } else { $inc_task_ch = mysql_fetch_assoc(mysql_query("SELECT id FROM task WHERE incomming_call_id = '{$id_p}'")); if ($inc_task_ch['id'] == '' and $task_type_id > 0) { AddTask($id_p, $task_type_id, $task_department_id, $c_date, $done_start_time, $done_end_time, $comment, $persons_id, $priority_id); } else { $user = $_SESSION['USERID']; $r_user = realuser($persons_id); mysql_query("UPDATE `task` SET `user_id`='{$user}',\n `responsible_user_id`='{$r_user}',\n `start_date`='{$done_start_time}',\n `end_date`='{$done_end_time}',\n `department_id`='{$task_department_id}',\n `task_type_id`='{$task_type_id}',\n `priority_id`='{$priority_id}',\n `comment`='{$comment}'\n WHERE `incomming_call_id`='{$id_p}'"); } Saveincomming($id_h, $phone, $person_name, $type_id, $call_type_id, $product_type_id, $card_id, $department_id, $information_category_id, $information_sub_category_id, $production_category_id, $genre_id, $production_id, $content, $sum_pirce, $shipping_id, $module_id, $call_comment, $call_status_id, $task_department_id, $source_id, $c_date, $persons_id, $priority_id, $done_start_time, $done_end_time, $comment, $task_type_id, $status_2, $status_1); } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'category_change': $information_category_id_check = $_REQUEST['information_category_id_check']; $data = array('cat' => Getinformation_sub_category('', $information_category_id_check)); break; case 'set_task_type': $cat_id = $_REQUEST['cat_id']; $data = array('cat' => Getbank_object($cat_id)); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}");
} } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['hidden_checker']; $task_type_id = $_REQUEST['task_type_id']; if ($incom_id == '') { Addincomming($call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment, $file, $rand_file, $hidden_inc); $incomming_call_id = mysql_insert_id(); if ($task_type_id != 0) { Addtask($incomming_call_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } } else { Saveincomming($call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment, $file, $rand_file, $hidden_inc); $check_task = mysql_fetch_assoc(mysql_query("SELECT id FROM task WHERE incomming_call_id = '{$incom_id}'")); if ($task_type_id != 0) { if ($check_task == '') { Addtask($incom_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } else { Savetask($check_task[id], $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } } } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}");
$data = array("aaData" => array()); while ($aRow = mysql_fetch_array($rResult)) { $row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = $aRow[$i]; } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id_check = $_REQUEST['id_h']; if ($incom_id_check == '') { Addincomming($c_date, $id_p, $phone, $person_name, $type, $results_id, $information_category_id, $information_sub_category_id, $content_id, $product_id, $forward_id, $connect, $results_comment, $content, $task_type_id, $task_department_id, $persons_id, $comment, $call_vote, $source_id); } else { Saveincomming($c_date, $id_p, $phone, $person_name, $type, $results_id, $information_category_id, $information_sub_category_id, $content_id, $product_id, $forward_id, $connect, $results_comment, $content, $task_type_id, $task_department_id, $persons_id, $comment, $call_vote, $source_id); } break; case 'send_mail': $c_date = $_REQUEST['c_date']; Sendmail($c_date, $phone, $results_id, $results_comment, $content, $product_id, $call_vote); break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'category_change': $information_category_id_check = $_REQUEST['information_category_id_check']; $data = array('cat' => Getinformation_sub_category('', $information_category_id_check)); break; case 'set_task_type': $cat_id = $_REQUEST['cat_id'];
} $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; $task_type_id = $_REQUEST['task_type_id']; if ($incom_id == '') { Addincomming($phone, $call_type_id, $category_id, $category_parent_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $problem_date, $call_content, $file, $rand_file, $hidden_inc); $incomming_call_id = mysql_insert_id(); if ($task_type_id != 0) { Addtask($incomming_call_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $comment); } Addsite_user($incomming_call_id, $personal_pin, $friend_pin, $personal_id); } else { Saveincomming($call_type_id, $phone, $category_id, $category_parent_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $problem_date, $call_content, $file, $rand_file); Savetask($incom_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $comment); //Savesite_user($incom_id, $personal_pin, $name, $personal_phone, $mail, $personal_id); } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\r\n\t\t\t\t\t`rand_name`,\r\n\t\t\t\t\t`id`\r\n\t\t\t\t\tFROM \t`file`\r\n\t\t\t\t\tWHERE `incomming_call_id` = {$edit_id}\r\n\t\t\t\t\t"); $data1 = ''; while ($increm_row = mysql_fetch_assoc($increm)) { $data1 .= '<tr style="border-bottom: 1px solid #85b1de;"> <td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td> <td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td>
$count = $_REQUEST['count']; $hidden = $_REQUEST['hidden']; $rResult = mysql_query("SELECT incomming_call_log1.id,\n \t\tincomming_call_log1.change_date,\n IF(incomming_call_log1.change_status = 1,'დამატება','ცვლილება'),\n persons.`name`,\n CASE\n WHEN incomming_call_log1.row_name = 'name' THEN 'სახელი'\n \t\tWHEN incomming_call_log1.row_name = 'call_content' THEN 'დამატებითი ინფორმაცია'\n \t\tWHEN incomming_call_log1.row_name = 'call_status_id' THEN 'ზარის სტატუსი'\n END,\n incomming_call_log1.old_value,\n incomming_call_log1.new_value\n FROM `incomming_call_log1`\n JOIN users ON incomming_call_log1.change_user_id = users.id\n JOIN persons ON users.person_id = persons.id\n WHERE incomming_call_log1.asterisk_incomming_id = {$_REQUEST['inc_id']} AND incomming_call_log1.row_name != 'fan_status'\n ORDER BY id DESC"); $data = array("aaData" => array()); while ($aRow = mysql_fetch_array($rResult)) { $row = array(); for ($i = 0; $i < $count; $i++) { $row[] = $aRow[$i]; } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; $hidden_user = $_REQUEST['hidden_user']; Saveincomming($phone, $hidden_user, $call_status, $client_name, $call_content); $result = mysql_query(" SELECT task.id\n\t\t\t\t\t\t\t\tFROM task\n\t\t\t\t\t\t\t\tWHERE task.incomming_call_id = {$incom_id} AND task.actived=1"); $check = mysql_num_rows($result); if ($department_id != 0 && $check > 0) { Savetask($incom_id, $task_type_id, $priority, $department_id, $persons_id, $out_phone, $problem_comment); } else { if ($department_id != 0 && $check == 0) { Addtask($incom_id, $task_type_id, $priority, $department_id, $persons_id, $out_phone, $problem_comment); } } break; default: $error = 'Action is Null'; } $data['error'] = $error; echo json_encode($data);