function unlinkDependencies($module, $id) { global $log; parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; $sql = 'DELETE FROM vtiger_activity_reminder WHERE activity_id=?'; $this->db->pquery($sql, array($id)); $sql = 'DELETE FROM vtiger_recurringevents WHERE activityid=?'; $this->db->pquery($sql, array($id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; //Deleting Contact related Potentials. $pot_q = 'SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN vtiger_potential ON vtiger_crmentity.crmid=vtiger_potential.potentialid LEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_potential.related_to WHERE vtiger_crmentity.deleted=0 AND vtiger_potential.related_to=?'; $pot_res = $this->db->pquery($pot_q, array($id)); $pot_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($pot_res); $k++) { $pot_id = $this->db->query_result($pot_res, $k, "crmid"); $pot_ids_list[] = $pot_id; $sql = 'UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid = ?'; $this->db->pquery($sql, array($pot_id)); } //Backup deleted Contact related Potentials. $params = array($id, RB_RECORD_UPDATED, 'vtiger_crmentity', 'deleted', 'crmid', implode(",", $pot_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); //Backup Contact-Trouble Tickets Relation $tkt_q = 'SELECT ticketid FROM vtiger_troubletickets WHERE parent_id=?'; $tkt_res = $this->db->pquery($tkt_q, array($id)); if ($this->db->num_rows($tkt_res) > 0) { $tkt_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($tkt_res); $k++) { $tkt_ids_list[] = $this->db->query_result($tkt_res, $k, "ticketid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_troubletickets', 'parent_id', 'ticketid', implode(",", $tkt_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //removing the relationship of contacts with Trouble Tickets $this->db->pquery('UPDATE vtiger_troubletickets SET parent_id=0 WHERE parent_id=?', array($id)); //Backup Contact-PurchaseOrder Relation $po_q = 'SELECT purchaseorderid FROM vtiger_purchaseorder WHERE contactid=?'; $po_res = $this->db->pquery($po_q, array($id)); if ($this->db->num_rows($po_res) > 0) { $po_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($po_res); $k++) { $po_ids_list[] = $this->db->query_result($po_res, $k, "purchaseorderid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_purchaseorder', 'contactid', 'purchaseorderid', implode(",", $po_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //removing the relationship of contacts with PurchaseOrder $this->db->pquery('UPDATE vtiger_purchaseorder SET contactid=0 WHERE contactid=?', array($id)); //Backup Contact-SalesOrder Relation $so_q = 'SELECT salesorderid FROM vtiger_salesorder WHERE contactid=?'; $so_res = $this->db->pquery($so_q, array($id)); if ($this->db->num_rows($so_res) > 0) { $so_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($so_res); $k++) { $so_ids_list[] = $this->db->query_result($so_res, $k, "salesorderid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_salesorder', 'contactid', 'salesorderid', implode(",", $so_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //removing the relationship of contacts with SalesOrder $this->db->pquery('UPDATE vtiger_salesorder SET contactid=0 WHERE contactid=?', array($id)); //Backup Contact-Quotes Relation $quo_q = 'SELECT quoteid FROM vtiger_quotes WHERE contactid=?'; $quo_res = $this->db->pquery($quo_q, array($id)); if ($this->db->num_rows($quo_res) > 0) { $quo_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($quo_res); $k++) { $quo_ids_list[] = $this->db->query_result($quo_res, $k, "quoteid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_quotes', 'contactid', 'quoteid', implode(",", $quo_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //removing the relationship of contacts with Quotes $this->db->pquery('UPDATE vtiger_quotes SET contactid=0 WHERE contactid=?', array($id)); //remove the portal info the contact $this->db->pquery('DELETE FROM vtiger_portalinfo WHERE id = ?', array($id)); $this->db->pquery('UPDATE vtiger_customerdetails SET portal=0,support_start_date=NULL,support_end_date=NULl WHERE customerid=?', array($id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; $this->db->pquery('DELETE from vtiger_seproductsrel WHERE productid=? or crmid=?', array($id, $id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; /*//Backup Activity-Potentials Relation $act_q = "select activityid from vtiger_seactivityrel where crmid = ?"; $act_res = $this->db->pquery($act_q, array($id)); if ($this->db->num_rows($act_res) > 0) { for($k=0;$k < $this->db->num_rows($act_res);$k++) { $act_id = $this->db->query_result($act_res,$k,"activityid"); $params = array($id, RB_RECORD_DELETED, 'vtiger_seactivityrel', 'crmid', 'activityid', $act_id); $this->db->pquery("insert into vtiger_relatedlists_rb values (?,?,?,?,?,?)", $params); } } $sql = 'delete from vtiger_seactivityrel where crmid = ?'; $this->db->pquery($sql, array($id));*/ parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { $log = vglobal('log'); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; //Backup Campaigns-Product Relation $cmp_q = 'SELECT campaignid FROM vtiger_campaign WHERE product_id = ?'; $cmp_res = $this->db->pquery($cmp_q, array($id)); if ($this->db->num_rows($cmp_res) > 0) { $cmp_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($cmp_res); $k++) { $cmp_ids_list[] = $this->db->query_result($cmp_res, $k, "campaignid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_campaign', 'product_id', 'campaignid', implode(",", $cmp_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //we have to update the product_id as null for the campaigns which are related to this product $this->db->pquery('UPDATE vtiger_campaign SET product_id=0 WHERE product_id = ?', array($id)); $this->db->pquery('DELETE from vtiger_seproductsrel WHERE productid=? or crmid=?', array($id, $id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; /*//Backup Documents Related Records $se_q = 'SELECT crmid FROM vtiger_senotesrel WHERE notesid = ?'; $se_res = $this->db->pquery($se_q, array($id)); if ($this->db->num_rows($se_res) > 0) { for($k=0;$k < $this->db->num_rows($se_res);$k++) { $se_id = $this->db->query_result($se_res,$k,"crmid"); $params = array($id, RB_RECORD_DELETED, 'vtiger_senotesrel', 'notesid', 'crmid', $se_id); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } } $sql = 'DELETE FROM vtiger_senotesrel WHERE notesid = ?'; $this->db->pquery($sql, array($id));*/ parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { global $log; //Deleting Vendor related PO. $po_q = 'SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN vtiger_purchaseorder ON vtiger_crmentity.crmid=vtiger_purchaseorder.purchaseorderid INNER JOIN vtiger_vendor ON vtiger_vendor.vendorid=vtiger_purchaseorder.vendorid WHERE vtiger_crmentity.deleted=0 AND vtiger_purchaseorder.vendorid=?'; $po_res = $this->db->pquery($po_q, array($id)); $po_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($po_res); $k++) { $po_id = $this->db->query_result($po_res, $k, "crmid"); $po_ids_list[] = $po_id; $sql = 'UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid = ?'; $this->db->pquery($sql, array($po_id)); } //Backup deleted Vendors related Potentials. $params = array($id, RB_RECORD_UPDATED, 'vtiger_crmentity', 'deleted', 'crmid', implode(",", $po_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); //Backup Product-Vendor Relation $pro_q = 'SELECT productid FROM vtiger_products WHERE vendor_id=?'; $pro_res = $this->db->pquery($pro_q, array($id)); if ($this->db->num_rows($pro_res) > 0) { $pro_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($pro_res); $k++) { $pro_ids_list[] = $this->db->query_result($pro_res, $k, "productid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_products', 'vendor_id', 'productid', implode(",", $pro_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //Deleting Product-Vendor Relation. $pro_q = 'UPDATE vtiger_products SET vendor_id = 0 WHERE vendor_id = ?'; $this->db->pquery($pro_q, array($id)); /*//Backup Contact-Vendor Relaton $con_q = 'SELECT contactid FROM vtiger_vendorcontactrel WHERE vendorid = ?'; $con_res = $this->db->pquery($con_q, array($id)); if ($this->db->num_rows($con_res) > 0) { for($k=0;$k < $this->db->num_rows($con_res);$k++) { $con_id = $this->db->query_result($con_res,$k,"contactid"); $params = array($id, RB_RECORD_DELETED, 'vtiger_vendorcontactrel', 'vendorid', 'contactid', $con_id); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } } //Deleting Contact-Vendor Relaton $vc_sql = 'DELETE FROM vtiger_vendorcontactrel WHERE vendorid=?'; $this->db->pquery($vc_sql, array($id));*/ parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { $log = vglobal('log'); //Deleting Account related Potentials. $pot_q = 'SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN vtiger_potential ON vtiger_crmentity.crmid=vtiger_potential.potentialid LEFT JOIN vtiger_account ON vtiger_account.accountid=vtiger_potential.related_to WHERE vtiger_crmentity.deleted=0 AND vtiger_potential.related_to=?'; $pot_res = $this->db->pquery($pot_q, array($id)); $pot_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($pot_res); $k++) { $pot_id = $this->db->query_result($pot_res, $k, "crmid"); $pot_ids_list[] = $pot_id; $sql = 'UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid = ?'; $this->db->pquery($sql, array($pot_id)); } //Backup deleted Account related Potentials. $params = array($id, RB_RECORD_UPDATED, 'vtiger_crmentity', 'deleted', 'crmid', implode(",", $pot_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); //Deleting Account related Quotes. $quo_q = 'SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN vtiger_quotes ON vtiger_crmentity.crmid=vtiger_quotes.quoteid INNER JOIN vtiger_account ON vtiger_account.accountid=vtiger_quotes.accountid WHERE vtiger_crmentity.deleted=0 AND vtiger_quotes.accountid=?'; $quo_res = $this->db->pquery($quo_q, array($id)); $quo_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($quo_res); $k++) { $quo_id = $this->db->query_result($quo_res, $k, "crmid"); $quo_ids_list[] = $quo_id; $sql = 'UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid = ?'; $this->db->pquery($sql, array($quo_id)); } //Backup deleted Account related Quotes. $params = array($id, RB_RECORD_UPDATED, 'vtiger_crmentity', 'deleted', 'crmid', implode(",", $quo_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); //Backup Contact-Account Relation $con_q = 'SELECT contactid FROM vtiger_contactdetails WHERE parentid = ?'; $con_res = $this->db->pquery($con_q, array($id)); if ($this->db->num_rows($con_res) > 0) { $con_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($con_res); $k++) { $con_ids_list[] = $this->db->query_result($con_res, $k, "contactid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_contactdetails', 'parentid', 'contactid', implode(",", $con_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); } //Deleting Contact-Account Relation. $con_q = 'UPDATE vtiger_contactdetails SET parentid = 0 WHERE parentid = ?'; $this->db->pquery($con_q, array($id)); //Backup Trouble Tickets-Account Relation $tkt_q = 'SELECT ticketid FROM vtiger_troubletickets WHERE parent_id = ?'; $tkt_res = $this->db->pquery($tkt_q, array($id)); if ($this->db->num_rows($tkt_res) > 0) { $tkt_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($tkt_res); $k++) { $tkt_ids_list[] = $this->db->query_result($tkt_res, $k, "ticketid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_troubletickets', 'parent_id', 'ticketid', implode(",", $tkt_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); } //Deleting Trouble Tickets-Account Relation. $tt_q = 'UPDATE vtiger_troubletickets SET parent_id = 0 WHERE parent_id = ?'; $this->db->pquery($tt_q, array($id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { $log = vglobal('log'); //Backup Contact-Account Relation $con_q = 'SELECT contactid FROM vtiger_contactdetails WHERE parentid = ?'; $con_res = $this->db->pquery($con_q, array($id)); if ($this->db->num_rows($con_res) > 0) { $con_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($con_res); $k++) { $con_ids_list[] = $this->db->query_result($con_res, $k, "contactid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_contactdetails', 'parentid', 'contactid', implode(",", $con_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); } //Deleting Contact-Account Relation. $con_q = 'UPDATE vtiger_contactdetails SET parentid = 0 WHERE parentid = ?'; $this->db->pquery($con_q, array($id)); //Backup Trouble Tickets-Account Relation $tkt_q = 'SELECT ticketid FROM vtiger_troubletickets WHERE parent_id = ?'; $tkt_res = $this->db->pquery($tkt_q, array($id)); if ($this->db->num_rows($tkt_res) > 0) { $tkt_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($tkt_res); $k++) { $tkt_ids_list[] = $this->db->query_result($tkt_res, $k, "ticketid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_troubletickets', 'parent_id', 'ticketid', implode(",", $tkt_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES(?,?,?,?,?,?)', $params); } //Deleting Trouble Tickets-Account Relation. $tt_q = 'UPDATE vtiger_troubletickets SET parent_id = 0 WHERE parent_id = ?'; $this->db->pquery($tt_q, array($id)); parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { $log = vglobal('log'); //Backup Product-Vendor Relation $pro_q = 'SELECT productid FROM vtiger_products WHERE vendor_id=?'; $pro_res = $this->db->pquery($pro_q, array($id)); if ($this->db->num_rows($pro_res) > 0) { $pro_ids_list = array(); for ($k = 0; $k < $this->db->num_rows($pro_res); $k++) { $pro_ids_list[] = $this->db->query_result($pro_res, $k, "productid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_products', 'vendor_id', 'productid', implode(",", $pro_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //Deleting Product-Vendor Relation. $pro_q = 'UPDATE vtiger_products SET vendor_id = 0 WHERE vendor_id = ?'; $this->db->pquery($pro_q, array($id)); /*//Backup Contact-Vendor Relaton $con_q = 'SELECT contactid FROM vtiger_vendorcontactrel WHERE vendorid = ?'; $con_res = $this->db->pquery($con_q, array($id)); if ($this->db->num_rows($con_res) > 0) { for($k=0;$k < $this->db->num_rows($con_res);$k++) { $con_id = $this->db->query_result($con_res,$k,"contactid"); $params = array($id, RB_RECORD_DELETED, 'vtiger_vendorcontactrel', 'vendorid', 'contactid', $con_id); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } } //Deleting Contact-Vendor Relaton $vc_sql = 'DELETE FROM vtiger_vendorcontactrel WHERE vendorid=?'; $this->db->pquery($vc_sql, array($id));*/ parent::unlinkDependencies($module, $id); }
function unlinkDependencies($module, $id) { $log = vglobal('log'); //Backup Contact-Trouble Tickets Relation /* $tkt_q = 'SELECT ticketid FROM vtiger_troubletickets WHERE contact_id=?'; $tkt_res = $this->db->pquery($tkt_q, array($id)); if ($this->db->num_rows($tkt_res) > 0) { $tkt_ids_list = array(); for($k=0;$k < $this->db->num_rows($tkt_res);$k++) { $tkt_ids_list[] = $this->db->query_result($tkt_res,$k,"ticketid"); } $params = array($id, RB_RECORD_UPDATED, 'vtiger_troubletickets', 'contact_id', 'ticketid', implode(",", $tkt_ids_list)); $this->db->pquery('INSERT INTO vtiger_relatedlists_rb VALUES (?,?,?,?,?,?)', $params); } //removing the relationship of contacts with Trouble Tickets $this->db->pquery('UPDATE vtiger_troubletickets SET contact_id=0 WHERE contact_id=?', array($id)); */ //remove the portal info the contact $this->db->pquery('DELETE FROM vtiger_portalinfo WHERE id = ?', array($id)); $this->db->pquery('UPDATE vtiger_customerdetails SET portal=0,support_start_date=NULL,support_end_date=NULl WHERE customerid=?', array($id)); parent::unlinkDependencies($module, $id); }