Other files not original in git

This commit is contained in:
Deon George 2022-06-13 12:15:28 +10:00
parent fed590c325
commit 5a00d080f9
7 changed files with 226 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports ADSL products
*
* @package ADSL
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Product_Plugin_Voip extends Model_Product_Plugin {
protected $_table_name = 'voip_plan';
// Our required abstract methods
public function cost($annual=FALSE) {
$x = 50;
return $annual ? $x*12 : $x;
}
// @todo Select the ADSL Plan for this product.
public function render_edit() {
return '';
}
public function supplier() {
return '';
}
// Local functions
}
?>

View File

@ -0,0 +1,131 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports Services
*
* @package ADSL
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Service_Plugin_Voip extends Model_Service_Plugin {
protected $_table_name = 'service__voip';
protected $_created_column = FALSE;
protected $_updated_column = FALSE;
// Relationships
protected $_has_one = array(
);
protected $_has_many = array(
);
protected $_display_filters = array(
'service_connect_date'=>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'; }
}
?>

View File

@ -0,0 +1,8 @@
<fieldset>
<legend>VOIP Service Details</legend>
<?php
echo View::factory('field/text')->set('data',['field'=>'plugin[service_number]','value'=>'','text'=>'Service Number','class'=>'col-md-2']);
?>
</fieldset>

View File

@ -0,0 +1,10 @@
<fieldset>
<legend>VOIP Features</legend>
<div class="dl-horizontal">
<dt>Calls</dt>
<dd>Included</dd>
</div> <!-- /dl-horizontal -->
</fieldset>

View File

@ -0,0 +1,14 @@
<fieldset>
<legend>VOIP Service Details</legend>
<?php
echo View::factory('field/text')->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']);
?>
</fieldset>

View File

@ -0,0 +1,29 @@
<div class="span6">
<fieldset>
<legend>Service Details</legend>
<div class="dl-horizontal">
<dt>Service Number</dt>
<dd><?php echo $o->display('service_number'); ?></dd>
<dt>Service Address</dt>
<dd><?php echo $o->display('service_address'); ?></dd>
<dt>Connect Date</dt>
<dd><?php echo $o->display('service_connect_date'); ?></dd>
<dt>Contract Term</dt>
<dd><?php echo $o->display('contract_term'); ?></dd>
<dt>Contract End Date</dt>
<dd><?php echo $o->contract_date_end(TRUE); ?></dd>
<dt>Service Username</dt>
<dd><?php echo $o->display('service_username'); ?></dd>
<dt>Service Password</dt>
<dd>Contact Us for Details</dd>
</div> <!-- dl-horizontal -->
</fieldset>
</div> <!-- /span -->