Skip to content
Snippets Groups Projects
Commit 7828c08a authored by Peter Rotich's avatar Peter Rotich
Browse files

Change cancel link & input size

parent 92951ad4
Branches
Tags
No related merge requests found
...@@ -19,91 +19,113 @@ class SLA { ...@@ -19,91 +19,113 @@ class SLA {
var $info; var $info;
function SLA($id){ function SLA($id) {
$this->id=0; $this->id=0;
$this->load($id); $this->load($id);
} }
function load($id) { function load($id=0) {
if(!$id && !($id=$this->getId()))
return false;
$sql='SELECT * FROM '.SLA_TABLE.' WHERE id='.db_input($id); $sql='SELECT * FROM '.SLA_TABLE.' WHERE id='.db_input($id);
if(($res=db_query($sql)) && db_num_rows($res)) { if(!($res=db_query($sql)) || !db_num_rows($res))
$info=db_fetch_array($res); return false;
$this->id=$info['id'];
$this->info=$info; $this->ht=db_fetch_array($res);
return true; $this->id=$this->ht['id'];
} return true;
return false;
} }
function reload() { function reload() {
return $this->load($this->getId()); return $this->load();
} }
function getId(){ function getId() {
return $this->id; return $this->id;
} }
function getName(){ function getName() {
return $this->info['name']; return $this->ht['name'];
} }
function getGracePeriod(){ function getGracePeriod() {
return $this->info['grace_period']; return $this->ht['grace_period'];
} }
function getNotes(){ function getNotes() {
return $this->info['notes']; return $this->ht['notes'];
} }
function getInfo(){ function getHashtable() {
return $this->info; return $this->ht;
} }
function isActive(){ function getInfo() {
return ($this->info['isactive']); return $this->getHashtable();
} }
function sendAlerts(){ function isActive() {
return (!$this->info['disable_overdue_alerts']); return ($this->ht['isactive']);
} }
function priorityEscalation(){ function sendAlerts() {
return ($this->info['enable_priority_escalation']); return (!$this->ht['disable_overdue_alerts']);
} }
function update($vars,&$errors){ function priorityEscalation() {
if(SLA::save($this->getId(),$vars,$errors)){ return ($this->ht['enable_priority_escalation']);
$this->reload(); }
return true;
} function update($vars,&$errors) {
return false; if(!SLA::save($this->getId(),$vars,$errors))
return false;
$this->reload();
return true;
} }
function delete(){ function delete() {
global $cfg; global $cfg;
if($cfg && $cfg->getDefaultSLAId()==$this->getId()) if(!$cfg || $cfg->getDefaultSLAId()==$this->getId())
return false; return false;
$id=$this->getId(); $id=$this->getId();
$sql='DELETE FROM '.SLA_TABLE.' WHERE id='.db_input($id).' LIMIT 1'; $sql='DELETE FROM '.SLA_TABLE.' WHERE id='.db_input($id).' LIMIT 1';
if(db_query($sql) && ($num=db_affected_rows())){ if(db_query($sql) && ($num=db_affected_rows())) {
db_query('UPDATE '.DEPT_TABLE.' SET sla_id=0 WHERE sla_id='.db_input($id)); db_query('UPDATE '.DEPT_TABLE.' SET sla_id=0 WHERE sla_id='.db_input($id));
db_query('UPDATE '.TOPIC_TABLE.' SET sla_id=0 WHERE sla_id='.db_input($id)); db_query('UPDATE '.TOPIC_TABLE.' SET sla_id=0 WHERE sla_id='.db_input($id));
db_query('UPDATE '.TICKET_TABLE.' SET sla_id=0 WHERE sla_id='.db_input($id)); db_query('UPDATE '.TICKET_TABLE.' SET sla_id='.db_input($cfg->getDefaultSLAId()).' WHERE sla_id='.db_input($id));
} }
return $num; return $num;
} }
/** static functions **/ /** static functions **/
function create($vars,&$errors){ function create($vars,&$errors) {
return SLA::save(0,$vars,$errors); return SLA::save(0,$vars,$errors);
} }
function getIdByName($name){ function getSLAs() {
$slas=array();
$sql='SELECT id, name FROM '.SLA_TABLE;
if(($res=db_query($sql)) && db_num_rows($res)) {
while(list($id, $name)=db_fetch_row($res))
$slas[$id]=$name;
}
return $slas;
}
function getIdByName($name) {
$sql='SELECT id FROM '.SLA_TABLE.' WHERE name='.db_input($name); $sql='SELECT id FROM '.SLA_TABLE.' WHERE name='.db_input($name);
if(($res=db_query($sql)) && db_num_rows($res)) if(($res=db_query($sql)) && db_num_rows($res))
...@@ -112,11 +134,11 @@ class SLA { ...@@ -112,11 +134,11 @@ class SLA {
return $id; return $id;
} }
function lookup($id){ function lookup($id) {
return ($id && is_numeric($id) && ($sla= new SLA($id)) && $sla->getId()==$id)?$sla:null; return ($id && is_numeric($id) && ($sla= new SLA($id)) && $sla->getId()==$id)?$sla:null;
} }
function save($id,$vars,&$errors){ function save($id,$vars,&$errors) {
if(!$vars['grace_period']) if(!$vars['grace_period'])
......
...@@ -22,7 +22,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -22,7 +22,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
Email Address: Email Address:
</td> </td>
<td> <td>
<input type="text" size="45" name="email" value="<?php echo $info['email']; ?>">
<input type="text" size="45" name="email" id="email" class="typeahead" value="<?php echo $info['email']; ?>"
autocomplete="off" autocorrect="off" autocapitalize="off">
&nbsp;<span class="error">*&nbsp;<?php echo $errors['email']; ?></span> &nbsp;<span class="error">*&nbsp;<?php echo $errors['email']; ?></span>
<?php <?php
if($cfg->notifyONNewStaffTicket()) { ?> if($cfg->notifyONNewStaffTicket()) { ?>
...@@ -37,7 +39,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -37,7 +39,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
Full Name: Full Name:
</td> </td>
<td> <td>
<input type="text" size="45" name="name" value="<?php echo $info['name']; ?>"> <input type="text" size="45" name="name" id="name" value="<?php echo $info['name']; ?>">
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span> &nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td> </td>
</tr> </tr>
...@@ -46,9 +48,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -46,9 +48,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
Phone Number: Phone Number:
</td> </td>
<td> <td>
<input type="text" size="18" name="phone" value="<?php echo $info['phone']; ?>"> <input type="text" size="18" name="phone" id="phone" value="<?php echo $info['phone']; ?>">
&nbsp;<span class="error">&nbsp;<?php echo $errors['phone']; ?></span> &nbsp;<span class="error">&nbsp;<?php echo $errors['phone']; ?></span>
Ext <input type="text" size="5" name="phone_ext" value="<?php echo $info['phone_ext']; ?>"> Ext <input type="text" size="5" name="phone_ext" id="phone_ext" value="<?php echo $info['phone_ext']; ?>">
&nbsp;<span class="error">&nbsp;<?php echo $errors['phone_ext']; ?></span> &nbsp;<span class="error">&nbsp;<?php echo $errors['phone_ext']; ?></span>
</td> </td>
</tr> </tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment