diff --git a/modules/host/views/service/admin/plugin/host/edit.php b/modules/host/views/service/admin/plugin/host/edit.php new file mode 100644 index 00000000..e69de29b diff --git a/modules/voip/classes/Model/Product/Plugin/Voip.php b/modules/voip/classes/Model/Product/Plugin/Voip.php new file mode 100644 index 00000000..1c27583c --- /dev/null +++ b/modules/voip/classes/Model/Product/Plugin/Voip.php @@ -0,0 +1,34 @@ + diff --git a/modules/voip/classes/Model/Service/Plugin/Voip.php b/modules/voip/classes/Model/Service/Plugin/Voip.php new file mode 100644 index 00000000..0197b58f --- /dev/null +++ b/modules/voip/classes/Model/Service/Plugin/Voip.php @@ -0,0 +1,131 @@ +array( + array('Site::Date',array(':value')), + ), + 'service_contract_date'=>array( + array('Site::Date',array(':value')), + ), + ); + + protected $_save_message = TRUE; + + /** 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 password() { + return $this->service_password; + } + + public function username() { + return $this->service_username; + } + + /** LOCAL METHODS **/ + + /** + * Calculate our contract start and end dates + */ + public function contract_date_start($format=FALSE) { + return $format ? Site::Date($this->service_contract_date) : $this->service_contract_date; + } + + public function contract_date_end($format=FALSE) { + $x = strtotime(sprintf('+%s months',12),$this->service_contract_date); + + return $format ? Site::Date($x) : $x; + } + + 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.. + */ + public function plan($month=NULL) { + return is_null($month) ? $this->service->product->plugin() : $this->plandate($month); + } + + /** + * For a particular month, select the PLAN that the user was on + */ + public function plandate($month) { + throw new Kohana_Exception('This function hasnt been written yet.'); + } + + /** + * Return the template variables, used mainly in emailing + * + * @param array Variables that need to be expanded + * @param array Data that was previously calculated + */ + public function template_variables(array $array,array $data=array()) { + $result = array(); + + $friendly = array( + ); + } + + /** + * Search for services matching a term + */ + public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=array()) { + $ao = Auth::instance()->get_user(); + + $options['key'] = 'id'; + $options['object'] = DB::select($this->_table_name.'.id',$this->_table_name.'.service_number') + ->from($this->_table_name) + ->join('service') + ->on('service.id','=',$this->_table_name.'.service_id') + ->where('service.account_id','IN',$ao->RTM->customers($ao->RTM)) + ->and_where('service.active','=',1) + ->where_open() + ->and_where($this->_table_name.'.service_number','like','%'.$term.'%') + ->or_where($this->_table_name.'.service_address','like','%'.$term.'%') + ->where_close(); + + return parent::list_autocomplete($term,$index,$value,$label,$limit,$options); + } + + public function admin_plan() { return 'VOIP'; } +} +?> diff --git a/modules/voip/views/product/plugin/voip/order.php b/modules/voip/views/product/plugin/voip/order.php new file mode 100644 index 00000000..5213ae73 --- /dev/null +++ b/modules/voip/views/product/plugin/voip/order.php @@ -0,0 +1,8 @@ +
+ VOIP Service Details + +set('data',['field'=>'plugin[service_number]','value'=>'','text'=>'Service Number','class'=>'col-md-2']); +?> + +
diff --git a/modules/voip/views/product/plugin/voip/view.php b/modules/voip/views/product/plugin/voip/view.php new file mode 100644 index 00000000..9ebabb29 --- /dev/null +++ b/modules/voip/views/product/plugin/voip/view.php @@ -0,0 +1,10 @@ +
+ VOIP Features + +
+ +
Calls
+
Included
+ +
+
diff --git a/modules/voip/views/service/admin/plugin/voip/edit.php b/modules/voip/views/service/admin/plugin/voip/edit.php new file mode 100644 index 00000000..f07017be --- /dev/null +++ b/modules/voip/views/service/admin/plugin/voip/edit.php @@ -0,0 +1,14 @@ +
+ VOIP Service Details + +set('data',['field'=>'plugin[service_number]','value'=>$o->service_number,'text'=>'Service Number','class'=>'col-md-2']); + echo View::factory('field/text')->set('data',['field'=>'plugin[service_address]','value'=>$o->service_address,'text'=>'Service Address','class'=>'col-md-6']); + echo View::factory('field/date')->set('data',['field'=>'plugin[service_connect_date]','value'=>$o->service_connect_date,'text'=>'Service Connect Date','enddate'=>NULL]); + echo View::factory('field/date')->set('data',['field'=>'plugin[service_contract_date]','value'=>$o->service_contract_date,'text'=>'Contract Start Date','enddate'=>'new Date()']); + echo View::factory('field/text')->set('data',['field'=>'plugin[contract_term]','value'=>$o->contract_term,'text'=>'Override Contract Term','class'=>'col-md-1']); + echo View::factory('field/text')->set('data',['field'=>'plugin[service_username]','value'=>$o->service_username,'text'=>'Service Username','class'=>'col-md-4']); + echo View::factory('field/text')->set('data',['field'=>'plugin[service_password]','value'=>$o->service_password,'text'=>'Service Password','class'=>'col-md-2']); +?> + +
diff --git a/modules/voip/views/service/user/plugin/voip/view.php b/modules/voip/views/service/user/plugin/voip/view.php new file mode 100644 index 00000000..1bc33689 --- /dev/null +++ b/modules/voip/views/service/user/plugin/voip/view.php @@ -0,0 +1,29 @@ +
+
+ Service Details + +
+
Service Number
+
display('service_number'); ?>
+ +
Service Address
+
display('service_address'); ?>
+ +
Connect Date
+
display('service_connect_date'); ?>
+ +
Contract Term
+
display('contract_term'); ?>
+ +
Contract End Date
+
contract_date_end(TRUE); ?>
+ +
Service Username
+
display('service_username'); ?>
+ +
Service Password
+
Contact Us for Details
+ +
+
+