RomanL 8 лет назад
Родитель
Сommit
24e7b4106b

+ 6 - 0
modules/boonex/invites/classes/BxInvDb.php

@@ -116,6 +116,12 @@ class BxInvDb extends BxDolModuleDb
         return $this->query($sSql);
     }
     
+    public function deleteInvitesByAccount($aParams)
+    {
+        $sSql = "DELETE FROM `{$this->_sTableInvites}` WHERE " . $this->arrayToSQL($aParams, " AND ");
+        return $this->query($sSql);
+    }
+    
     public function attachInviteToRequest($iReqestId, $iInviteId)
     {
         $aBindings = array(

+ 5 - 0
modules/boonex/invites/classes/BxInvResponse.php

@@ -71,6 +71,11 @@ class BxInvResponse extends BxDolAlertsResponse
     {
         $this->_oModule->_oDb->deleteInvites(array('profile_id' => $oAlert->iObject));
     }
+    
+    protected function _processAccountDelete($oAlert)
+    {
+        $this->_oModule->_oDb->deleteInvitesByAccount(array('joined_account_id' => $oAlert->iObject));
+    }
 }
 
 /** @} */

+ 1 - 0
modules/boonex/invites/install/sql/enable.sql

@@ -111,4 +111,5 @@ SET @iHandler := LAST_INSERT_ID();
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('account', 'add_form', @iHandler),
 ('account', 'added', @iHandler),
+('account', 'delete', @iHandler),
 ('profile', 'delete', @iHandler);