diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index 6e075b18..29d022fe 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -4184,12 +4184,13 @@ else
# 170926-1618 - Fix for Test Call function for Asterisk 13
# 170930-0853 - Added extension_appended_cidname options and custom reports variable display
# 171001-1544 - Moved user IP Lists permissions to new security section in Modify User page
+# 171005-1707 - Fix for remote agent modify overlap issue
#
# 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-633a';
-$build = '171001-1544';
+$admin_version = '2.14-634a';
+$build = '171005-1707';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -15255,7 +15256,9 @@ if ($ADD==41111)
{
### check for closest remote agents to this account to ensure no overlapping
$user_finish = ($user_start + $number_of_lines);
- $stmt="SELECT count(*) from vicidial_remote_agents where user_start > '$user_start' and user_start < '$user_finish';";
+ $user_finish_length = strlen($user_finish);
+ $stmt="SELECT count(*) from vicidial_remote_agents where user_start > '$user_start' and user_start < '$user_finish' and user_start != '$user_start' and (char_length(user_start) <= $user_finish_length);";
+ if ($DB > 0) {echo "|$stmt|";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
@@ -15269,6 +15272,7 @@ if ($ADD==41111)
}
else
{
+ if ($number_of_lines < 1) {$status='INACTIVE';}
$stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value',extension_group='$extension_group',on_hook_agent='$on_hook_agent',on_hook_ring_time='$on_hook_ring_time' where remote_agent_id='$remote_agent_id';";
$rslt=mysql_to_mysqli($stmt, $link);
@@ -30712,6 +30716,7 @@ if ($ADD==31111)
echo "
"._QXZ("MODIFY A REMOTE AGENTS ENTRY").": $row[0]