Changeset 12460 for modules/branches/2.10/timeconditions
- Timestamp:
- 08/29/11 18:34:11 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10/timeconditions/functions.inc.php
r12456 r12460 266 266 $fcc = new featurecode('timeconditions', 'toggle-mode-'.$id); 267 267 $c = $fcc->getCodeActive(); 268 $results['tcval'] = $fcc->getCode(); 268 269 unset($fcc); 269 270 if ($c == '') { … … 383 384 /* 384 385 */ 385 function timeconditions_create_fc($id, $displayname='') { 386 function timeconditions_create_fc($id, $displayname='',$state=false) { 387 global $astman; 388 global $amp_conf; 389 $DEVSTATE = $amp_conf['AST_FUNC_DEVICE_STATE']; 390 386 391 $fcc = new featurecode('timeconditions', 'toggle-mode-'.$id); 387 392 if ($displayname) { … … 390 395 $fcc->setDescription($id._(": Time Condition Override")); 391 396 } 392 $fcc->setDefault('*27'.$id, false);397 $fcc->setDefault('*27'.$id,$state); 393 398 $fcc->setProvideDest(); 394 399 $fcc->update(); 395 400 unset($fcc); 401 402 $astman->database_put("TC",$id,''); 403 // We do not try to figure out the blf value here, as soon as the call script is called or a call flows through the time 404 // condition it will get properly intiialized 405 // 406 if ($DEVSTATE) { 407 $astman->send_request('Command',array('Command'=>"core set global ".$DEVSTATE."(Custom:TC".$id.") NOT_INUSE")); 408 $astman->send_request('Command',array('Command'=>"core set global ".$DEVSTATE."(Custom:TCSTICKY".$id.") NOT_INUSE")); 409 } 396 410 } 397 411 … … 406 420 $deptname = $db->escapeSimple($post['deptname']); 407 421 $generate_hint = $post['generate_hint'] == '1' ? '1' : '0'; 422 $override_fc = $post['override_fc'] == '1' ? '1' : '0'; 408 423 409 424 if($displayname == '') { … … 412 427 $results = sql("INSERT INTO timeconditions (displayname,time,truegoto,falsegoto,deptname,generate_hint) values (\"$displayname\",\"$time\",\"$truegoto\",\"$falsegoto\",\"$deptname\",\"$generate_hint\")"); 413 428 $id = $amp_conf["AMPDBENGINE"] == "sqlite3" ? sqlite_last_insert_rowid($db->connection) : mysql_insert_id($db->connection); 414 timeconditions_create_fc($id, $displayname); 429 timeconditions_create_fc($id, $displayname, $override_fc); 430 return $id; 415 431 } 416 432 … … 427 443 $deptname = $db->escapeSimple($post['deptname']); 428 444 $generate_hint = $post['generate_hint'] == '1' ? '1' : '0'; 445 $override_fc = $post['override_fc'] == '1' ? '1' : '0'; 429 446 430 447 if(empty($displayname)) { … … 475 492 } 476 493 } 494 495 $fcc = new featurecode('timeconditions', 'toggle-mode-'.$id); 496 $fcc->setEnabled($override_fc); 497 $fcc->update(); 498 unset($fcc); 477 499 } 478 500 modules/branches/2.10/timeconditions/module.xml
r12445 r12460 3 3 <repo>standard</repo> 4 4 <name>Time Conditions</name> 5 <version>2.9.0. 6</version>5 <version>2.9.0.7</version> 6 6 <publisher>FreePBX</publisher> 7 7 <license>GPLv2+</license> … … 11 11 </description> 12 12 <changelog> 13 *2.9.0.7* #5175, #5176 13 14 *2.9.0.6* #5030, spelling errors 14 15 *2.9.0.5* #4725 modules/branches/2.10/timeconditions/page.timeconditions.php
r12445 r12460 17 17 18 18 $generate_hint = isset($_POST['generate_hint'])?$_POST['generate_hint']:'0'; 19 $override_fc = isset($_POST['override_fc'])?$_POST['override_fc']:'0'; 19 20 20 21 $dispnum = "timeconditions"; //used for switch on config.php … … 24 25 switch ($action) { 25 26 case "add": 26 timeconditions_add($_POST);27 $_REQUEST['itemid'] = timeconditions_add($_POST); 27 28 needreload(); 28 redirect_standard( );29 redirect_standard('itemid'); 29 30 break; 30 31 case "delete": … … 82 83 $tccode = ''; 83 84 } 85 $tcval = $thisItem['tcval']; 84 86 ?> 85 87 <form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();"> … … 100 102 <?php if ($amp_conf['USEDEVSTATE']) { ?> 101 103 <tr> 102 <td><a href="#" class="info"><?php echo _("Generate BLF Hint")?><span><?php echo sprintf(_("If set an Asterisk hint will be created for the override feature code %s associated with this Time Condition that can be used to light BLF buttons on a phone programmed to enable/disable this Time Condition. If not using a BLF it is better to leave this un-checked as additional system resources are required to keep the hint updated. This Feature Code can be found and enabled/disabled on the Feature Codes tab under Time Conditions."),$tc code)?></span></a></td>104 <td><a href="#" class="info"><?php echo _("Generate BLF Hint")?><span><?php echo sprintf(_("If set an Asterisk hint will be created for the override feature code %s associated with this Time Condition that can be used to light BLF buttons on a phone programmed to enable/disable this Time Condition. If not using a BLF it is better to leave this un-checked as additional system resources are required to keep the hint updated. This Feature Code can be found and enabled/disabled on the Feature Codes tab under Time Conditions."),$tcval)?></span></a></td> 103 105 <td> 104 106 <input name="generate_hint" type="checkbox" value="1" <?php echo ($generate_hint == '1' ? 'checked' : ''); ?> tabindex="<?php echo ++$tabindex;?>"/> … … 106 108 </tr> 107 109 <?php } ?> 108 110 <tr> 111 <td><a href="#" class="info"><?php echo _("Enable Override Code")?><span><?php echo sprintf(_("Check to enable the override feature code %s that allows manual changes to the timecondition."),$tcval)?></span></a></td> 112 <td> 113 <input name="override_fc" type="checkbox" value="1" <?php echo ($tccode != '' ? 'checked' : ''); ?> tabindex="<?php echo ++$tabindex;?>"/><?php if ($tcval) { echo "<small>($tcval)</small>"; } ?> 114 </td> 115 </tr> 109 116 <?php 110 117 if ($itemid && $thisItem['tcstate'] !== false) { … … 136 143 </tr> 137 144 <tr> 138 <td><a href="#" class="info"><?php echo _("Change Override:")?><span><?php echo sprintf(_("This Time Condition can be set to Temporarily go to the 'matched' or 'unmatched' destination in which case the override will automatically reset once the current time span has elapsed. If set to Permanent it will stay overridden until manually reset. All overrides can be removed with the Reset Override option. Temporary Overrides can also be toggled with the %s feature code, which will also remove a Permanent Override if set but can not set a Permanent Override which must be done here or with other applications such as an XML based phone options."),$tc code)?></span></a></td>145 <td><a href="#" class="info"><?php echo _("Change Override:")?><span><?php echo sprintf(_("This Time Condition can be set to Temporarily go to the 'matched' or 'unmatched' destination in which case the override will automatically reset once the current time span has elapsed. If set to Permanent it will stay overridden until manually reset. All overrides can be removed with the Reset Override option. Temporary Overrides can also be toggled with the %s feature code, which will also remove a Permanent Override if set but can not set a Permanent Override which must be done here or with other applications such as an XML based phone options."),$tcval)?></span></a></td> 139 146 <td> 140 147 <select name="tcstate_new" tabindex="<?php echo ++$tabindex;?>">
