Internal overhaul

This commit is contained in:
Deon George
2013-11-28 17:41:34 +11:00
parent 0ed5e5163d
commit f8a5b153cf
91 changed files with 1570 additions and 1619 deletions

View File

@@ -15,10 +15,6 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
protected $_updated_column = FALSE;
// Relationships
protected $_belongs_to = array(
'service'=>array(),
);
protected $_has_one = array(
'provided_plan'=>array('model'=>'Product_Plugin_Adsl','far_key'=>'provided_adsl_plan_id','foreign_key'=>'id'),
);
@@ -36,7 +32,10 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
),
);
protected $_save_message = TRUE;
// Required abstract functions
public function expire() {
// We'll leave it to the Service record to determine when this service expires
return NULL;
@@ -46,43 +45,15 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
return $this->service_number;
}
public function username_value() {
return $this->service_username;
}
public function password_value() {
public function password() {
return $this->service_password;
}
// Override our parent function to include some JS.
public function admin_update() {
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("#service_connect_date_label").datepicker({
autoclose : true,
startDate : now,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[id=service_connect_date]").val(ev.date.valueOf()/1000);
});
$("#service_contract_date_label").datepicker({
autoclose : true,
startDate : now,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[id=service_contract_date]").val(ev.date.valueOf()/1000);
});
});
');
return parent::admin_update();
public function username() {
return $this->service_username;
}
/** LOCAL FUNCTIONS **/
// Local functions
/**
* If we override the plan that the customers gets (from what the supplier provides).
@@ -99,7 +70,8 @@ $(document).ready(function() {
}
public function contract_date_end($format=FALSE) {
$x = strtotime(sprintf('+%s months',$this->contract_term),$this->service_contract_date);
// ADSL Contract Terms are held in the ADSL Plan
$x = strtotime(sprintf('+%s months',$this->service->plugin()->contract_term),$this->service_contract_date);
return $format ? Config::date($x) : $x;
}
@@ -475,6 +447,7 @@ $(document).ready(function() {
->where_open()
->and_where($this->_table_name.'.service_number','like','%'.$term.'%')
->or_where($this->_table_name.'.service_address','like','%'.$term.'%')
->or_where($this->_table_name.'.ipaddress','like','%'.$term.'%')
->where_close();
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);