/** * Function to delete the relation for specified source record id and related record id list * @param <array> $request */ function deleteRelation($request) { $sourceModule = $request->getModule(); $sourceRecordId = $request->get('src_record'); $relatedModule = $request->get('related_module'); $relatedRecordIdList = $request->get('related_record_list'); $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule); $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule); $relationModel = PriceBooks_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel); foreach ($relatedRecordIdList as $relatedRecordId) { $relationModel->deleteRelation($sourceRecordId, $relatedRecordId); } }
/** * Function to delete the relation for specified source record id and related record id list * @param <array> $request * keys Content * src_module source module name * src_record source record id * related_module related module name * related_record_list json encoded of list of related record ids */ function deleteRelation($request) { $sourceModule = $request->getModule(); $sourceRecordId = $request->get('src_record'); $relatedModule = $request->get('related_module'); $relatedRecordIdList = $request->get('related_record_list'); //Setting related module as current module to delete the relation vglobal('currentModule', $relatedModule); $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule); $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule); $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel); foreach ($relatedRecordIdList as $relatedRecordId) { $response = $relationModel->deleteRelation($sourceRecordId, $relatedRecordId); } echo $response; }