diff --git a/ajax/getClientLogForEventsNew.php b/ajax/getClientLogForEventsNew.php index a17e396..305f083 100644 --- a/ajax/getClientLogForEventsNew.php +++ b/ajax/getClientLogForEventsNew.php @@ -1130,28 +1130,44 @@ ORDER BY date_sort ASC"; Стороны сделки:
0) { $row_req1 = mysql_fetch_assoc($rez_req1); - $side1_name .= ': Заявка «' . htmlspecialchars($row_req1['name']) . '»'; + $side1_text .= ': Заявка «' . htmlspecialchars($row_req1['name']) . '»'; + if (!empty($row_req1['client_id'])) { + $sql_cl1 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req1['client_id']) . " LIMIT 1"; + $rez_cl1 = mysql_query($sql_cl1); + if ($rez_cl1 && mysql_num_rows($rez_cl1) > 0) { + $row_cl1 = mysql_fetch_assoc($rez_cl1); + $side1_text .= ' — ' . htmlspecialchars($row_cl1['fio']) . ''; + } + } } } - echo '' . $side1_name . '
'; + echo '' . $side1_text . '
'; // Сторона 2 - $side2_name = htmlspecialchars($deal_data['side_two']); + $side2_text = htmlspecialchars($deal_data['side_two']); if (!empty($deal_data['side_two_requisition_id'])) { - $sql_req2 = "SELECT name FROM requisitions WHERE id = " . intval($deal_data['side_two_requisition_id']) . " LIMIT 1"; + $sql_req2 = "SELECT name, client_id FROM requisitions WHERE id = " . intval($deal_data['side_two_requisition_id']) . " LIMIT 1"; $rez_req2 = mysql_query($sql_req2); if ($rez_req2 && mysql_num_rows($rez_req2) > 0) { $row_req2 = mysql_fetch_assoc($rez_req2); - $side2_name .= ': Заявка «' . htmlspecialchars($row_req2['name']) . '»'; + $side2_text .= ': Заявка «' . htmlspecialchars($row_req2['name']) . '»'; + if (!empty($row_req2['client_id'])) { + $sql_cl2 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req2['client_id']) . " LIMIT 1"; + $rez_cl2 = mysql_query($sql_cl2); + if ($rez_cl2 && mysql_num_rows($rez_cl2) > 0) { + $row_cl2 = mysql_fetch_assoc($rez_cl2); + $side2_text .= ' — ' . htmlspecialchars($row_cl2['fio']) . ''; + } + } } } - echo '' . $side2_name . ''; + echo '' . $side2_text . ''; ?>