/** * Check usage of template in queue * * @param Mage_Newsletter_Model_Template $template * @return boolean */ public function checkUsageInQueue(Mage_Newsletter_Model_Template $template) { if ($template->getTemplateActual() !== 0 && !$template->getIsSystem()) { $select = $this->_getReadAdapter()->select()->from($this->getTable('newsletter/queue'), new Zend_Db_Expr('COUNT(queue_id)'))->where('template_id = :template_id'); $countOfQueue = $this->_getReadAdapter()->fetchOne($select, array('template_id' => $template->getId())); return $countOfQueue > 0; } elseif ($template->getIsSystem()) { return false; } else { return true; } }
/** * Check usage of template in queue * * @param Mage_Newsletter_Model_Template $template * @return boolean */ public function checkUsageInQueue(Mage_Newsletter_Model_Template $template) { if ($template->getTemplateActual() !== 0 && !$template->getIsSystem()) { $select = $this->_read->select()->from($this->_queueTable, new Zend_Db_Expr('COUNT(queue_id)'))->where('template_id=?', $template->getId()); $countOfQueue = $this->_read->fetchOne($select); return $countOfQueue > 0; } else { if ($template->getIsSystem()) { return false; } else { return true; } } }