Skip to content
Snippets Groups Projects
Commit 6c9438fc authored by Jared Hancock's avatar Jared Hancock
Browse files

Keep number of associated filters in canned reply info

parent 36e35188
Branches
Tags
No related merge requests found
...@@ -32,7 +32,7 @@ class Canned { ...@@ -32,7 +32,7 @@ class Canned {
return false; return false;
$sql='SELECT canned.*, count(attach.file_id) as attachments, ' $sql='SELECT canned.*, count(attach.file_id) as attachments, '
.' (count(filter.id) > 0) as in_use ' .' count(filter.id) as filters '
.' FROM '.CANNED_TABLE.' canned ' .' FROM '.CANNED_TABLE.' canned '
.' LEFT JOIN '.CANNED_ATTACHMENT_TABLE.' attach ON (attach.canned_id=canned.canned_id) ' .' LEFT JOIN '.CANNED_ATTACHMENT_TABLE.' attach ON (attach.canned_id=canned.canned_id) '
.' LEFT JOIN '.EMAIL_FILTER_TABLE.' filter ON (canned.canned_id = filter.canned_response_id) ' .' LEFT JOIN '.EMAIL_FILTER_TABLE.' filter ON (canned.canned_id = filter.canned_response_id) '
...@@ -64,8 +64,8 @@ class Canned { ...@@ -64,8 +64,8 @@ class Canned {
return $this->isEnabled(); return $this->isEnabled();
} }
function isInUse() { function getNumFilters() {
return $this->ht['in_use']; return $this->ht['filters'];
} }
function getTitle() { function getTitle() {
...@@ -187,7 +187,7 @@ class Canned { ...@@ -187,7 +187,7 @@ class Canned {
} }
function delete(){ function delete(){
if ($this->isInUse()) return false; if ($this->getNumFilters() > 0) return false;
$sql='DELETE FROM '.CANNED_TABLE.' WHERE canned_id='.db_input($this->getId()).' LIMIT 1'; $sql='DELETE FROM '.CANNED_TABLE.' WHERE canned_id='.db_input($this->getId()).' LIMIT 1';
if(db_query($sql) && ($num=db_affected_rows())) { if(db_query($sql) && ($num=db_affected_rows())) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment