Open Source Billing

This commit is contained in:
Deon George
2013-10-10 13:44:53 +11:00
commit b02d70adf0
2344 changed files with 392978 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides OSB exporting capabilities.
*
* @package Export
* @category Controllers/Admin
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_Export extends Controller_TemplateDefault_Admin {
protected $control_title = 'Export';
protected $secure_actions = array(
'add'=>TRUE,
'edit'=>TRUE,
);
/**
* Add Export Maping items
*/
public function action_add() {
$eo = ORM::factory('Export');
$output = '';
if ($_POST AND $eo->values($_POST)->check()) {
$eo->module_id = ORM::factory('Module',array('name'=>'product'))->id; // @todo This probably should be in the form.
$eo->plugin_name = 'quicken'; // @todo This should be in the form.
// Entry updated
if (! $eo->save())
throw new Kohana_Exception('Unable to save data :post',array(':post'=>serialize($_POST)));
SystemMessage::add(array(
'title'=>_('Record add'),
'type'=>'info',
'body'=>_('Export Map entry added.')
));
}
$output .= Form::open();
$output .= View::factory($this->viewpath())
->set('eo',$eo);
$output .= '<div>'.Form::submit('submit',_('Add'),array('class'=>'form_button')).'</div>';
$output .= Form::close();
Block::add(array(
'title'=>_('Add Export Map'),
'body'=>$output,
));
}
/**
* Edit Export Maping items
*/
public function action_edit() {
}
}
?>

View File

@@ -0,0 +1,87 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides OSB exporting capabilities.
*
* @package Export
* @category Controllers/Affiliate
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
protected $control_title = 'Export';
protected $secure_actions = array(
'index'=>TRUE,
'export'=>TRUE,
);
/**
* Export plugins must define an export action.
*/
public function action_export() {
if (empty($_POST['plugin']))
$this->request->redirect('affiliate/export/index');
$sc = Kohana::classname('Export_'.$_POST['plugin']);
if (! class_exists($sc))
throw new Kohana_Exception('Export Class doesnt exist for :plugin',array(':plugin'=>$_POST['plugin']));
else
$export = new $sc;
// @todo: Need to limit this to affiliate acounts
$export->export();
}
/**
* This is the main call to export, providing a list of items to export and
* setting up the page to call the export plugin when submitted.
*/
public function action_index() {
// @todo this should come from a file list
$TBRexportplugins = array('quicken'=>'Export to Quicken');
// @todo: Need to limit this to affiliate acounts
$p = ORM::factory('Payment');
if ($p->find_all()->count()) {
Block::add(array(
'title'=>_('Payments to Export'),
'body'=>Table::display(
$p->find_all(),
25,
array(
'id'=>array('label'=>'ID'),
'date_payment'=>array('label'=>'Date'),
'checkout->display("name")'=>array('label'=>'Method'),
'account->accnum()'=>array('label'=>'Acc Num'),
'account->name()'=>array('label'=>'Account'),
'total_amt'=>array('label'=>'Total','class'=>'right'),
'balance(TRUE)'=>array('label'=>'Balance','class'=>'right'),
'invoicelist()'=>array('label'=>'Invoices'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'affiliate/export/export',
'hidden'=>array(
Form::hidden('plugin','quicken'),
),
'button'=>array(
Form::submit('submit',_('Export'),array('class'=>'form_button')),
),
)),
));
# Nothing to export
} else {
SystemMessage::add(array(
'title'=>_('No payments to export'),
'type'=>'info',
'body'=>sprintf(_('There are no payments within the last %s days (since %s) to show.'),
$daysago,date(Kohana::$config->load('osb')->date_format,$daysago*86400+time())),
));
}
}
}
?>

View File

@@ -0,0 +1,14 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides service management
*
* @package Export
* @category Controllers
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Export extends Controller_TemplateDefault {
}
?>