Changeset 4233

Show
Ignore:
Timestamp:
06/27/07 00:03:12 (6 years ago)
Author:
p_lindheimer
Message:

#2024 deal with duplicate ringgoup numbers gracefully

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.2/ringgroups/functions.inc.php

    r4089 r4233  
    139139 
    140140function ringgroups_add($grpnum,$strategy,$grptime,$grplist,$postdest,$desc,$grppre='',$annmsg='',$alertinfo,$needsconf,$remotealert,$toolate,$ringing) { 
     141 
     142  $extens = ringgroups_list(); 
     143  if(is_array($extens)) { 
     144    foreach($extens as $exten) { 
     145      if ($exten[0]===$grpnum) { 
     146        echo "<script>javascript:alert('"._("This ringgroup")." ({$grpnum}) "._("is already in use")."');</script>"; 
     147        return false; 
     148      } 
     149    } 
     150  } 
     151  print_r($extens); 
     152 
    141153  $sql = "INSERT INTO ringgroups (grpnum, strategy, grptime, grppre, grplist, annmsg, postdest, description, alertinfo, needsconf, remotealert, toolate, ringing) VALUES (".$grpnum.", '".str_replace("'", "''", $strategy)."', ".str_replace("'", "''", $grptime).", '".str_replace("'", "''", $grppre)."', '".str_replace("'", "''", $grplist)."', '".str_replace("'", "''", $annmsg)."', '".str_replace("'", "''", $postdest)."', '".str_replace("'", "''", $desc)."', '".str_replace("'", "''", $alertinfo)."', '$needsconf', '$remotealert', '$toolate', '$ringing')"; 
    142154  $results = sql($sql); 
     155  return true; 
    143156} 
    144157 
     
    157170    return $grps; 
    158171  else 
    159     return null
     172    return array()
    160173} 
    161174 
  • modules/branches/2.2/ringgroups/module.xml

    r4090 r4233  
    22  <rawname>ringgroups</rawname> 
    33  <name>Ring Groups</name> 
    4   <version>2.2.14</version> 
     4  <version>2.2.15</version> 
    55  <type>setup</type> 
    66  <category>Inbound Call Control</category> 
     
    99  </description> 
    1010  <changelog> 
     11    *2.2.15* #2024 provide alert when adding duplicate group number 
    1112    *2.2.14* Fixed bug where nested CID prefixes ends up removing part of the valid CID info 
    1213    *2.2.13* Add he_IL translation 
  • modules/branches/2.2/ringgroups/page.ringgroups.php

    r3423 r4233  
    6969    //add group 
    7070    if ($action == 'addGRP') { 
    71       //ringgroups_add($account,implode("-",$grplist),$strategy,$grptime,$grppre,$goto); 
    72       ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg,$alertinfo,$needsconf,$remotealert,$toolate,$ringing); 
    73       needreload(); 
    74       redirect_standard(); 
     71      if (ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg,$alertinfo,$needsconf,$remotealert,$toolate,$ringing)) { 
     72      needreload(); 
     73      redirect_standard('extdisplay'); 
     74      } 
    7575    } 
    7676