added CSV output for MYOB. Hope it works

This commit is contained in:
Karl Cordes 2010-06-24 12:01:58 +10:00
parent 7d4dfc8e23
commit 7d1acd18b4
3 changed files with 17 additions and 0 deletions

View file

@ -201,6 +201,11 @@ class CustomersController extends AppController {
}
function csv() {
$this->set('customers', $this->Customer->find('all', array('recursive'=>0)));
$this->layout = 'csv';
}
}

6
views/customers/csv.ctp Normal file
View file

@ -0,0 +1,6 @@
<?php //debug($customers); ?>
<?php foreach($customers as $cust) {
echo $cust['Customer']['name'].",".$cust['Customer']['abn']."\n";
}
?>

6
views/layouts/csv.ctp Normal file
View file

@ -0,0 +1,6 @@
<?
header("Content-type:application/csv");
echo $content_for_layout;
?>