Minor fixes to statement, services and internal things

Many misc updates
This commit is contained in:
Deon George
2011-10-14 16:44:12 +11:00
parent 7876a16413
commit 56c11507f4
71 changed files with 2192 additions and 677 deletions

View File

@@ -22,7 +22,7 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
*/
public function action_export() {
if (empty($_POST['plugin']))
$this->request->redirect('affiliate/export');
$this->request->redirect('affiliate/export/index');
$sc = sprintf('Export_%s',$_POST['plugin']);
if (! class_exists($sc))
@@ -38,43 +38,40 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
* 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($daysago) {
public function action_index() {
// @todo this should come from a file list
$TBRexportplugins = array('quicken'=>'Export to Quicken');
if (! $daysago)
$daysago = 30;
// @todo: Need to limit this to affiliate acounts
$payments = ORM::factory('payment')
->export($daysago);
if (count($payments)) {
$output = Form::open(Request::current()->uri(array('action'=>'export')));
$output .= '<table class="box-left">';
$output .= View::factory('export/payment/header')
->set('plugins',$TBRexportplugins);
$i = 0;
foreach ($payments as $payment) {
$output .= View::factory('export/payment/body')
->set('payment',$payment)
->set('i',$i++%2);
}
$output .= '</table>';
$output .= Form::submit('submit','export',array('class'=>'form_button'));
$output .= Form::close();
Style::add(array(
'type'=>'file',
'data'=>'css/list.css',
));
$p = ORM::factory('payment');
if ($p->find_all()->count()) {
Block::add(array(
'title'=>_('Payments to Export'),
'body'=>$output,
'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