diff --git a/ajax/getObjectsView.php b/ajax/getObjectsView.php
index 422690c..1b42d8f 100644
--- a/ajax/getObjectsView.php
+++ b/ajax/getObjectsView.php
@@ -2832,6 +2832,24 @@ if ($_SESSION['id']) {
}
// LEFT JOIN rayon rayon on objects.rayon = rayon.id
+ // Формируем список сделок объектов
+ $objectDealsArray = [];
+ $objIds = array_column($objSphinx, 'id');
+ if (!empty($objIds)) {
+ $objIdsStr = implode(',', array_map('intval', $objIds));
+ $dealsRes = mysql_query("SELECT side_one_object_id, side_two_object_id FROM deals WHERE status != 2 AND (side_one_object_id IN ($objIdsStr) OR side_two_object_id IN ($objIdsStr))");
+ if ($dealsRes && mysql_num_rows($dealsRes) > 0) {
+ while ($dealRow = mysql_fetch_assoc($dealsRes)) {
+ if (in_array((int)$dealRow['side_one_object_id'], $objIds)) {
+ $objectDealsArray[$dealRow['side_one_object_id']] = 1;
+ }
+ if (in_array((int)$dealRow['side_two_object_id'], $objIds)) {
+ $objectDealsArray[$dealRow['side_two_object_id']] = 1;
+ }
+ }
+ }
+ }
+
$objectsFound = [];
if($post['view'] == 'table'){
foreach($objSphinx as $obj){
diff --git a/my-objects.php b/my-objects.php
index 42a5d17..6d0fdd7 100644
--- a/my-objects.php
+++ b/my-objects.php
@@ -1065,6 +1065,21 @@ if($_SESSION['id'] == 5238){
return sort_order;
}
+ function openObjectDealFromList(objectId) {
+ $.ajax({
+ url: '/ajax/ajax_vue_requisitions.php',
+ type: 'POST',
+ contentType: 'application/json',
+ data: JSON.stringify({ request: 'get_deal_by_object', object_id: objectId }),
+ success: function(response) {
+ var res = typeof response === 'string' ? JSON.parse(response) : response;
+ if (res.deals && res.deals.length > 0) {
+ window.editDeal(0, res.deals[0]);
+ }
+ }
+ });
+ }
+
function checkDealType() {
$('.crm__filters .crm__filter-popup .filter-popup__left .filter-popup-type').each(function() {
if($(this).attr("data-id") == 'sale') {
@@ -1187,6 +1202,13 @@ if($_SESSION['id'] == 5238){
+';
+ echo '';
+ }
+?>
diff --git a/templates/system__object_new.php b/templates/system__object_new.php
index 58eab65..12946e1 100644
--- a/templates/system__object_new.php
+++ b/templates/system__object_new.php
@@ -547,6 +547,11 @@ if (isset($fromArchList) && $fromArchList && $obj['archive'] == 0) { echo " acti