From f6d4f440ec10f226d800f2686d4e4ded97e29fde Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Mon, 2 May 2016 18:18:37 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20media?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/modules/media/Media.class.php | 22 ++++++++++++++++--- framework | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/application/classes/modules/media/Media.class.php b/application/classes/modules/media/Media.class.php index c842630f..c252f778 100644 --- a/application/classes/modules/media/Media.class.php +++ b/application/classes/modules/media/Media.class.php @@ -892,16 +892,32 @@ class ModuleMedia extends ModuleORM * @param string $sTargetType * @param string $sTargetId * @param null|string $sTargetTmp Если не задан, то берется их куки "media_target_tmp_{$sTargetType}" + * @param null|array $aMediaId Необязательный список конкретных media id */ - public function ReplaceTargetTmpById($sTargetType, $sTargetId, $sTargetTmp = null) + public function ReplaceTargetTmpById($sTargetType, $sTargetId, $sTargetTmp = null, $aMediaId = null) { $sCookieKey = 'media_target_tmp_' . $sTargetType; if (is_null($sTargetTmp) and $this->Session_GetCookie($sCookieKey)) { $sTargetTmp = $this->Session_GetCookie($sCookieKey); - $this->Session_DropCookie($sCookieKey); + if (is_null($aMediaId)) { + $this->Session_DropCookie($sCookieKey); + } } if (is_string($sTargetTmp)) { - $aTargetItems = $this->Media_GetTargetItemsByTargetTmpAndTargetType($sTargetTmp, $sTargetType); + $aFilter = array( + 'target_tmp' => $sTargetTmp, + 'target_type' => $sTargetType, + ); + if (!is_null($aMediaId)) { + $aNeedId = array(-1); + foreach ($aMediaId as $sId) { + if (is_numeric($sId)) { + $aNeedId[] = $sId; + } + } + $aFilter['media_id in'] = $aNeedId; + } + $aTargetItems = $this->Media_GetTargetItemsByFilter($aFilter); foreach ($aTargetItems as $oTarget) { $oTarget->setTargetTmp(null); $oTarget->setTargetId($sTargetId); diff --git a/framework b/framework index 6356bef5..fdea754c 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 6356bef5db69816a14b694584a22734b41d04628 +Subproject commit fdea754cd868d74cb2e09f13550f95c69b3e5867