Page 1 of 1

Change Historic Disposition Statuses

PostPosted: Thu Nov 14, 2013 10:23 am
by Rudolfmdlt
Hi All,

I need to change the dispositions on a campaign (easy) and then I need to update all historic occurrences of that status for reporting purposes.
1) Is this a good idea!? :lol:
2) Which tables do I need to update. So far I have found
i) vicidial_list
ii) vicidial_log

There are other logs and tables, but those are the two that I have found that contain current and historic disposition data.

Thanks for any help,

Rudolf

Re: Change Historic Disposition Statuses

PostPosted: Fri Nov 15, 2013 5:04 am
by DomeDan
1: No its not a good idea :P but its possible

2: I wrote a command to check what tables that contains a status field:
domedan@Host:/usr/local/src/vicidial/trunk$ cat extras/MySQL_AST_CREATE_tables.sql | tr -d '\n' | sed 's/;/;\n/g' |grep 'CREATE'| grep 'status VARCHAR' | cut -d' ' -f 3
phones
park_log
vicidial_list
vicidial_live_agents
vicidial_log
vicidial_closer_log
vicidial_campaigns
vicidial_statuses
vicidial_campaign_statuses
vicidial_campaign_hotkeys
vicidial_agent_log
vicidial_callbacks
vicidial_lead_recycle
vicidial_timeclock_status
vicidial_carrier_log
vicidial_list_update_log
twoday_vicidial_log
twoday_vicidial_closer_log
twoday_vicidial_agent_log
vicidial_agent_skip_log
vicidial_log_noanswer
vicidial_qc_agent_log
vicidial_email_list
vicidial_nanpa_filter_log

But not all of those is what you need to update,
so you can change the command a little and get a list of querys you can run to find out if the status you are looking for is in the tables:
domedan@Host:/usr/local/src/vicidial/trunk$ for table in $(cat extras/MySQL_AST_CREATE_tables.sql | tr -d '\n' | sed 's/;/;\n/g' |grep 'CREATE'| grep 'status VARCHAR' | cut -d' ' -f 3); do echo "SELECT count(*) FROM $table WHERE status='ChangeMe';"; done
SELECT count(*) FROM phones WHERE status='ChangeMe';
SELECT count(*) FROM park_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_list WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_live_agents WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_closer_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_campaigns WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_statuses WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_campaign_statuses WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_campaign_hotkeys WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_agent_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_callbacks WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_lead_recycle WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_timeclock_status WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_carrier_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_list_update_log WHERE status='ChangeMe';
SELECT count(*) FROM twoday_vicidial_log WHERE status='ChangeMe';
SELECT count(*) FROM twoday_vicidial_closer_log WHERE status='ChangeMe';
SELECT count(*) FROM twoday_vicidial_agent_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_agent_skip_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_log_noanswer WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_qc_agent_log WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_email_list WHERE status='ChangeMe';
SELECT count(*) FROM vicidial_nanpa_filter_log WHERE status='ChangeMe';

Aint the linux CLI fantastic? 8)

Re: Change Historic Disposition Statuses

PostPosted: Mon Nov 18, 2013 9:07 am
by Rudolfmdlt
That's amazing! :) Thanks! :)

Going to try and turn this into a script for future use!

Thanks a lot DomeDan!