This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/payment/classes/model/payment.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2010-11-29 22:41:08 +00:00
<?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('far_key'=>'id'),
2010-11-29 22:41:08 +00:00
'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 $_display_filters = array(
'date_payment'=>array(
array('Config::date',array(':value')),
),
'total_amt'=>array(
array('Currency::display',array(':value')),
),
2010-11-29 22:41:08 +00:00
);
/**
* 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();
}
}