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

74 lines
1.6 KiB
PHP
Raw Normal View History

2010-11-29 22:41:08 +00:00
<?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(
2011-07-13 22:59:32 +00:00
'service_adsl'=>array('far_key'=>'id'),
2010-11-29 22:41:08 +00:00
);
protected $_belongs_to = array(
'product'=>array(),
'account'=>array(),
);
2011-05-14 07:35:33 +00:00
/**
* 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')),
),
2010-11-29 22:41:08 +00:00
'price'=>array(
2011-05-14 07:35:33 +00:00
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
2010-11-29 22:41:08 +00:00
),
);
/**
* 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;
}
}
?>