minor fixes

This commit is contained in:
Deon George
2011-12-22 21:20:19 +11:00
parent 5b1e7aeb22
commit 7fdba208eb
5 changed files with 20 additions and 19 deletions

View File

@@ -55,6 +55,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
foreach (ORM::factory('account',$_REQUEST['key'])->invoices_due() as $io)
$output .= View::factory($this->viewpath().'/body')
->set('trc',$i++%2 ? 'odd' : 'even')
->set('pio',ORM::factory('payment_item'))
->set('io',$io);
// @todo Need the JS to add up the payment allocation before submission
@@ -97,23 +98,23 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin {
if ($_POST) {
if (isset($_POST['payment_item']) AND count($_POST['payment_item'])) {
foreach ($_POST['payment_item'] as $k=>$v) {
$pio = $po->add_item();
$pio->invoice_id = $k;
$pio->alloc_amt = $v;
if ($v) {
$pio = $po->add_item();
$pio->invoice_id = $k;
$pio->alloc_amt = $v;
}
}
}
if ($po->changed()) {
// Entry updated
if (! $po->values($_POST)->check() OR ! $po->save())
throw new Kohana_Exception('Unable to save payment');
else
SystemMessage::add(array(
'title'=>'Payment Recorded',
'type'=>'info',
'body'=>'Payment successfully recorded.',
));
}
// Entry updated
if (! $po->values($_POST)->check() OR ! $po->save())
throw new Kohana_Exception('Unable to save payment');
else
SystemMessage::add(array(
'title'=>'Payment Recorded',
'type'=>'info',
'body'=>'Payment successfully recorded.',
));
}
$output .= Form::open();