OSB enhancements to date
This commit is contained in:
41
modules/payment/classes/model/payment.php
Normal file
41
modules/payment/classes/model/payment.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports OSB exporting by rending the exportable items.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Export
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Payment extends ORMOSB {
|
||||
// Relationships
|
||||
protected $_has_many = array(
|
||||
'payment_item'=>array(),
|
||||
'invoice'=>array('through'=>'payment_item'),
|
||||
);
|
||||
protected $_belongs_to = array(
|
||||
'account'=>array(),
|
||||
'checkout'=>array('foreign_key'=>'checkout_plugin_id'),
|
||||
);
|
||||
|
||||
protected $_sorting = array('date_payment'=>'DESC');
|
||||
|
||||
protected $_formats = array(
|
||||
'date_payment'=>array('Model_Invoice::_filters'=>array('date','d-m-Y')),
|
||||
'total_amt'=>array('Currency::display'=>array()),
|
||||
);
|
||||
|
||||
/**
|
||||
* Find all items that are exportable.
|
||||
*
|
||||
* @param int $start List payments that were modified this many days ago
|
||||
*/
|
||||
public function export($start) {
|
||||
return ORM::factory('payment')
|
||||
->where('date_payment','>=',time()-$start*86400)
|
||||
->find_all();
|
||||
}
|
||||
}
|
15
modules/payment/classes/model/payment/item.php
Normal file
15
modules/payment/classes/model/payment/item.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class supports OSB exporting by rending the exportable items.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Export
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Payment_Item extends ORMOSB {
|
||||
protected $_belongs_to = array('payment'=>array(),'invoice'=>array());
|
||||
}
|
Reference in New Issue
Block a user