More Standardisation work.
This commit is contained in:
@@ -64,7 +64,7 @@ class Controller_Reseller_Service extends Controller_Service {
|
||||
->data($svs)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
'name()'=>'Service',
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'account->refnum()'=>'Cust ID',
|
||||
|
@@ -59,7 +59,7 @@ class Controller_User_Service extends Controller_Service {
|
||||
->set('o',$so);
|
||||
|
||||
Block::factory()
|
||||
->title(sprintf('%s: %s',$so->id(),$so->service_name()))
|
||||
->title(sprintf('%s: %s',$so->id(),$so->name()))
|
||||
->title_icon('fa fa-server')
|
||||
->body($output);
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
* + queue: PROVISION (to be provisioned)
|
||||
*/
|
||||
class Model_Service extends ORM_OSB {
|
||||
private $_plugin = NULL;
|
||||
|
||||
// Relationships
|
||||
protected $_has_one = array(
|
||||
'service_billing'=>array('far_key'=>'account_billing_id','foreign_key'=>'id'),
|
||||
@@ -79,11 +81,41 @@ class Model_Service extends ORM_OSB {
|
||||
'price_override',
|
||||
);
|
||||
|
||||
protected $_form = array('id'=>'id','value'=>'service_name()');
|
||||
protected $_form = array('id'=>'id','value'=>'name()');
|
||||
|
||||
// Cache our calls to our plugins
|
||||
public static $plugin = array();
|
||||
|
||||
/** REQUIRED ABSTRACT METHODS **/
|
||||
|
||||
/**
|
||||
* Display the service product name
|
||||
*/
|
||||
public function name($variable=NULL) {
|
||||
if (! $variable instanceOf Model_Language)
|
||||
$variable = Company::instance()->language();
|
||||
|
||||
return $this->product->name($variable).(($x=$this->namesub($variable)) ? ': '.$x : '');
|
||||
}
|
||||
|
||||
public function namesub($variable=NULL) {
|
||||
return is_null($plugin=$this->_plugin()) ? '' : $plugin->name($variable);
|
||||
}
|
||||
|
||||
public function refnum($short=FALSE) {
|
||||
return ($short ? '' : sprintf('%02s-',Site::id())).sprintf('%05s',$this->id);
|
||||
}
|
||||
|
||||
/** LOCAL METHODS **/
|
||||
|
||||
private function _plugin() {
|
||||
if (! $this->_plugin AND $this->product->prod_plugin_file) {
|
||||
$this->_plugin = ORM::factory(Kohana::classname(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file)),array('service_id'=>$this->id));
|
||||
}
|
||||
|
||||
return $this->_plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the additional charges associated with this service
|
||||
*/
|
||||
@@ -200,13 +232,6 @@ class Model_Service extends ORM_OSB {
|
||||
->order_by('date_stop','DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the service product name
|
||||
*/
|
||||
public function name() {
|
||||
return is_null($plugin=$this->plugin()) ? $this->product->title() : $plugin->name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date that an item has been paid to
|
||||
*/
|
||||
@@ -270,13 +295,6 @@ class Model_Service extends ORM_OSB {
|
||||
return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a descriptive name for this service
|
||||
*/
|
||||
public function service_name($chars=NULL) {
|
||||
return HTML::abbr(is_null($x=$this->plugin()) ? $this->name() : $x->service_name(),$chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service charge
|
||||
*/
|
||||
@@ -323,7 +341,7 @@ class Model_Service extends ORM_OSB {
|
||||
/**
|
||||
* Search for services matching a term
|
||||
*/
|
||||
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=NULL) {
|
||||
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=array()) {
|
||||
// We only show service numbers.
|
||||
if (! is_numeric($term) AND (! $limit))
|
||||
return array();
|
||||
@@ -364,7 +382,7 @@ class Model_Service extends ORM_OSB {
|
||||
if ($so->product->prod_plugin_file == $cat)
|
||||
array_push($result,$so);
|
||||
|
||||
Sort::MASort($result,'service_name()');
|
||||
Sort::MASort($result,array('name()'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
19
modules/service/views/service/list.php
Normal file
19
modules/service/views/service/list.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<!-- o = Array of Model_Service -->
|
||||
<?php echo Table::factory()
|
||||
->jssort('service')
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'name()'=>'Service',
|
||||
'plugin()->expire(TRUE)'=>'Expire',
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'account->refnum()'=>'Cust ID',
|
||||
'account->name()'=>'Customer',
|
||||
'date_next_invoice'=>'Next Invoice',
|
||||
'due(TRUE)'=>'Due Invoices',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
));
|
||||
?>
|
@@ -4,7 +4,7 @@
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
'name()'=>'Service',
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'charges(TRUE,TRUE)'=>'Charges',
|
||||
|
15
modules/service/views/service/user/list.php
Normal file
15
modules/service/views/service/user/list.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<!-- o = Array of Model_Service -->
|
||||
<?php echo Table::factory()
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'name()'=>'Service',
|
||||
'recur_schedule'=>'Billing',
|
||||
'price(TRUE,TRUE)'=>'Price',
|
||||
'status'=>'Active',
|
||||
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
));
|
||||
?>
|
@@ -3,7 +3,7 @@
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
'name()'=>'Service',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
|
@@ -3,10 +3,13 @@
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name(59)'=>'Service',
|
||||
'name()'=>'Service',
|
||||
'expire(TRUE)'=>'Date',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
->postproc(array(
|
||||
'name()'=>array('trim'=>60),
|
||||
));
|
||||
?>
|
||||
|
@@ -3,10 +3,13 @@
|
||||
->data($o)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name(60)'=>'Service',
|
||||
'name()'=>'Service',
|
||||
'date_end'=>'Date',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
->postproc(array(
|
||||
'name()'=>array('trim'=>60),
|
||||
));
|
||||
?>
|
||||
|
Reference in New Issue
Block a user