<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class supports Email Logging
 *
 * @package    OSB
 * @subpackage Email
 * @category   Models
 * @author     Deon George
 * @copyright  (c) 2010 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Model_Email_Log extends ORMOSB {
	// Email Log doesnt use the update column
	protected $_updated_column = FALSE;

	protected $_belongs_to = array(
		'account'=>array('far_key'=>'id'),
		'email_template_translate'=>array('far_key'=>'id'),
	);

	protected $_sorting = array(
		'id'=>'DESC',
	);

	protected $_display_filters = array(
		'date_orig'=>array(
			array('Config::datetime',array(':value')),
		),
	);

	public function translate_resolve($column) {
		if (! $this->data OR ! ($this->email_template_translate->variables($column)))
			return $this->email_template_translate->display($column);
		else
			return $this->email_template_translate->resolve($this->data,$column);
	}
}
?>
