|
@@ -68,11 +68,19 @@ class BxCnvDb extends BxBaseModTextDb
|
|
|
return $this->query($sQuery);
|
|
return $this->query($sQuery);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function deleteConvo($iConversationId, $iProfileId)
|
|
|
|
|
|
|
+ public function deleteConvo($iConversationId, $iProfileId = 0)
|
|
|
{
|
|
{
|
|
|
|
|
+ $aContentInfo = $this->getContentInfoById ($iConversationId);
|
|
|
|
|
+ if (!$aContentInfo)
|
|
|
|
|
+ return true;
|
|
|
|
|
+
|
|
|
// delete convo
|
|
// delete convo
|
|
|
- $sQuery = $this->prepare("DELETE FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ? AND `collaborator` = ?", $iConversationId, $iProfileId);
|
|
|
|
|
- if (!$this->query($sQuery))
|
|
|
|
|
|
|
+ $sWhere = '';
|
|
|
|
|
+ if ($iProfileId)
|
|
|
|
|
+ $sWhere = $this->prepare(" AND `collaborator` = ?", $iProfileId);
|
|
|
|
|
+
|
|
|
|
|
+ $sQuery = $this->prepare("DELETE FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ?", $iConversationId);
|
|
|
|
|
+ if (!$this->query($sQuery . $sWhere))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
// delete whole conversation if there is no refencences to the conversation in conv2folder table
|
|
// delete whole conversation if there is no refencences to the conversation in conv2folder table
|
|
@@ -81,7 +89,7 @@ class BxCnvDb extends BxBaseModTextDb
|
|
|
$CNF = &$this->_oConfig->CNF;
|
|
$CNF = &$this->_oConfig->CNF;
|
|
|
bx_import('BxDolForm');
|
|
bx_import('BxDolForm');
|
|
|
$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
|
|
$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
|
|
|
- return $oForm->delete((int)$iConversationId);
|
|
|
|
|
|
|
+ return $oForm->delete((int)$iConversationId, $aContentInfo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|