/** * Overridden delete method to remove job details (logs) from newsletter logs table * before deleting newsletter job * * @param $iItemID int specifies the frontend user group */ public function delete($iItemID) { $oLogs = new cNewsletterLogCollection(); $oLogs->delete($iItemID); parent::delete($iItemID); }
/** * Overriden delete function to update recipient count if removing recipient from the list * @param integer $idnewslog ID */ public function delete($idnewslog) { $idnewslog = Contenido_Security::toInteger($idnewslog); $oLog = new cNewsletterLog($idnewslog); $iIDNewsJob = $oLog->get("idnewsjob"); unset($oLog); $oJob = new cNewsletterJob($iIDNewsJob); $oJob->set("rcpcount", $oJob->get("rcpcount") - 1); $oJob->store(); unset($oJob); parent::delete($idnewslog); }
/** * Deletes all corresponding informations to this workflow and delegate call to parent * @param integer $idWorkflow - id of workflow to delete */ function delete($idWorkflow) { global $cfg; $oDb = new DB_Contenido(); $aItemIdsDelete = array(); $sSql = 'SELECT idworkflowitem FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aItemIdsDelete, Contenido_Security::escapeDB($oDb->f('idworkflowitem'), $oDb)); } $aUserSequencesDelete = array(); $sSql = 'SELECT idusersequence FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aUserSequencesDelete, Contenido_Security::escapeDB($oDb->f('idusersequence'), $oDb)); } $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_actions"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_allocation"] . ' WHERE idworkflow = ' . Contenido_Security::toInteger($idWorkflow) . ';'; $oDb->query($sSql); $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_art_allocation"] . ' WHERE idusersequence in (' . implode(',', $aUserSequencesDelete) . ');'; $oDb->query($sSql); parent::delete($idWorkflow); }
/** * Overridden delete method to remove groups from groupmember table * before deleting group * * @param $itemID int specifies the newsletter recipient group */ public function delete($itemID) { $oAssociations = new RecipientGroupMemberCollection(); $oAssociations->setWhere("idnewsgroup", $itemID); $oAssociations->query(); while ($oItem = $oAssociations->next()) { $oAssociations->delete($oItem->get("idnewsgroupmember")); } parent::delete($itemID); }
function delete($idallocation) { global $cfg, $lang; $obj = new WorkflowAllocation(); $obj->loadByPrimaryKey($idallocation); $idcatlang = $obj->get("idcatlang"); $db = new DB_Contenido(); $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'"; $db->query($sql); $db->next_record(); $idcat = $db->f("idcat"); $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); while ($db->next_record()) { $idarts[] = $db->f("idart"); } $idartlangs = array(); if (is_array($idarts)) { foreach ($idarts as $idart) { $sql = "SELECT idartlang FROM " . $cfg["tab"]["art_lang"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' and idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); if ($db->next_record()) { $idartlangs[] = $db->f("idartlang"); } } } $workflowArtAllocation = new WorkflowArtAllocation(); $workflowArtAllocations = new WorkflowArtAllocations(); foreach ($idartlangs as $idartlang) { $workflowArtAllocation->loadBy("idartlang", $idartlang); $workflowArtAllocations->delete($workflowArtAllocation->get("idartallocation")); } parent::delete($idallocation); }
function updateArtAllocation($idworkflowitem, $delete = false) { global $idworkflow, $cfg; $oDb = new DB_Contenido(); $aUserSequences = array(); $sSql = 'SELECT idusersequence FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem = ' . Contenido_Security::escapeDB($idworkflowitem, $oDb) . ';'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aUserSequences, Contenido_Security::escapeDB($oDb->f('idusersequence'), $oDb)); } $aIdArtLang = array(); if (count($aUserSequences) > 0) { $sSql = 'SELECT idartlang FROM ' . $cfg["tab"]["workflow_art_allocation"] . ' WHERE idusersequence in (' . implode(',', $aUserSequences) . ');'; $oDb->query($sSql); while ($oDb->next_record()) { array_push($aIdArtLang, $oDb->f('idartlang')); } $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_art_allocation"] . ' WHERE idusersequence in (' . implode(',', $aUserSequences) . ');'; $oDb->query($sSql); } if ($delete) { parent::delete($idworkflowitem); } foreach ($aIdArtLang as $iIdArtLang) { setUserSequence($iIdArtLang, $idworkflow); } }