diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php
index f2859da8..2b9f9759 100644
--- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php
+++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php
@@ -34,17 +34,20 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
protected $_save_message = TRUE;
- // Required abstract functions
+ /** REQUIRED ABSTRACT METHODS **/
+
+ public function attributes($variable=NULL) {
+ return array(
+ 'Service Address'=>$this->service_address ? $this->display('service_address') : 'UNKNOWN',
+ 'Contract Until'=>$this->contract_date_end(TRUE),
+ );
+ }
public function expire() {
// We'll leave it to the Service record to determine when this service expires
return NULL;
}
- public function name($variable=NULL) {
- return $this->service_number;
- }
-
public function password() {
return $this->service_password;
}
@@ -53,7 +56,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
return $this->service_username;
}
- // Local functions
+ /** LOCAL METHODS **/
/**
* If we override the plan that the customers gets (from what the supplier provides).
@@ -200,6 +203,14 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
return $this->ipaddress ? $this->ipaddress : _('Dynamic');
}
+ public function name($variable=NULL) {
+ return $this->service_number;
+ }
+
+ public function namesub($variable=NULL) {
+ return $this->display('service_address');
+ }
+
/**
* If we override the plan that the customers gets (from what the supplier provides).
* @todo This needs to get the plan that was invoiced, not the current plan..
@@ -453,25 +464,5 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
}
-
- /**
- * Get specific service details for use in other modules
- * For Example: Invoice
- *
- * @todo Make the rendered items configurable
- * @todo Change this method name, now that it is public
- */
- public function _details($type) {
- switch ($type) {
- case 'invoice_detail_items':
- return array(
- _('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
- _('Contract Until')=>$this->contract_date_end(TRUE),
- );
- break;
- default:
- return parent::$_details($type);
- }
- }
}
?>
diff --git a/modules/adsl/views/adsl/contract_view.php b/modules/adsl/views/adsl/contract_view.php
deleted file mode 100644
index 519ec6cb..00000000
--- a/modules/adsl/views/adsl/contract_view.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
diff --git a/modules/service/classes/Controller/Service.php b/modules/service/classes/Controller/Service.php
index c9f36962..10fa925b 100644
--- a/modules/service/classes/Controller/Service.php
+++ b/modules/service/classes/Controller/Service.php
@@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Service extends Controller_TemplateDefault {
+ protected $icon = 'fa fa-barcode'; //fa-plug for plugins
}
?>
diff --git a/modules/service/classes/Controller/User/Service.php b/modules/service/classes/Controller/User/Service.php
index cb9583cb..7c57ac91 100644
--- a/modules/service/classes/Controller/User/Service.php
+++ b/modules/service/classes/Controller/User/Service.php
@@ -59,7 +59,7 @@ class Controller_User_Service extends Controller_Service {
->set('o',$so);
Block::factory()
- ->title(sprintf('%s: %s',$so->id(),$so->name()))
+ ->title(sprintf('%s: %s',$so->refnum(TRUE),$so->name()))
->title_icon('fa fa-server')
->body($output);
}
diff --git a/modules/service/classes/Model/Service.php b/modules/service/classes/Model/Service.php
index 866acb04..b82442b8 100644
--- a/modules/service/classes/Model/Service.php
+++ b/modules/service/classes/Model/Service.php
@@ -116,6 +116,15 @@ class Model_Service extends ORM_OSB {
return $this->_plugin;
}
+ /**
+ * Get the attributes of the service
+ *
+ * @return an array of attributes
+ */
+ public function attributes($variable=NULL) {
+ return ($this->_plugin()) ? $this->_plugin()->attributes() : array();
+ }
+
/**
* Get the additional charges associated with this service
*/
@@ -178,13 +187,6 @@ class Model_Service extends ORM_OSB {
return time()+$days*86400 > $this->expire();
}
- /**
- * Display the service number
- */
- public function id() {
- return sprintf('%05s',$this->id);
- }
-
/**
* List invoices for this service
*/
@@ -291,10 +293,6 @@ class Model_Service extends ORM_OSB {
return $this->price(TRUE)*$multiple;
}
- public function service_change() {
- return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
- }
-
/**
* Return the service charge
*/
@@ -313,19 +311,8 @@ class Model_Service extends ORM_OSB {
return $format ? Currency::display($p) : $p;
}
- /**
- * Render some details for specific calls, eg: invoice
- */
- public function details($type) {
- $plugin = $this->plugin();
-
- switch ($type) {
- case 'invoice_detail_items':
- return is_null($plugin) ? array() : $plugin->_details($type);
-
- default:
- throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
- }
+ public function service_change() {
+ return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
}
public function service_view() {
@@ -368,7 +355,6 @@ class Model_Service extends ORM_OSB {
public function list_byplugin($plugin) {
return $this
->join('product')
- ->on($this->table_name().'.site_id','=','product.site_id') // @todo This should be automatic
->on($this->table_name().'.product_id','=','product.id')
->where('prod_plugin_file','=',$plugin)
->and_where('service.status','=',TRUE)
@@ -417,12 +403,5 @@ class Model_Service extends ORM_OSB {
->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
->find_all();
}
-
- /**
- * List services that need to be provisioned
- */
- public function list_provision() {
- return $this->_where_active()->where('queue','=','PROVISION');
- }
}
?>
diff --git a/modules/service/classes/Model/Service/Plugin.php b/modules/service/classes/Model/Service/Plugin.php
index 6cb61fe7..abc083d7 100644
--- a/modules/service/classes/Model/Service/Plugin.php
+++ b/modules/service/classes/Model/Service/Plugin.php
@@ -17,22 +17,26 @@ abstract class Model_Service_Plugin extends ORM_OSB {
'service'=>array(),
);
+ /** REQUIRED ABSTRACT METHODS **/
+
+ /**
+ * Service attributes
+ */
+ abstract public function attributes($variable=NULL);
+
/**
* When does our service expire
*/
abstract public function expire();
- /**
- * Our service name as defined in the DB
- */
- abstract public function name();
-
/**
* The table attributes that provide username/password values
*/
abstract public function password();
abstract public function username();
+ /** LOCAL METHODS **/
+
/**
* Provide the button that launches the management of this service, generally from a 3rd party
*/
@@ -93,30 +97,5 @@ $(document).ready(function() {
return View::factory(sprintf('service/user/plugin/%s/view',$this->plugin()))
->set('o',$this);
}
-
- /**
- * Show our service name as defined in the DB with product suffix.
- */
- public function service_name() {
- return sprintf('%s - %s',$this->service->product->title(),$this->name());
- }
-
- /**
- * Get specific service details for use in other modules
- * For Example: Invoice
- *
- * @todo Make the rendered items configurable
- * @todo Change this method name, now that it is public
- */
- public function _details($type) {
- switch ($type) {
- // Nothing to add for invoices
- case 'invoice_detail_items':
- return array();
-
- default:
- throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
- }
- }
}
?>
diff --git a/modules/ssl/classes/Model/Service/Plugin/Ssl.php b/modules/ssl/classes/Model/Service/Plugin/Ssl.php
index c0e46f67..db348df4 100644
--- a/modules/ssl/classes/Model/Service/Plugin/Ssl.php
+++ b/modules/ssl/classes/Model/Service/Plugin/Ssl.php
@@ -33,21 +33,33 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
protected $_save_message = TRUE;
- // Required abstract functions
+ /** REQUIRED ABSTRACT METHODS **/
+
+ public function attributes($variable=NULL) {
+ return array(
+ 'SSL DN'=>$this->namesub($variable),
+ 'Valid From'=>$this->ca->valid_from(TRUE),
+ 'Valid To'=>$this->ca->valid_to(TRUE),
+ );
+ }
public function expire($format=FALSE) {
- return $this->_so->get_valid_to($format);
+ return (! $this->_so) ? ($format ? 'Not Issued' : 0) : $this->_so->get_valid_to($format);
}
public function name($variable=NULL) {
return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr');
}
+ public function namesub($variable=NULL) {
+ return $this->ca->dn();
+ }
+
public function password() {} // Not used
public function username() {} // Not used
- // Local functions
+ /** LOCAL METHODS **/
private $_so = NULL;
@@ -204,23 +216,5 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return $this;
}
-
- /**
- * Get specific service details for use in other modules
- * For Example: Invoice
- *
- * @todo Make the rendered items configurable
- * @todo Change this method name, now that it is public
- */
- // @todo This needs to be validated for this model
- public function _details($type) {
- switch ($type) {
- case 'invoice_detail_items':
- return array();
- break;
- default:
- return parent::$_details($type);
- }
- }
}
?>
diff --git a/modules/statement/views/statement/user/show.php b/modules/statement/views/statement/user/show.php
index 06b6b1e7..ab6cc81e 100644
--- a/modules/statement/views/statement/user/show.php
+++ b/modules/statement/views/statement/user/show.php
@@ -29,7 +29,7 @@