diff --git a/UPGRADE b/UPGRADE
index a02a165d..428cc25b 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -530,6 +530,10 @@ OTHER CHANGES:
149. Added Screen Colors option to set the submit button color on the admin
screens and reports.
+150. Added the ability to modify the status of any call or agent log in the
+ Admin Modify Lead page. Must use new 'Modify Leads' options to enable
+ for a user.
+
diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php
index 11a8b24e..740fcc31 100644
--- a/www/vicidial/admin.php
+++ b/www/vicidial/admin.php
@@ -4708,12 +4708,13 @@ else
# 200816-0912 - Removed the ability to delete the 'default' DID entry
# 200912-1649 - Added more get_call_launch PREVIEW_ options
# 200913-0820 - Added UNSELECTED options for campaign alt_number_dialing
+# 200916-0922 - Added more modify_leads options for users(modify log statuses)
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
-$admin_version = '2.14-768a';
-$build = '200913-0820';
+$admin_version = '2.14-769a';
+$build = '200916-0922';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -22803,7 +22804,7 @@ if ($ADD==3)
echo "
"._QXZ("GDPR-Compliant Export Delete Leads").": ";
for ($i=0; $i<=$SSenable_gdpr_download_deletion; $i++)
{
diff --git a/www/vicidial/admin_modify_lead.php b/www/vicidial/admin_modify_lead.php
index 01000b94..a7f778e6 100644
--- a/www/vicidial/admin_modify_lead.php
+++ b/www/vicidial/admin_modify_lead.php
@@ -98,6 +98,7 @@
# 190609-0927 - Added sip_event_logging support
# 191113-2204 - Added support for per-User additional status groups
# 200815-0017 - Added support for additional modify_leads setting
+# 200916-2321 - Added options to allow users to modify any call or agent log status
#
require("dbconnect_mysqli.php");
@@ -218,6 +219,18 @@ if (isset($_GET["gdpr_action"])) {$gdpr_action=$_GET["gdpr_action"];}
elseif (isset($_POST["gdpr_action"])) {$gdpr_action=$_POST["gdpr_action"];}
if (isset($_GET["CIDdisplay"])) {$CIDdisplay=$_GET["CIDdisplay"];}
elseif (isset($_POST["CIDdisplay"])) {$CIDdisplay=$_POST["CIDdisplay"];}
+if (isset($_GET["modify_log_submit"])) {$modify_log_submit=$_GET["modify_log_submit"];}
+ elseif (isset($_POST["modify_log_submit"])) {$modify_log_submit=$_POST["modify_log_submit"];}
+if (isset($_GET["modify_log_table"])) {$modify_log_table=$_GET["modify_log_table"];}
+ elseif (isset($_POST["modify_log_table"])) {$modify_log_table=$_POST["modify_log_table"];}
+if (isset($_GET["modify_log_status"])) {$modify_log_status=$_GET["modify_log_status"];}
+ elseif (isset($_POST["modify_log_status"])) {$modify_log_status=$_POST["modify_log_status"];}
+if (isset($_GET["modify_old_status"])) {$modify_old_status=$_GET["modify_old_status"];}
+ elseif (isset($_POST["modify_old_status"])) {$modify_old_status=$_POST["modify_old_status"];}
+if (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];}
+ elseif (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];}
+if (isset($_GET["log_date"])) {$log_date=$_GET["log_date"];}
+ elseif (isset($_POST["log_date"])) {$log_date=$_POST["log_date"];}
if ($archive_search=="Yes") {$vl_table="vicidial_list_archive";}
@@ -271,6 +284,9 @@ if ($qm_conf_ct > 0)
###########################################
$lead_id = preg_replace('/[^0-9a-zA-Z]/','',$lead_id);
+$modify_log_submit = preg_replace('/[^-_0-9a-zA-Z]/','',$modify_log_submit);
+$modify_log_table = preg_replace('/[^-_0-9a-zA-Z]/','',$modify_log_table);
+$vicidial_id = preg_replace('/[^-\+\.\:\_0-9a-zA-Z]/','',$vicidial_id);
if ($non_latin < 1)
{
@@ -341,6 +357,9 @@ if ($non_latin < 1)
$callback_type = preg_replace('/[^A-Z]/','',$callback_type);
$callback_user = preg_replace('/[^-\_0-9a-zA-Z]/', '',$callback_user);
$callback_comments = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$callback_comments);
+ $modify_log_status = preg_replace('/[^-\_0-9a-zA-Z]/', '',$modify_log_status);
+ $modify_old_status = preg_replace('/[^-\_0-9a-zA-Z]/', '',$modify_old_status);
+ $log_date = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$log_date);
} # end of non_latin
else
{
@@ -475,6 +494,90 @@ if ($SSadmin_screen_colors != 'default')
}
+#############################################
+##### BEGIN modify log status functions #####
+#############################################
+if ($modify_log_submit>0)
+ {
+ if ( ($LOGmodify_leads == '3') or ($LOGmodify_leads == '4') )
+ {
+ if (strlen($modify_log_status)>0)
+ {
+ if ( (strlen($lead_id)>0) and (strlen($modify_log_table)>3) and (strlen($modify_log_status)>0) and (strlen($modify_old_status)>0) and (strlen($vicidial_id) > 0) and (strlen($log_date) > 10) )
+ {
+ $stmt='';
+ if ($modify_log_table == 'vicidial_log')
+ {
+ $stmt="UPDATE vicidial_log set status='$modify_log_status' where lead_id='$lead_id' and uniqueid='$vicidial_id' and call_date='$log_date';";
+ }
+ if ($modify_log_table == 'vicidial_log_archive')
+ {
+ $stmt="UPDATE vicidial_log_archive set status='$modify_log_status' where lead_id='$lead_id' and uniqueid='$vicidial_id' and call_date='$log_date';";
+ }
+ if ($modify_log_table == 'vicidial_closer_log')
+ {
+ $stmt="UPDATE vicidial_closer_log set status='$modify_log_status' where lead_id='$lead_id' and closecallid='$vicidial_id' and call_date='$log_date';";
+ }
+ if ($modify_log_table == 'vicidial_closer_log_archive')
+ {
+ $stmt="UPDATE vicidial_closer_log_archive set status='$modify_log_status' where lead_id='$lead_id' and closecallid='$vicidial_id' and call_date='$log_date';";
+ }
+ if ($modify_log_table == 'vicidial_agent_log')
+ {
+ $stmt="UPDATE vicidial_agent_log set status='$modify_log_status' where lead_id='$lead_id' and agent_log_id='$vicidial_id' and event_time='$log_date';";
+ }
+ if ($modify_log_table == 'vicidial_agent_log_archive')
+ {
+ $stmt="UPDATE vicidial_agent_log_archive set status='$modify_log_status' where lead_id='$lead_id' and agent_log_id='$vicidial_id' and event_time='$log_date';";
+ }
+
+ if (strlen($stmt)>20)
+ {
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+
+ $SQL_log = addslashes($stmt);
+ $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='MODIFY LEAD LOG STATUS', event_sql=\"$SQL_log\", event_notes='$lead_id|$modify_log_table|$modify_log_status|$modify_old_status|$vicidial_id|$log_date|$affected_rows';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+
+ echo "SUCCESS: "._QXZ("Log Status Modified").": $modify_log_status \n";
+ exit;
+ }
+ else
+ {
+ echo "ERROR: "._QXZ("Modification could not be completed").": $stmt|$lead_id|$modify_log_table|$modify_log_status|$modify_old_status|$vicidial_id|$log_date \n";
+ exit;
+ }
+ }
+ else
+ {
+ echo "ERROR: "._QXZ("Missing required fields").": $lead_id|$modify_log_table|$modify_log_status|$modify_old_status|$vicidial_id|$log_date \n";
+ exit;
+ }
+ }
+ else
+ {
+ echo "ERROR: "._QXZ("Log status not changed, new status is blank or the same as the old status").": $modify_log_status \n";
+ exit;
+ }
+ }
+ else
+ {
+ echo "ERROR: "._QXZ("You do not have permission to modify log statuses").": $LOGmodify_leads \n";
+ exit;
+ }
+ }
+############################################
+##### END modify log status functions #####
+#############################################
+
+
+
+################################
+##### BEGIN GDPR functions #####
+################################
if ($enable_gdpr_download_deletion>0)
{
$stmt="SELECT export_gdpr_leads from vicidial_users where user='$PHP_AUTH_USER' and export_gdpr_leads >= 1;";
@@ -562,7 +665,6 @@ if ($enable_gdpr_download_deletion>0)
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='DELETE', record_id='$lead_id', event_code='GDPR PURGE LEAD DATA', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
-
}
$HTML_text.=" ";
@@ -738,6 +840,9 @@ if ($enable_gdpr_download_deletion>0)
}
+################################
+##### END GDPR functions #####
+################################
$label_title = _QXZ("Title");
@@ -916,10 +1021,6 @@ body
-->
-\n";
-echo "\n";
-?>
\n";
- echo "
\n";
- echo "\n";
-echo " \n";
-echo "\n";
+#######################################
+##### END CID display javascript #####
+#######################################
if ($gdpr_display==2 && preg_match("/purge$/", $gdpr_action))
{
+ echo "\n";
+ echo " \n";
+ echo "\n";
+ echo "\n";
echo $HTML_text;
echo "