Changing Master Agent
Scripts for Changing master agent:
First look for Agency ID:
SELECT *
FROM od_agency
WHERE agency_id = 'AOD';
Then update the principle to the name of the new master agent:
UPDATE od_agency
SET principle = 'NAME'
WHERE agen_id = [agen_id];
Find all the agents for the agency in the usermaster table:
SELECT *
FROM od_usermaster
WHERE agen_id = [agen_id];
Then update the role (urole) to master agent for the selected agent:
UPDATE od_usermaster
SET urole = 'Agent Master'
WHERE userid = [userid];
Check the agents table for master agent assigned for the agency, if they are swapping to a sub agent then make note of the detils and insert them into the sub agents
table before deleting them out. If you are moving a sub agent to master agent then make a not of their details (write the nsert script first) then insert them into the agents table
SELECT *
FROM od_agents
WHERE agen_id = [agen_id];
SELECT *
FROM od_sub_agents
WHERE agen_id = [agen_id];
DELETE FROM od_sub_agents
WHERE agnt_usr_id = [agent_usr_id];
DELETE FROM od_agents
WHERE agnt_usr_id = [agent_usr_id];
INSERT INTO od_agents(agent_name,
`position`,
direct_dial,
mobile,
agent_id,
agen_id,
agnt_usr_id,
date_cre)
VALUES (agent details);
INSERT INTO od_sub_agents(agent_name,
`position`,
direct_dial,
mobile,
agent_id,
agen_id,
agnt_usr_id,
date_modi,
sub_agent_split)
VALUES (agent details);