AntonLV 8 ani în urmă
părinte
comite
d9e9262aba

+ 3 - 0
inc/classes/BxDolConnectionQuery.php

@@ -55,6 +55,9 @@ class BxDolConnectionQuery extends BxDolDb
     {
         $aResult = $this->getConnectedContentSQLPartsExt($sContentTable, $sContentField, $iInitiator, $isMutual);
         return array(
+            'fields' => array(
+                'added' => "`" . $aResult['join']['table_alias'] . "`.`added`"
+            ),
             'join' => $aResult['join']['type'] . " JOIN `" . $aResult['join']['table'] . "` AS `" . $aResult['join']['table_alias'] . "` ON (" . $aResult['join']['condition'] . ")",
         );
     }

+ 8 - 2
modules/boonex/notifications/classes/BxNtfsDb.php

@@ -80,7 +80,10 @@ class BxNtfsDb extends BxBaseModNotificationsDb
 					$oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
 
 					$aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
-					$sJoinClause .= ' ' . $aQueryParts['join'];
+					if(!empty($aQueryParts['join']))
+					    $sJoinClause .= ' ' . $aQueryParts['join'];
+					if(!empty($aQueryParts['fields']['added']))
+					    $sWhereClause .= "AND `{$this->_sTable}`.`date` > " . $aQueryParts['fields']['added'];
 
 					$sWhereClause .= "AND `{$this->_sTable}`.`action` <> 'replyPost' ";
 					break;
@@ -89,7 +92,10 @@ class BxNtfsDb extends BxBaseModNotificationsDb
                     $oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
 
 					$aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
-					$sJoinClause .= ' ' . str_replace('INNER', 'LEFT', $aQueryParts['join']);
+					if(!empty($aQueryParts['join']))
+					    $sJoinClause .= ' ' . str_replace('INNER', 'LEFT', $aQueryParts['join']);
+                    if(!empty($aQueryParts['fields']['added']))
+					    $sWhereClause .= "AND `{$this->_sTable}`.`date` > " . $aQueryParts['fields']['added'];
 
 					$sWhereClause .= $this->prepareAsString("AND ((NOT ISNULL(`c`.`content`) AND `{$this->_sTable}`.`action` <> 'replyPost') || (`{$this->_sTable}`.`owner_id` <> `{$this->_sTable}`.`object_owner_id` AND `{$this->_sTable}`.`object_owner_id`=?)) ", $aParams['owner_id']);
                     break;