Move invoice config items into the DB

This commit is contained in:
Deon George
2012-01-12 10:23:35 +11:00
parent 8d53924988
commit 14d5f1939e
5 changed files with 60 additions and 42 deletions

View File

@@ -370,18 +370,13 @@ class Model_Invoice extends ORMOSB {
}
public function min_due($date) {
// @todo This should be a DB confirm item
return ($date < time()) ? time()+Kohana::config('config.invoice.min_due_days')*86400 : $date;
return ($date < time()) ? time()+ORM::factory('invoice')->config('DUE_DAYS_MIN')*86400 : $date;
}
public function save(Validation $validation = NULL) {
// Our items will be clobbered once we save the object, so we need to save it here.
$items = $this->items();
// @todo This is added here so we can do payments
$this->total_amt = $this->total();
$this->billed_amt = 0;
// Save the invoice
parent::save($validation);