diff --git a/include/class.canned.php b/include/class.canned.php index 96fb712991c3e96d1414c710fb41fece4e13bd0d..457c6d8f904eaaf476bc3744422989f17c940169 100644 --- a/include/class.canned.php +++ b/include/class.canned.php @@ -203,8 +203,8 @@ class Canned { if($errors) return false; $sql=' updated=NOW() '. - ',dept_id='.db_input($vars['dept_id']?$vars['dept_id']:0). - ',isenabled='.db_input($vars['isenabled']?$vars['isenabled']:1). + ',dept_id='.db_input($vars['dept_id']?:0). + ',isenabled='.db_input($vars['isenabled']). ',title='.db_input($vars['title']). ',response='.db_input(Format::sanitize($vars['response'])). ',notes='.db_input(Format::sanitize($vars['notes'])); diff --git a/include/class.config.php b/include/class.config.php index eaf2aac42bab9e20518c9aad4ff3d94f986b7215..c7648749784d78131d94886e94994649b383644c 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -127,7 +127,7 @@ class Config { return true; } - function destrory() { + function destroy() { $sql='DELETE FROM '.$this->table .' WHERE `'.$this->section_column.'` = '.db_input($this->section); diff --git a/include/class.dept.php b/include/class.dept.php index e337884625d67b7cc458320dc436d2190c1ff757..04a0e1b72a43cbd6eaa8ce203698961a0813bfca 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -138,7 +138,7 @@ class Dept { } function getAvailableMembers() { - return $this->getMembers(array('available' =>1)); + return $this->getMembers(array('available'=>1)); } diff --git a/include/class.user.php b/include/class.user.php index 5081f9a5585c3f685f4e074d787110ff5342f0e5..172399ab63ba032848ca373d21d0969803d0e29a 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -399,8 +399,8 @@ class PersonsName { } function __toString() { - global $cfg; - @list(,$func) = static::$formats[$this->format]; + + @list(, $func) = static::$formats[$this->format]; if (!$func) $func = 'getFull'; return call_user_func(array($this, $func)); diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index 4a6f505c0e837407dae5cdfc90c00b6434a9669b..2ca87dc4ccec23741c2e3a776acb300e05aeae1c 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -197,13 +197,16 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <select name="canned_response_id"> <option value="">— None —</option> <?php - $sql='SELECT canned_id,title FROM '.CANNED_TABLE - .' WHERE isenabled ORDER by title'; + $sql='SELECT canned_id, title, isenabled FROM '.CANNED_TABLE .' ORDER by title'; if ($res=db_query($sql)) { - while (list($id,$title)=db_fetch_row($res)) { + while (list($id, $title, $isenabled)=db_fetch_row($res)) { $selected=($info['canned_response_id'] && $id==$info['canned_response_id']) ? 'selected="selected"' : ''; + + if (!$isenabled) + $title .= ' (disabled)'; + echo sprintf('<option value="%d" %s>%s</option>', $id, $selected, $title); } @@ -294,12 +297,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } echo '</OPTGROUP>'; } - $sql='SELECT team_id, name FROM '.TEAM_TABLE .' ORDER BY name'; + $sql='SELECT team_id, isenabled, name FROM '.TEAM_TABLE .' ORDER BY name'; if(($res=db_query($sql)) && db_num_rows($res)){ echo '<OPTGROUP label="Teams">'; - while (list($id,$name) = db_fetch_row($res)){ + while (list($id, $isenabled, $name) = db_fetch_row($res)){ $k="t$id"; $selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':''; + if (!$isenabled) + $name .= ' (disabled)'; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> <?php diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php index 071e515dfa1f19e249c4d691cdfb803ddd544f17..25f93c8be0d042e149d53c0e50e4e570f91f2ee1 100644 --- a/include/staff/helptopic.inc.php +++ b/include/staff/helptopic.inc.php @@ -206,12 +206,15 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } echo '</OPTGROUP>'; } - $sql='SELECT team_id, name FROM '.TEAM_TABLE.' ORDER BY name'; + $sql='SELECT team_id, name, isenabled FROM '.TEAM_TABLE.' ORDER BY name'; if(($res=db_query($sql)) && db_num_rows($res)){ echo '<OPTGROUP label="Teams">'; - while (list($id,$name) = db_fetch_row($res)){ + while (list($id, $name, $isenabled) = db_fetch_row($res)){ $k="t$id"; $selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':''; + + if (!$isenabled) + $name .= ' (disabled)'; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> <?php diff --git a/include/staff/slaplan.inc.php b/include/staff/slaplan.inc.php index 0aac8b778005cc61644f57f39fe77e4d07fcee7c..19e165d49f3b1660ed2e0eec301931adc06e15e5 100644 --- a/include/staff/slaplan.inc.php +++ b/include/staff/slaplan.inc.php @@ -62,16 +62,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <td> <input type="radio" name="isactive" value="1" <?php echo $info['isactive']?'checked="checked"':''; ?>><strong>Active</strong> <input type="radio" name="isactive" value="0" <?php echo !$info['isactive']?'checked="checked"':''; ?>>Disabled - <span class="error">* </span> - </td> - </tr> - <tr> - <td width="180"> - Priority Escalation: - </td> - <td> - <input type="checkbox" name="enable_priority_escalation" value="1" <?php echo $info['enable_priority_escalation']?'checked="checked"':''; ?> > - <strong>Enable</strong> priority escalation on overdue tickets. + <span class="error">* <?php echo $errors['isactive']; ?></span> </td> </tr> <tr> diff --git a/include/staff/slaplans.inc.php b/include/staff/slaplans.inc.php index 04566aee31bffdab2f5dc2e4b8cf3ddedfc3722e..ff6fa6abe5601bbbf84be2d35b8697b8c753e5f6 100644 --- a/include/staff/slaplans.inc.php +++ b/include/staff/slaplans.inc.php @@ -53,7 +53,7 @@ else <caption><?php echo $showing; ?></caption> <thead> <tr> - <th width="7"> </th> + <th width="7"> </th> <th width="320"><a <?php echo $name_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=name">Name</a></th> <th width="100"><a <?php echo $status_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=status">Status</a></th> <th width="130"><a <?php echo $period_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=period">Grace Period (hrs)</a></th> @@ -66,17 +66,24 @@ else $total=0; $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; if($res && db_num_rows($res)): + $defaultId = $cfg->getDefaultSLAId(); while ($row = db_fetch_array($res)) { $sel=false; if($ids && in_array($row['id'],$ids)) $sel=true; + + $default = ''; + if ($row['id'] == $defaultId) + $default = '<small><em>(Default)</em></small>'; ?> <tr id="<?php echo $row['id']; ?>"> <td width=7px> - <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" - <?php echo $sel?'checked="checked"':''; ?>> + <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" + <?php echo $sel?'checked="checked"':''; ?>> </td> - <td> <a href="slas.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a></td> + <td> <a href="slas.php?id=<?php echo $row['id']; + ?>"><?php echo Format::htmlchars($row['name']); + ?></a> <?php echo $default; ?></td> <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td> <td style="text-align:right;padding-right:35px;"><?php echo $row['grace_period']; ?> </td> <td> <?php echo Format::db_date($row['created']); ?></td> diff --git a/scp/slas.php b/scp/slas.php index 072b27792f8a8635479f6a4cf50fddbe01fad4eb..62875c08ffd94dd41ec77a6b5f7dc5eb983b5afd 100644 --- a/scp/slas.php +++ b/scp/slas.php @@ -73,7 +73,9 @@ if($_POST){ case 'delete': $i=0; foreach($_POST['ids'] as $k=>$v) { - if(($p=SLA::lookup($v)) && $p->delete()) + if (($p=SLA::lookup($v)) + && $p->getId() != $cfg->getDefaultSLAId() + && $p->delete()) $i++; }