Routing mechanism

The routing mechanism is the algorithm that decides which activity must have the duty of the newly created activity.

The routing mechanism is hardcoded in the following model:

/applications/modules/core/models/Actions_model.php
if($next_act->role == 'AG'){
				$query = $this->db->select('c.ag_company_id, c.ag_user_id')->where('d.id',$id_thread)->from('threads d')->join('be c', 'c.id = d.be')->get();
				$companyid = $query->row();
				if($companyid->ag_company_id){
					$activity_data['duty_company'] = $companyid->ag_company_id;
					$activity_data['duty_user'] = $companyid->ag_user_id;
				} else {
					$activity_data['duty_company'] = $company->company_id;
					$activity_data['duty_user'] = NULL;
				}
			}else if($next_act->role == 'CRM'){ 
					$activity_data['duty_company'] = $this->config->item('routing_crm_company_id');
					$activity_data['duty_user'] = NULL;
			}else {
				$activity_data['duty_company'] = $company->company_id;
				$activity_data['duty_user'] = NULL;
			}