65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||
|
|
||
|
/**
|
||
|
* This class supports Services
|
||
|
*
|
||
|
* @package OSB
|
||
|
* @subpackage Service
|
||
|
* @category Models
|
||
|
* @author Deon George
|
||
|
* @copyright (c) 2010 Open Source Billing
|
||
|
* @license http://dev.osbill.net/license.html
|
||
|
*/
|
||
|
class Model_Service extends ORMOSB {
|
||
|
// Relationships
|
||
|
protected $_has_many = array(
|
||
|
'invoice'=>array('through'=>'invoice_item'),
|
||
|
'adsl_plan'=>array('through'=>'service__adsl'),
|
||
|
);
|
||
|
protected $_has_one = array(
|
||
|
'service_adsl'=>array(),
|
||
|
);
|
||
|
protected $_belongs_to = array(
|
||
|
'product'=>array(),
|
||
|
'account'=>array(),
|
||
|
);
|
||
|
|
||
|
protected $_formats = array(
|
||
|
'active'=>array('StaticList_YesNo::display'=>array()),
|
||
|
'date_next_invoice'=>array('Config::date'=>array()),
|
||
|
'recur_schedule'=>array('StaticList_RecurSchedule::display'=>array()),
|
||
|
'price'=>array(
|
||
|
'Tax::add'=>array(),
|
||
|
'Currency::display'=>array(),
|
||
|
),
|
||
|
);
|
||
|
|
||
|
/**
|
||
|
* Display the service number
|
||
|
*/
|
||
|
public function svcnum() {
|
||
|
return sprintf('%05s',$this->id);
|
||
|
}
|
||
|
|
||
|
// Nothing to directly display on invoices for this module.
|
||
|
public function invoice_display() {
|
||
|
if ($this->sku)
|
||
|
return sprintf('%s: %s',_('Service'),$this->sku);
|
||
|
else
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
public function name() {
|
||
|
return $this->product->product_translate->find()->name;
|
||
|
}
|
||
|
|
||
|
// @todo To implement
|
||
|
/**
|
||
|
* Calculate the tax for this item
|
||
|
*/
|
||
|
public function tax() {
|
||
|
return $this->price * .1;
|
||
|
}
|
||
|
}
|
||
|
?>
|