Fix for ALL_DNC_CAMPAIGNS dnc download in list_download.php
git-svn-id: svn://192.168.202.10@3368 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# downloads the entire contents of a vicidial list ID to a flat text file
|
||||
# that is tab delimited
|
||||
#
|
||||
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -37,6 +37,7 @@
|
||||
# 180330-1414 - Added option for downloading of CID Groups
|
||||
# 190926-1015 - Fix for PHP7
|
||||
# 201208-1630 - Fix for custom fields issue when downloading list with no custom fields itself
|
||||
# 210308-0939 - Fix for ALL_DNC_CAMPAIGNS dnc download
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -282,10 +283,34 @@ elseif ($download_type == 'dnc')
|
||||
{
|
||||
##### Campaign DNC list validation #####
|
||||
$event_code_type='CAMPAIGN DNC';
|
||||
$stmt="select count(*) from vicidial_campaigns where campaign_id='$group_id' $LOGallowed_campaignsSQL;";
|
||||
$camp_typeSQL = "campaign_id='$group_id'";
|
||||
|
||||
if (preg_match('/ALL_CAMPAIGNS/',$group_id)) {$camp_typeSQL = "active IN('Y','N')";}
|
||||
if (preg_match('/ALL_DNC_CAMPAIGNS/',$group_id)) {$camp_typeSQL = "use_campaign_dnc IN('Y','AREACODE')";}
|
||||
if (preg_match('/ALL_ACTIVE_CAMPAIGNS/',$group_id)) {$camp_typeSQL = "active='Y'";}
|
||||
if (preg_match('/ALL_ACTIVE_DNC_CAMPAIGNS/',$group_id)) {$camp_typeSQL = "active='Y' and use_campaign_dnc IN('Y','AREACODE')";}
|
||||
|
||||
if (preg_match('/ALL_CAMPAIGNS|ALL_DNC_CAMPAIGNS|ALL_ACTIVE_CAMPAIGNS|ALL_ACTIVE_DNC_CAMPAIGNS/',$group_id))
|
||||
{
|
||||
$stmt = "SELECT campaign_id FROM vicidial_campaigns where $camp_typeSQL order by campaign_id;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$camp_ct = mysqli_num_rows($rslt);
|
||||
if ($DB) {echo "$camp_ct|$stmt\n";}
|
||||
$cdnc=0; $camp_list='';
|
||||
while ($camp_ct > $cdnc)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($cdnc > 0) {$camp_list.= ",";}
|
||||
$camp_list.= "'$row[0]'";
|
||||
$cdnc++;
|
||||
}
|
||||
if ($cdnc > 0) {$camp_typeSQL = "campaign_id IN($camp_list)";}
|
||||
}
|
||||
|
||||
$stmt="select count(*) from vicidial_campaigns where $camp_typeSQL $LOGallowed_campaignsSQL;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$count_to_print = mysqli_num_rows($rslt);
|
||||
if ($DB) {echo "$count_to_print|$stmt\n";}
|
||||
if ($count_to_print > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
@@ -299,7 +324,7 @@ elseif ($download_type == 'dnc')
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt="select count(*) from vicidial_campaign_dnc where campaign_id='$group_id';";
|
||||
$stmt="select count(*) from vicidial_campaign_dnc where $camp_typeSQL;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$count_to_print = mysqli_num_rows($rslt);
|
||||
@@ -459,7 +484,7 @@ elseif ($download_type == 'dnc')
|
||||
$TXTfilename = "DNC_$group_id$US$FILE_TIME.txt";
|
||||
$header_row = "phone_number";
|
||||
$header_columns='';
|
||||
$stmt="select phone_number from vicidial_campaign_dnc where campaign_id='$group_id';";
|
||||
$stmt="select phone_number from vicidial_campaign_dnc where $camp_typeSQL;";
|
||||
}
|
||||
elseif ($download_type == 'fpgn')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user