From 8edae77ba42004f7eaeb13065500a14ad6c644ba Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 29 Jun 2007 21:51:33 +0000 Subject: [PATCH] fixed small percent and status bugs in list mix feature in admin.php git-svn-id: svn://192.168.202.10@647 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../TO_BE_TRANSLATED_2.0.4.txt | 1 + agc_2-X/trunk/www/vicidial/admin.php | 71 +++++++++++++------ 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt index 44a5afd6..25e0b984 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt @@ -71,6 +71,7 @@ ERROR: There are already 4 Status Categories set to TimeOnVDAD Display|| CUSTOM CAMPAIGN STATUS MODIFIED|| LIST MIX NOT MODIFIED|| LIST MIX MODIFIED|| +You cannot delete the last list_id entry from a list mix|| ############################################################ CLIENT diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index ec611430..7d2a1a69 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -5708,6 +5708,7 @@ if ($ADD==49) } } } + ##### ADD a list mix container entry ##### if ($stage=='ADD') { @@ -5727,7 +5728,7 @@ if ($ADD==49) $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $OLDlist_mix_container = $row[0]; - $NEWlist_mix_container = "$OLDlist_mix_container:$list_id||0||"; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id||0| -|"; $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; $rslt=mysql_query($stmt, $link); @@ -5741,6 +5742,7 @@ if ($ADD==49) } } } + ##### REMOVE a list mix container entry ##### if ($stage=='REMOVE') { @@ -5754,34 +5756,63 @@ if ($ADD==49) } else { - echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; - $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $MIXentries = $MT; $MIXentries = explode(":", $row[0]); $Ms_to_print = (count($MIXentries) - 0); - $q=0; - while ($Ms_to_print > $q) + + if ($Ms_to_print < 2) { - if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) - { - $NEWlist_mix_container .= "$MIXentries[$q]:"; - } - $q++; + echo "
LIST MIX NOT MODIFIED: You cannot delete the last list_id entry from a list mix\n"; } - $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); - - $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; - $rslt=mysql_query($stmt, $link); - - ### LOG CHANGES TO LOG FILE ### - if ($WeBRooTWritablE > 0) + else { - $fp = fopen ("./admin_changes_log.txt", "a"); - fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); - fclose($fp); + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; } } }