Overhauled export, and other minor updates
This commit is contained in:
42
modules/export/classes/Model/Export/Module.php
Normal file
42
modules/export/classes/Model/Export/Module.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports OSB exporting.
|
||||
*
|
||||
* @package Export
|
||||
* @category Model
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Export_Module extends ORM_OSB {
|
||||
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 $_nullifempty = array(
|
||||
'display',
|
||||
);
|
||||
|
||||
public function list_export() {
|
||||
$o = $this->module->module();
|
||||
|
||||
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*90)
|
||||
->find_all();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user