From 9ea9a9b52d28d8829440e5e92c30195096cd81a0 Mon Sep 17 00:00:00 2001
From: jdelhome3578
Date: Fri, 15 Nov 2013 13:08:24 -0500
Subject: [PATCH 01/16] Order by department
---
include/class.dept.php | 86 +++++++++++++++++++++---------------------
1 file changed, 44 insertions(+), 42 deletions(-)
diff --git a/include/class.dept.php b/include/class.dept.php
index 8e34e2ba..daaf6e36 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -1,7 +1,7 @@
@@ -18,23 +18,23 @@ class Dept {
var $email;
var $sla;
- var $manager;
+ var $manager;
var $members;
var $groups;
var $ht;
-
+
function Dept($id) {
$this->id=0;
$this->load($id);
}
-
+
function load($id=0) {
global $cfg;
if(!$id && !($id=$this->getId()))
return false;
-
+
$sql='SELECT dept.*,dept.dept_id as id,dept.dept_name as name, dept.dept_signature as signature, count(staff.staff_id) as users '
.' FROM '.DEPT_TABLE.' dept '
.' LEFT JOIN '.STAFF_TABLE.' staff ON (dept.dept_id=staff.dept_id) '
@@ -66,21 +66,21 @@ function asVar() {
function getId() {
return $this->id;
}
-
+
function getName() {
return $this->ht['name'];
}
-
+
function getEmailId() {
return $this->ht['email_id'];
}
function getEmail() {
-
+
if(!$this->email && $this->getEmailId())
$this->email=Email::lookup($this->getEmailId());
-
+
return $this->email;
}
@@ -88,7 +88,7 @@ function getNumStaff() {
return $this->ht['users'];
}
-
+
function getNumUsers() {
return $this->getNumStaff();
}
@@ -103,14 +103,14 @@ function getMembers() {
$this->members = array();
$sql='SELECT DISTINCT s.staff_id FROM '.STAFF_TABLE.' s '
.' LEFT JOIN '.GROUP_DEPT_TABLE.' g ON(s.group_id=g.group_id) '
- .' INNER JOIN '.DEPT_TABLE.' d
- ON(d.dept_id=s.dept_id
- OR d.manager_id=s.staff_id
+ .' INNER JOIN '.DEPT_TABLE.' d
+ ON(d.dept_id=s.dept_id
+ OR d.manager_id=s.staff_id
OR (d.dept_id=g.dept_id AND d.group_membership=1)
) '
.' WHERE d.dept_id='.db_input($this->getId())
.' ORDER BY s.lastname, s.firstname';
-
+
if(($res=db_query($sql)) && db_num_rows($res)) {
while(list($id)=db_fetch_row($res))
$this->members[] = Staff::lookup($id);
@@ -140,11 +140,11 @@ function getTemplateId() {
function getTemplate() {
if(!$this->template && $this->getTemplateId())
- $this->template = EmailTemplateGroup::lookup($this->getTemplateId());
+ $this->template = Template::lookup($this->getTemplateId());
return $this->template;
}
-
+
function getAutoRespEmail() {
if(!$this->autorespEmail && $this->ht['autoresp_email_id'] && ($email=Email::lookup($this->ht['autoresp_email_id'])))
@@ -154,12 +154,12 @@ function getAutoRespEmail() {
return $this->autorespEmail;
}
-
+
function getEmailAddress() {
if(($email=$this->getEmail()))
return $email->getAddress();
}
-
+
function getSignature() {
return $this->ht['signature'];
}
@@ -167,13 +167,13 @@ function getSignature() {
function canAppendSignature() {
return ($this->getSignature() && $this->isPublic());
}
-
+
function getManagerId() {
return $this->ht['manager_id'];
}
function getManager() {
-
+
if(!$this->manager && $this->getManagerId())
$this->manager=Staff::lookup($this->getManagerId());
@@ -191,11 +191,11 @@ function isManager($staff) {
function isPublic() {
return ($this->ht['ispublic']);
}
-
+
function autoRespONNewTicket() {
return ($this->ht['ticket_auto_response']);
}
-
+
function autoRespONNewMessage() {
return ($this->ht['message_auto_response']);
}
@@ -208,7 +208,7 @@ function noreplyAutoResp() {
function isGroupMembershipEnabled() {
return ($this->ht['group_membership']);
}
-
+
function getHashtable() {
return $this->ht;
}
@@ -218,7 +218,7 @@ function getInfo() {
}
-
+
function getAllowedGroups() {
if($this->groups) return $this->groups;
@@ -244,9 +244,9 @@ function updateAllowedGroups($groups) {
}
}
-
+
$sql='DELETE FROM '.GROUP_DEPT_TABLE.' WHERE dept_id='.db_input($this->getId());
- if($groups && is_array($groups))
+ if($groups && is_array($groups))
$sql.=' AND group_id NOT IN('.implode(',', db_input($groups)).')';
db_query($sql);
@@ -262,13 +262,13 @@ function update($vars, &$errors) {
$this->updateAllowedGroups($vars['groups']);
$this->reload();
-
+
return true;
}
function delete() {
global $cfg;
-
+
if(!$cfg || $this->getId()==$cfg->getDefaultDeptId() || $this->getNumUsers())
return 0;
@@ -317,7 +317,7 @@ function getDefaultDeptName() {
}
function getDepartments( $criteria=null) {
-
+
$depts=array();
$sql='SELECT dept_id, dept_name FROM '.DEPT_TABLE.' WHERE 1';
if($criteria['publiconly'])
@@ -326,6 +326,8 @@ function getDepartments( $criteria=null) {
if(($manager=$criteria['manager']))
$sql.=' AND manager_id='.db_input(is_object($manager)?$manager->getId():$manager);
+ $sql.=' ORDER BY dept_name';
+
if(($res=db_query($sql)) && db_num_rows($res)) {
while(list($id, $name)=db_fetch_row($res))
$depts[$id] = $name;
@@ -347,13 +349,13 @@ function create($vars, &$errors) {
function save($id, $vars, &$errors) {
global $cfg;
-
+
if($id && $id!=$vars['id'])
$errors['err']='Missing or invalid Dept ID (internal error).';
-
+
if(!$vars['email_id'] || !is_numeric($vars['email_id']))
$errors['email_id']='Email selection required';
-
+
if(!is_numeric($vars['tpl_id']))
$errors['tpl_id']='Template selection required';
@@ -362,15 +364,15 @@ function save($id, $vars, &$errors) {
} elseif(strlen($vars['name'])<4) {
$errors['name']='Name is too short.';
} elseif(($did=Dept::getIdByName($vars['name'])) && $did!=$id) {
- $errors['name']='Department already exists';
+ $errors['name']='Department already exist';
}
-
+
if(!$vars['ispublic'] && ($vars['id']==$cfg->getDefaultDeptId()))
- $errors['ispublic']='System default department cannot be private';
+ $errors['ispublic']='System default department can not be private';
if($errors) return false;
-
+
$sql='SET updated=NOW() '
.' ,ispublic='.db_input($vars['ispublic'])
.' ,email_id='.db_input($vars['email_id'])
@@ -384,25 +386,25 @@ function save($id, $vars, &$errors) {
.' ,ticket_auto_response='.db_input(isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1)
.' ,message_auto_response='.db_input(isset($vars['message_auto_response'])?$vars['message_auto_response']:1);
-
+
if($id) {
$sql='UPDATE '.DEPT_TABLE.' '.$sql.' WHERE dept_id='.db_input($id);
if(db_query($sql) && db_affected_rows())
return true;
-
+
$errors['err']='Unable to update '.Format::htmlchars($vars['name']).' Dept. Error occurred';
-
+
} else {
$sql='INSERT INTO '.DEPT_TABLE.' '.$sql.',created=NOW()';
if(db_query($sql) && ($id=db_insert_id()))
return $id;
-
+
$errors['err']='Unable to create department. Internal error';
-
+
}
-
+
return false;
}
From 656c2ed704378a5af03a9076ee0e16ca42862518 Mon Sep 17 00:00:00 2001
From: jdelhome3578
Date: Fri, 15 Nov 2013 13:22:31 -0500
Subject: [PATCH 02/16] Department selection with Help Topic lookup
---
include/client/open.inc.php | 95 ++++++++++++++++++++++++++++++++++---
1 file changed, 88 insertions(+), 7 deletions(-)
diff --git a/include/client/open.inc.php b/include/client/open.inc.php
index 275e856d..80c7d357 100644
--- a/include/client/open.inc.php
+++ b/include/client/open.inc.php
@@ -11,7 +11,14 @@
$info=($_POST && $errors)?Format::htmlchars($_POST):$info;
?>
Open a New Ticket
-Please fill in the form below to open a new ticket.
+isKnowledgebaseEnabled()){
+ //FIXME: provide ability to feature or select random FAQs ??
+?>
+Be sure to browse our Frequently Asked Questions (FAQs), before opening a ticket.
+
+Please fill in the form below to open a new ticket
+
From 943261b0a9b73b682c372c1d993718822e445c0b Mon Sep 17 00:00:00 2001
From: jdelhome3578
Date: Fri, 15 Nov 2013 13:24:01 -0500
Subject: [PATCH 03/16] Department selection with Help Topic lookup
---
findtopic.php | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 findtopic.php
diff --git a/findtopic.php b/findtopic.php
new file mode 100644
index 00000000..0954aaaa
--- /dev/null
+++ b/findtopic.php
@@ -0,0 +1,39 @@
+
+
+
From a016f7415dfd4f466dbc33e2532ac66fa4ff7108 Mon Sep 17 00:00:00 2001
From: jdelhome3578
Date: Fri, 15 Nov 2013 13:53:20 -0500
Subject: [PATCH 04/16] Pending Ticket Status
---
include/client/tickets.inc.php | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php
index 8eda7eca..f4c135b5 100644
--- a/include/client/tickets.inc.php
+++ b/include/client/tickets.inc.php
@@ -8,6 +8,9 @@
//Status we are actually going to use on the query...making sure it is clean!
switch(strtolower($_REQUEST['status'])) {
case 'open':
+ case 'pending':
+ $status=strtolower($_REQUEST['status']);
+ break;
case 'closed':
$status=strtolower($_REQUEST['status']);
break;
@@ -98,12 +101,14 @@
+
getNumClosedTickets()) {
?>
-
- >Closed (getNumClosedTickets(); ?>)
+
From 19989a727001f0ef587080eab1b9cb073d660a2d Mon Sep 17 00:00:00 2001
From: jdelhome3578
Date: Fri, 15 Nov 2013 13:54:38 -0500
Subject: [PATCH 05/16] Added order by name
---
include/staff/faq.inc.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php
index 99f40176..a21affff 100644
--- a/include/staff/faq.inc.php
+++ b/include/staff/faq.inc.php
@@ -54,7 +54,7 @@