Changeset 13471

Show
Ignore:
Timestamp:
02/18/12 14:33:58 (1 year ago)
Author:
p_lindheimer
Message:

closes #5169 adds advanced option to auto-create followme along with default settings for ring/pre-ring, strategy, enabled state also used as defaults when adding new followme

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/findmefollow/functions.inc.php

    r13470 r13471  
    275275  global $astman; 
    276276  global $db; 
     277 
     278  if (empty($postdest)) { 
     279    $postdest = "ext-local,$grpnum,dest"; 
     280  } 
    277281 
    278282  $sql = "INSERT INTO findmefollow (grpnum, strategy, grptime, grppre, grplist, annmsg_id, postdest, dring, needsconf, remotealert_id, toolate_id, ringing, pre_ring) VALUES ('".$db->escapeSimple($grpnum)."', '".$db->escapeSimple($strategy)."', ".$db->escapeSimple($grptime).", '".$db->escapeSimple($grppre)."', '".$db->escapeSimple($grplist)."', '".$db->escapeSimple($annmsg_id)."', '".$db->escapeSimple($postdest)."', '".$db->escapeSimple($dring)."', '$needsconf', '$remotealert_id', '$toolate_id', '$ringing', '$pre_ring')"; 
     
    391395    $results['voicemail'] = sql("SELECT `voicemail` FROM `users` WHERE `extension` = '".$db->escapeSimple($grpnum)."'","getOne"); 
    392396  } 
     397  if (!isset($results['strategy'])) { 
     398    $results['strategy'] = $amp_conf['FOLLOWME_RG_STRATEGY']; 
     399  } 
    393400 
    394401  if ($check_astdb) { 
     
    418425      $astdb_ddial   = $astman->database_get("AMPUSER",$grpnum."/followme/ddial");                                      
    419426    // If the values are different then use what is in astdb as it may have been changed. 
     427    // If sql returned no results for pre_ring/grptime then it's not configued so we reset 
     428    // the astdb defaults as well 
    420429    // 
    421430    $changed=0; 
    422431    if (!isset($results['pre_ring'])) { 
    423       $results['pre_ring'] = ''
     432      $results['pre_ring'] = $astdb_prering = $amp_conf['FOLLOWME_PRERING']
    424433    } 
    425434    if (!isset($results['grptime'])) { 
    426       $results['grptime'] = ''
     435      $results['grptime'] = $astdb_grptime = $amp_conf['FOLLOWME_TIME']
    427436    } 
    428437    if (!isset($results['grplist'])) { 
     
    465474      $ddial = ''; 
    466475    } else { 
    467       //Bogus value, should not get here but treat as disabled 
    468       $ddial = ''; 
     476      // If here then followme must not be set so use default 
     477      $ddial = $amp_conf['FOLLOWME_DISABLED'] ? 'CHECKED' : ''; 
    469478    } 
    470479    $results['ddial'] = $ddial; 
     
    483492function findmefollow_configpageinit($dispnum) { 
    484493  global $currentcomponent; 
     494  global $amp_conf; 
    485495 
    486496  if ( ($dispnum == 'users' || $dispnum == 'extensions') ) { 
    487497    $currentcomponent->addguifunc('findmefollow_configpageload'); 
     498 
     499    if ($amp_conf['FOLLOWME_AUTO_CREATE']) { 
     500      $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
     501      if ($action=="add") { 
     502        $currentcomponent->addprocessfunc('findmefollow_configprocess', 8); 
     503      } 
     504    } 
    488505  } 
    489506} 
     
    514531} 
    515532 
     533// If we are auto-creating a followme for each extension then add the hook funcitons for 
     534// extensions and users. 
     535// 
     536if ($amp_conf['FOLLOWME_AUTO_CREATE']) { 
     537  function findmefollow_configprocess() { 
     538    global $amp_conf; 
     539 
     540    //create vars from the request 
     541    $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
     542    $ext = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
     543    $extn = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; 
     544 
     545    if ($ext=='') {  
     546      $extdisplay = $extn;  
     547    } else { 
     548      $extdisplay = $ext; 
     549    }  
     550    if ($action == "add") { 
     551      if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) { 
     552 
     553        $ddial = $amp_conf['FOLLOWME_DISABLED'] ? 'CHECKED' : ''; 
     554        findmefollow_add($extdisplay, $amp_conf['FOLLOWME_RG_STRATEGY'], $amp_conf['FOLLOWME_TIME'], 
     555          $extdisplay, "", "", "", "", "", "", "","", $amp_conf['FOLLOWME_PRERING'], $ddial,'default',''); 
     556      } 
     557    } 
     558  } 
     559} 
     560 
    516561function findmefollow_check_destinations($dest=true) { 
    517562  global $active_modules; 
  • modules/branches/2.10/findmefollow/install.php

    r13091 r13471  
    293293} 
    294294 
    295 ?> 
     295$freepbx_conf =& freepbx_conf::create(); 
     296 
     297// FOLLOWME_AUTO_CREATE 
     298// 
     299$set['value'] = false; 
     300$set['defaultval'] =& $set['value']; 
     301$set['readonly'] = 0; 
     302$set['hidden'] = 0; 
     303$set['level'] = 1; 
     304$set['module'] = 'findmefollow'; 
     305$set['category'] = 'Follow Me Module'; 
     306$set['emptyok'] = 0; 
     307$set['sortorder'] = 30; 
     308$set['name'] = 'Create Follow Me at Extension Creation Time'; 
     309$set['description'] = 'When creating a new user or extension, setting this to true will automatically create a new Follow Me for that user using the default settings listed below'; 
     310$set['type'] = CONF_TYPE_BOOL; 
     311$freepbx_conf->define_conf_setting('FOLLOWME_AUTO_CREATE',$set); 
     312 
     313// FOLLOWME_DISABLED 
     314// 
     315$set['value'] = true; 
     316$set['defaultval'] =& $set['value']; 
     317$set['readonly'] = 0; 
     318$set['hidden'] = 0; 
     319$set['level'] = 1; 
     320$set['module'] = 'findmefollow'; 
     321$set['category'] = 'Follow Me Module'; 
     322$set['emptyok'] = 0; 
     323$set['sortorder'] = 40; 
     324$set['name'] = 'Disable Follow Me Upon Creation'; 
     325$set['description'] = 'This is the default value for the Follow Me "Disable" setting. When first creating a Follow Me or if auto-created with a new extension, setting this to true will disable the Follow Me setting which can be changed by the user or admin in multiple locations.'; 
     326$set['type'] = CONF_TYPE_BOOL; 
     327$freepbx_conf->define_conf_setting('FOLLOWME_DISABLED',$set); 
     328 
     329// FOLLOWME_TIME 
     330// 
     331unset($options); 
     332for ($i=5;$i<=120;$i++) { 
     333  $options[] = $i; 
     334
     335$set['value'] = '20'; 
     336$set['defaultval'] =& $set['value']; 
     337$set['options'] = $options; 
     338$set['readonly'] = 0; 
     339$set['hidden'] = 0; 
     340$set['level'] = 1; 
     341$set['module'] = 'findmefollow'; 
     342$set['category'] = 'Follow Me Module'; 
     343$set['emptyok'] = 0; 
     344$set['sortorder'] = 50; 
     345$set['name'] = "Default Follow Me Ring Time"; 
     346$set['description'] = "The default Ring Time for a Follow Me set upon creation and used if auto-created with a new extension."; 
     347$set['type'] = CONF_TYPE_SELECT; 
     348$freepbx_conf->define_conf_setting('FOLLOWME_TIME',$set); 
     349 
     350// FOLLOWME_PRERING 
     351// 
     352unset($options); 
     353for ($i=5;$i<=60;$i++) { 
     354  $options[] = $i; 
     355
     356$set['value'] = '7'; 
     357$set['defaultval'] =& $set['value']; 
     358$set['options'] = $options; 
     359$set['readonly'] = 0; 
     360$set['hidden'] = 0; 
     361$set['level'] = 1; 
     362$set['module'] = 'findmefollow'; 
     363$set['category'] = 'Follow Me Module'; 
     364$set['emptyok'] = 0; 
     365$set['sortorder'] = 60; 
     366$set['name'] = "Default Follow Me Initial Ring Time"; 
     367$set['description'] = "The default Initial Ring Time for a Follow Me set upon creation and used if auto-created with a new extension."; 
     368$set['type'] = CONF_TYPE_SELECT; 
     369$freepbx_conf->define_conf_setting('FOLLOWME_PRERING',$set); 
     370 
     371// FOLLOWME_RG_STRATEGY 
     372// 
     373$set['value'] = 'ringallv2-prim'; 
     374$set['defaultval'] =& $set['value']; 
     375$set['options'] = array('ringallv2','ringallv2-prim','ringall','ringall-prim','hunt','hunt-prim','memoryhunt','memoryhunt-prim','firstavailable','firstnotonphone'); 
     376$set['readonly'] = 0; 
     377$set['hidden'] = 0; 
     378$set['level'] = 1; 
     379$set['module'] = 'findmefollow'; 
     380$set['category'] = 'Follow Me Module'; 
     381$set['emptyok'] = 0; 
     382$set['sortorder'] = 70; 
     383$set['name'] = 'Default Follow Me Ring Strategy'; 
     384$set['description'] = "The default Ring Strategy selected for a Follow Me set upon creation and used if auto-created with an extension."; 
     385$set['type'] = CONF_TYPE_SELECT; 
     386$freepbx_conf->define_conf_setting('FOLLOWME_RG_STRATEGY',$set); 
  • modules/branches/2.10/findmefollow/module.xml

    r13323 r13471  
    33  <repo>standard</repo> 
    44  <name>Follow Me</name> 
    5   <version>2.10.0.2</version> 
     5  <version>2.10.0.3</version> 
    66  <publisher>FreePBX</publisher> 
    77  <license>GPLv2+</license> 
    88  <changelog> 
     9    *2.10.0.3* #5358, #5521, #5169 
    910    *2.10.0.2* #5478  
    1011    *2.10.0.1* call recording bug fixes 
  • modules/branches/2.10/findmefollow/page.findmefollow.php

    r13469 r13471  
    2424isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay=''; 
    2525isset($_REQUEST['account'])?$account = $_REQUEST['account']:$account=''; 
    26 isset($_REQUEST['grptime'])?$grptime = $_REQUEST['grptime']:$grptime=''
     26isset($_REQUEST['grptime'])?$grptime = $_REQUEST['grptime']:$grptime=$amp_conf['FOLLOWME_TIME']
    2727isset($_REQUEST['grppre'])?$grppre = $_REQUEST['grppre']:$grppre=''; 
    28 isset($_REQUEST['strategy'])?$strategy = $_REQUEST['strategy']:$strategy=''
     28isset($_REQUEST['strategy'])?$strategy = $_REQUEST['strategy']:$strategy=$amp_conf['FOLLOWME_RG_STRATEGY']
    2929isset($_REQUEST['annmsg_id'])?$annmsg_id = $_REQUEST['annmsg_id']:$annmsg_id=''; 
    3030isset($_REQUEST['dring'])?$dring = $_REQUEST['dring']:$dring=''; 
     
    3333isset($_REQUEST['toolate_id'])?$toolate_id = $_REQUEST['toolate_id']:$toolate_id=''; 
    3434isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing=''; 
    35 isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0'; 
    36 isset($_REQUEST['ddial'])?$ddial = $_REQUEST['ddial']:$ddial=''; 
     35isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring=$amp_conf['FOLLOWME_PRERING']; 
    3736isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default'; 
    3837isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid=''; 
    3938 
     39$ddial = isset($_REQUEST['ddial']) ? $_REQUEST['ddial'] : ($amp_conf['FOLLOWME_DISABLED'] ? 'CHECKED' : ''); 
    4040 
    4141if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { 
    42         $goto = $_REQUEST[$_REQUEST['goto0']."0"]; 
     42 $goto = $_REQUEST[$_REQUEST['goto0']."0"]; 
    4343} else { 
    44         $goto = ''; 
    45 
    46  
     44  $goto = "ext-local,$extdisplay,dest"; 
     45
    4746 
    4847if (isset($_REQUEST["grplist"])) {