Skip to content
Snippets Groups Projects
Commit 2c8f7afb authored by Apparao G's avatar Apparao G
Browse files

#Fixes::158108634::Appu::When we unlink the record from the relative tab ,it...

#Fixes::158108634::Appu::When we unlink the record from the relative tab ,it is deleting from the source module too
parents b325fa44 63c2de5e
No related branches found
No related tags found
1 merge request!948#Fixes::158108634::Appu::When we unlink the record from the relative tab ,it is deleting from the source module too
......@@ -514,27 +514,27 @@ class PurchaseOrder extends CRMEntity {
// Function to unlink an entity with given Id from another entity
function unlinkRelationship($id, $return_module, $return_id) {
global $log;
if(empty($return_module) || empty($return_id)) return;
if($return_module == 'Vendors') {
$sql_req ='UPDATE vtiger_crmentity SET deleted = 1 WHERE crmid= ?';
$this->db->pquery($sql_req, array($id));
} elseif($return_module == 'Contacts') {
$sql_req ='UPDATE vtiger_purchaseorder SET contactid=? WHERE purchaseorderid = ?';
$this->db->pquery($sql_req, array(null, $id));
} elseif($return_module == 'Documents') {
$sql = 'DELETE FROM vtiger_senotesrel WHERE crmid=? AND notesid=?';
$this->db->pquery($sql, array($id, $return_id));
} elseif($return_module == 'Accounts') {
$sql ='UPDATE vtiger_purchaseorder SET accountid=? WHERE purchaseorderid=?';
$this->db->pquery($sql, array(null, $id));
} else {
parent::unlinkRelationship($id, $return_module, $return_id);
}
}
function insertIntoEntityTable($table_name, $module, $fileid = '') {
global $log;
if (empty($return_module) || empty($return_id)) return;
if ($return_module == 'Vendors') {
$sql_req = 'UPDATE vtiger_purchaseorder SET vendorid = ? WHERE purchaseorderid = ?';
$this->db->pquery($sql_req, array(null, $id));
} elseif ($return_module == 'Contacts') {
$sql_req = 'UPDATE vtiger_purchaseorder SET contactid=? WHERE purchaseorderid = ?';
$this->db->pquery($sql_req, array(null, $id));
} elseif ($return_module == 'Documents') {
$sql = 'DELETE FROM vtiger_senotesrel WHERE crmid=? AND notesid=?';
$this->db->pquery($sql, array($id, $return_id));
} elseif ($return_module == 'Accounts') {
$sql = 'UPDATE vtiger_purchaseorder SET accountid = ? WHERE purchaseorderid = ?';
$this->db->pquery($sql, array(null, $id));
} else {
parent::unlinkRelationship($id, $return_module, $return_id);
}
}
function insertIntoEntityTable($table_name, $module, $fileid = '') {
//Ignore relation table insertions while saving of the record
if($table_name == 'vtiger_inventoryproductrel') {
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment