Work on Email and other major consistency work

This commit is contained in:
Deon George
2013-11-22 15:36:50 +11:00
parent 89deb9c97b
commit c18d5a3881
55 changed files with 550 additions and 575 deletions

View File

@@ -22,6 +22,9 @@ class Controller_User_Invoice extends Controller_Invoice {
public function action_download() {
$io = ORM::factory('Invoice',$this->request->param('id'));
if (! $io->loaded() OR ! Auth::instance()->authorised($io->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
// Log the download
$imo = $io->invoice_memo;
$imo->invoice_id = $io->id;

View File

@@ -215,7 +215,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
return $format ? Currency::display($result) : $result;
}
//ZZ
/**
* Return a list of valid checkout options for this invoice
*/
@@ -508,11 +507,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
if (! $iio->changed())
continue;
if (! $iio->check()) {
// @todo Mark invoice as cancelled and write a memo, then...
throw new Kohana_Exception('Problem saving invoice_item for invoice :invoice - Failed check()',array(':invoice'=>$this->id));
}
$iio->save();
if (! $iio->saved()) {
@@ -548,7 +542,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
} else
throw new Kohana_Exception('Couldnt save invoice for some reason?');
return TRUE;
return $this;
}
public function set_remind($key,$value,$add=FALSE) {

View File

@@ -188,9 +188,6 @@ class Model_Invoice_Item extends ORM_OSB {
}
public function save(Validation $validation = NULL) {
if (! $this->changed())
return;
// Save the invoice item
parent::save($validation);
@@ -214,9 +211,6 @@ class Model_Invoice_Item extends ORM_OSB {
// @todo Rounding here should come from a global config
$iito->amount = round($tax['amount'],2);
if (! $iito->check())
throw new Kohana_Exception('Couldnt save tax for some reason - failed check()?');
$iito->save();
if (! $iito->saved())
@@ -224,6 +218,8 @@ class Model_Invoice_Item extends ORM_OSB {
}
} else
throw new Kohana_Exception('Couldnt save invoice_item for some reason?');
return $this;
}
}
?>