50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class supports OSB exporting.
|
|
*
|
|
* @package Export
|
|
* @category Models
|
|
* @author Deon George
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
* @license http://dev.osbill.net/license.html
|
|
*/
|
|
class Model_Export_Module extends ORM {
|
|
protected $_created_column = FALSE;
|
|
protected $_updated_column = FALSE;
|
|
|
|
// Relationships
|
|
protected $_belongs_to = array(
|
|
'export' => array(),
|
|
'module' => array(),
|
|
);
|
|
protected $_has_many = array(
|
|
'export_item' => array('far_key'=>'id'),
|
|
);
|
|
|
|
protected $_compress_column = array(
|
|
'display',
|
|
);
|
|
|
|
protected $_nullifempty = array(
|
|
'display',
|
|
);
|
|
|
|
public function list_export($days=NULL) {
|
|
if (! is_numeric($days))
|
|
$days = 90;
|
|
|
|
$o = $this->module->instance();
|
|
|
|
return $o
|
|
->select(array($this->export_item->table_name().'.date_orig','exported'))
|
|
->join($this->export_item->table_name(),'LEFT OUTER')
|
|
->on($this->export_item->table_name().'.site_id','=',$o->table_name().'.site_id') // @todo This should be automatic
|
|
->on($this->export_item->table_name().'.item_id','=',$o->table_name().'.id')
|
|
->on('export_module_id','=',$this->id)
|
|
->where($o->table_name().'.date_orig','>=',time()-86400*$days)
|
|
->find_all();
|
|
}
|
|
}
|
|
?>
|