This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/service/classes/model/service.php
2011-07-18 16:20:41 +10:00

74 lines
1.6 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(),
);
/**
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'date_next_invoice'=>array(
array('Config::date',array(':value')),
),
'recur_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')),
),
'price'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
);
/**
* 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;
}
}
?>