24 lines
635 B
PHP
24 lines
635 B
PHP
|
|
<?php
|
||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
||
|
|
|
||
|
|
$idAgent = (int)$_SESSION['id'];
|
||
|
|
|
||
|
|
// Search text, need check
|
||
|
|
$clients = isset($_POST['clients']) ? array_map('intval', $_POST['clients']) : [];
|
||
|
|
|
||
|
|
$sql = "SELECT id, name, client_id FROM requisitions WHERE client_id IN (" . implode(',', $clients) .") AND who_work = $idAgent AND deleted <> 1 AND cancel = 0";
|
||
|
|
$rez = mysql_query($sql);
|
||
|
|
|
||
|
|
$response = [];
|
||
|
|
$response['requests'] = [];
|
||
|
|
|
||
|
|
while ($request = mysql_fetch_assoc($rez)) {
|
||
|
|
$response['requests'][] = [
|
||
|
|
"id" => $request['id'],
|
||
|
|
"text" => $request['name'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
echo json_encode($response);
|
||
|
|
exit();
|