Просмотр исходного кода

Ticket #4558 - Build-in API support: Connections validation.

AntonLV 2 лет назад
Родитель
Сommit
395e5de95a

+ 6 - 2
template/scripts/BxBaseProfileSearchResult.php

@@ -245,8 +245,12 @@ class BxBaseProfileSearchResult extends BxTemplSearchResult
         $aResult = [];
 
         foreach ($a as $index => $aItem) 
-            if(($oProfile = BxDolProfile::getInstance($aItem['id'])) !== false)
-                $aResult[] = $oProfile->getUnitAPI();
+            if(($oProfile = BxDolProfile::getInstance($aItem['id'])) !== false) {
+                $aUnitApi = $oProfile->getUnitAPI();
+                $aUnitApi['id'] = $aItem['id'];
+
+                $aResult[] = $aUnitApi;
+            }
 
         return $aResult;
     }

+ 6 - 2
template/scripts/BxBaseRecommendation.php

@@ -82,8 +82,12 @@ class BxBaseRecommendation extends BxDolRecommendation
                 $aItems = $this->_oDb->get($iProfileId, $this->_aObject['id'], $aParams);
 
             $aData = [];
-            foreach($aItems as $iId => $iCount)
-                $aData[] = $this->getCodeItem($iId, $iCount);
+            foreach($aItems as $iId => $iCount) {
+                $aItem = $this->getCodeItem($iId, $iCount);
+                $aItem['id'] = $iId;
+
+                $aData[] = $aItem;
+            }
         }
         else
             $aData = $this->validate($iProfileId, $aParams);