Removed redundant functions, some Standardisation work
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
class Model_Invoice extends ORM implements Cartable {
|
||||
protected $_belongs_to = array(
|
||||
'account'=>array()
|
||||
);
|
||||
@@ -54,14 +54,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
|
||||
/** REQUIRED ABSTRACT METHODS **/
|
||||
|
||||
/**
|
||||
* Display the Invoice Reference Number
|
||||
*/
|
||||
public function refnum($short=FALSE) {
|
||||
return ($short ? '' : $this->account->refnum(FALSE).'-').sprintf('%06s',$this->id);
|
||||
}
|
||||
|
||||
|
||||
/** REQUIRED INTERFACE METHODS **/
|
||||
|
||||
public function cart_item() {
|
||||
@@ -127,7 +119,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
$c = 0;
|
||||
if (! $this->_loaded)
|
||||
foreach ($this->_sub_items as $iio)
|
||||
$iio->id = 'FAKE:'.$c++;
|
||||
$iio->id = '****:'.$c++;
|
||||
|
||||
// First work through our recurring schedule items
|
||||
$result['s'] = array();
|
||||
@@ -191,14 +183,15 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
*/
|
||||
public function items_summary() {
|
||||
$result = array();
|
||||
$lo = $this->account->language;
|
||||
|
||||
foreach ($this->subitems() as $iio) {
|
||||
// We only summarise item_type=0
|
||||
if (! $iio->item_type == 0)
|
||||
continue;
|
||||
|
||||
if ($iio->module() instanceof Model_Product) {
|
||||
$p = $iio->module()->title();
|
||||
if ($iio->product) {
|
||||
$p = $iio->product->name($lo);
|
||||
|
||||
if (! isset($result[$p])) {
|
||||
$result[$p]['quantity'] = 0;
|
||||
@@ -258,6 +251,13 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the Invoice Reference Number
|
||||
*/
|
||||
public function refnum($short=FALSE) {
|
||||
return ($short ? '' : $this->account->refnum(FALSE).'-').sprintf('%06s',$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the reminder value
|
||||
*/
|
||||
|
Reference in New Issue
Block a user