diff --git a/include/class.canned.php b/include/class.canned.php index 202f9eeebe447213d9c9cb5e9f3f2929a905cc03..8ba175ba118ee1a7a74e0887ce5933ee0243f253 100644 --- a/include/class.canned.php +++ b/include/class.canned.php @@ -32,7 +32,7 @@ class Canned { return false; $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 ' .' 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) ' @@ -64,8 +64,8 @@ class Canned { return $this->isEnabled(); } - function isInUse() { - return $this->ht['in_use']; + function getNumFilters() { + return $this->ht['filters']; } function getTitle() { @@ -187,7 +187,7 @@ class Canned { } 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'; if(db_query($sql) && ($num=db_affected_rows())) {