diff --git a/application/classes/Auth/OSB.php b/application/classes/Auth/OSB.php index eaa05ec7..8354e5fe 100644 --- a/application/classes/Auth/OSB.php +++ b/application/classes/Auth/OSB.php @@ -188,6 +188,10 @@ class Auth_OSB extends Auth_ORM { return $uo; } + public function get_groups() { + return is_null($x=$this->get_user()) ? ORM::factory('Group')->where('id','=',0)->find_all() : $x->groups(); + } + /** * OSB authentication is controlled via database queries. * diff --git a/application/classes/Controller/Admin/Module.php b/application/classes/Controller/Admin/Module.php index e57a9f81..51a3eb89 100644 --- a/application/classes/Controller/Admin/Module.php +++ b/application/classes/Controller/Admin/Module.php @@ -171,13 +171,11 @@ class Controller_Admin_Module extends Controller_Module { * List our installed modules */ public function action_list() { - $mo = ORM::factory('Module'); - Block::factory() ->title('Defined Modules') ->title_icon('icon-cog') ->body(Table::factory() - ->data($mo->find_all()) + ->data(ORM::factory('Module')->where('parent_id','is',NULL)->find_all()) ->jssort(TRUE) ->columns(array( 'id'=>'ID', diff --git a/application/classes/Controller/Reseller/Account.php b/application/classes/Controller/Reseller/Account.php index c1907709..178edf69 100644 --- a/application/classes/Controller/Reseller/Account.php +++ b/application/classes/Controller/Reseller/Account.php @@ -33,7 +33,7 @@ class Controller_Reseller_Account extends Controller_Account { 'name(TRUE)'=>'Account', 'email'=>'Email', 'invoices_due_total(NULL,TRUE)'=>'Invoices', - 'services_count(TRUE)'=>'Services', + 'service->list_count()'=>'Services', )) ->prepend(array( 'id'=>array('url'=>URL::link('reseller','account/view/')), diff --git a/application/classes/Controller/User/Welcome.php b/application/classes/Controller/User/Welcome.php index 02c32aad..5d75ff1d 100644 --- a/application/classes/Controller/User/Welcome.php +++ b/application/classes/Controller/User/Welcome.php @@ -22,13 +22,13 @@ class Controller_User_Welcome extends Controller_Welcome { ->span(6) ->body(Table::factory() ->data($this->ao->service->list_active()) - ->columns(array( - 'id'=>'ID', - 'service_name()'=>'Service', - )) - ->prepend(array( - 'id'=>array('url'=>URL::link('user','service/view/')), - )) + ->columns(array( + 'id'=>'ID', + 'service_name()'=>'Service', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('user','service/view/')), + )) ); Block::factory() @@ -43,15 +43,15 @@ class Controller_User_Welcome extends Controller_Welcome { ->span(6) ->body(Table::factory() ->data($this->ao->invoice->list_due()) - ->columns(array( - 'id'=>'ID', - 'due_date'=>'Date Due', - 'total(TRUE)'=>'Invoice Total', - 'due(TRUE)'=>'Amount Due', - )) - ->prepend(array( - 'id'=>array('url'=>URL::link('user','invoice/view/')), - )) + ->columns(array( + 'id'=>'ID', + 'due_date'=>'Date Due', + 'total(TRUE)'=>'Invoice Total', + 'due(TRUE)'=>'Amount Due', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('user','invoice/view/')), + )) ); Block::factory() @@ -60,14 +60,14 @@ class Controller_User_Welcome extends Controller_Welcome { ->span(6) ->body(Table::factory() ->data($this->ao->service->list_expiring()) - ->columns(array( - 'id'=>'ID', - 'service_name()'=>'Service', - 'expire(TRUE)'=>'Date', - )) - ->prepend(array( - 'id'=>array('url'=>URL::link('user','service/view/')), - )) + ->columns(array( + 'id'=>'ID', + 'service_name()'=>'Service', + 'expire(TRUE)'=>'Date', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('user','service/view/')), + )) ); } } diff --git a/application/classes/Model/Account.php b/application/classes/Model/Account.php index 1966cb72..c891a0ed 100644 --- a/application/classes/Model/Account.php +++ b/application/classes/Model/Account.php @@ -146,19 +146,6 @@ class Model_Account extends Model_Auth_UserDefault { return trim(sprintf('%s %s',$this->first_name,$this->last_name).(($withcompany AND $this->company) ? sprintf(' (%s)',$this->company) : '')); } - /** - * List all the services for this account - */ - public function services($active=TRUE) { - $o = $this->service; - - return $active ? $o->where_active()->find_all() : $o->find_all(); - } - - public function services_count($active=TRUE) { - return $this->services($active)->count(); - } - /** * The key we use to sort entries of this model type */ diff --git a/application/classes/Model/Group.php b/application/classes/Model/Group.php index afa3f20e..1c6f4d83 100644 --- a/application/classes/Model/Group.php +++ b/application/classes/Model/Group.php @@ -67,5 +67,12 @@ class Model_Group extends Model_Auth_Role { return $result; } + + /** + * Get a list of groups that have their own pricing + */ + public function list_pricegroups() { + return $this->where_active()->where('pricing','=',TRUE)->find_all(); + } } ?> diff --git a/application/classes/ORM/OSB.php b/application/classes/ORM/OSB.php index 0cecfd1c..3ae56306 100644 --- a/application/classes/ORM/OSB.php +++ b/application/classes/ORM/OSB.php @@ -261,8 +261,10 @@ abstract class ORM_OSB extends ORM { /** * Function help to find records that are active */ - public function list_active() { - return $this->_where_active()->find_all(); + public function list_active($active=TRUE) { + $x=($active ? $this->_where_active() : $this); + + return $x->find_all(); } public function list_count($active=TRUE) { diff --git a/application/config/debug.php b/application/config/debug.php index 6db7ce9c..54d97f36 100644 --- a/application/config/debug.php +++ b/application/config/debug.php @@ -19,6 +19,9 @@ return array 'email_admin_only'=> array( // Override emails and send them to an admin instead #'task_invoice_list_overdue'=>array('deon@leenooks.net'=>'Deon George'), ), + 'email_bcc_admin'=> array( // Blind copy all email to an admin, in the format 'email'=>'name', +// 'deon@leenooks.net'=>'Deon George', + ), 'invoice'=>0, // Number of invoices to generate in a pass 'site'=>FALSE, // Glogal site debug 'show_errors'=>FALSE, // Show errors instead of logging in the DB. diff --git a/application/views/account/user/edit.php b/application/views/account/user/edit.php index 3715576c..cd351e5f 100644 --- a/application/views/account/user/edit.php +++ b/application/views/account/user/edit.php @@ -1,58 +1,58 @@ -
-
-
- Update Account Details +
+
+ Update Account Details - display('date_last'),array('label'=>'Last Updated','disabled')); ?> + display('date_last'),array('label'=>'Last Updated','disabled')); ?> - display('username'),array('label'=>'User Name','disabled')); ?> + display('username'),array('label'=>'User Name','disabled')); ?> - display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?> + display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?> - display('title'),array('class'=>'input-small','label'=>'Title','required')); ?> - -
-
- display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?> -
- -
- display('last_name'),array('label'=>'','class'=>'input-large','placeholder'=>'Last Name','required')); ?> -
+
+
+ display('title'),array('class'=>'input-small','label'=>'Title','required')); ?>
- display('company'),array('label'=>'Company','class'=>'input-xxlarge','placeholder'=>'Company Name')); ?> - - display('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?> - - display('address2'),array('label'=>'','class'=>'input-xxlarge')); ?> - -
-
- display('city'),array('label'=>'City','placeholder'=>'City','required')); ?> -
- -
- display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?> -
- -
- display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?> -
-
- - list_select(),$o->country_id,array('label'=>'Country','required')); ?> - - list_select(),$o->language_id,array('label'=>'Language','required')); ?> - - list_select(),$o->currency_id,array('label'=>'Currency','required')); ?> - -
-
- - -
+
+ display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?>
-
-
-
+ +
+ display('last_name'),array('label'=>'','class'=>'input-large','placeholder'=>'Last Name','required')); ?> +
+
+ + display('company'),array('label'=>'Company','class'=>'input-xxlarge','placeholder'=>'Company Name')); ?> + + display('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?> + + display('address2'),array('label'=>'','class'=>'input-xxlarge')); ?> + +
+
+ display('city'),array('label'=>'City','placeholder'=>'City','required')); ?> +
+ +
+ display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?> +
+ +
+ display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?> +
+
+ + list_select(),$o->country_id,array('label'=>'Country','required')); ?> + + list_select(),$o->language_id,array('label'=>'Language','required')); ?> + + list_select(),$o->currency_id,array('label'=>'Currency','required')); ?> + + +
+
+ + +
+
+ diff --git a/application/views/account/user/resetpassword.php b/application/views/account/user/resetpassword.php index 6e9cbe2e..46071f09 100644 --- a/application/views/account/user/resetpassword.php +++ b/application/views/account/user/resetpassword.php @@ -1,16 +1,14 @@ -
-
-
- Reset Password +
+
+ Reset Password - 'Password','type'=>'password','required','minlength'=>8)); ?> - 'Confirm','type'=>'password','required','minlength'=>8)); ?> + 'Password','type'=>'password','required','minlength'=>8)); ?> + 'Confirm','type'=>'password','required','minlength'=>8)); ?> +
-
-
- -
-
-
-
-
+
+
+ +
+
+ diff --git a/application/views/module/method/admin/add.php b/application/views/module/method/admin/add.php index 77aec032..8a0dc900 100644 --- a/application/views/module/method/admin/add.php +++ b/application/views/module/method/admin/add.php @@ -1,18 +1,16 @@ -
-
-
- Add Method +
+
+ Add Method - 'Method','disabled')); ?> - 'Description','placeholder'=>'Method Description','class'=>'span8')); ?> - 'Menu Title','placeholder'=>'Menu Title')); ?> + 'Method','disabled')); ?> + 'Description','placeholder'=>'Method Description','class'=>'span8')); ?> + 'Menu Title','placeholder'=>'Menu Title')); ?> +
-
-
- - -
-
-
-
-
+
+
+ + +
+
+ diff --git a/application/views/module/method/admin/edit.php b/application/views/module/method/admin/edit.php index e46137ca..4b9ad6a0 100644 --- a/application/views/module/method/admin/edit.php +++ b/application/views/module/method/admin/edit.php @@ -1,29 +1,26 @@ -
-
-
- Configure Method +
+
+ Method Details - notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span8')); ?> - menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?> + notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span5')); ?> + menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?> -
-
-
+ +
-
-
-
- Configure Method Security +
+
+ Method Security - - - - - - - +
MethodNotesGroup ActiveMethod Enable
+ + + + + + - + find_all() as $go) : ?> @@ -32,16 +29,14 @@ - -
MethodNotesGroup ActiveMethod Enable
id,TRUE),$go->display('name')); ?>id,$o->has('group',$go)); ?>
+ + +
-
-
- - -
-
- -
-
-
+
+
+ + +
+
+ diff --git a/application/views/setup/admin/edit.php b/application/views/setup/admin/edit.php index eeebc539..e867d22f 100644 --- a/application/views/setup/admin/edit.php +++ b/application/views/setup/admin/edit.php @@ -1,44 +1,42 @@ -
-
-
- Application Setup +
+
+ Application Setup - site_details('name'),array('label'=>'Site Name','class'=>'input-xxlarge','placeholder'=>'Site Name','required')); ?> + site_details('name'),array('label'=>'Site Name','class'=>'input-xxlarge','placeholder'=>'Site Name','required')); ?> - site_details('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?> + site_details('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?> - site_details('address2')); ?> + site_details('address2')); ?> -
-
- site_details('city'),array('label'=>'City','placeholder'=>'City','required')); ?> -
- -
- site_details('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?> -
- -
- site_details('pcode'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?> -
-
- - list_select(),$o->country_id,array('label'=>'Country','required')); ?> - - site_details('phone'),array('label'=>'Phone','type'=>'tel','class'=>'input-medium','placeholder'=>'Phone','required')); ?> - - site_details('fax'),array('label'=>'Fax','type'=>'tel','class'=>'input-medium','placeholder'=>'Fax','required')); ?> - - site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?> - - site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?> - -
-
- - -
+
+
+ site_details('city'),array('label'=>'City','placeholder'=>'City','required')); ?>
-
-
-
+ +
+ site_details('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?> +
+ +
+ site_details('pcode'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?> +
+
+ + list_select(),$o->country_id,array('label'=>'Country','required')); ?> + + site_details('phone'),array('label'=>'Phone','type'=>'tel','class'=>'input-medium','placeholder'=>'Phone','required')); ?> + + site_details('fax'),array('label'=>'Fax','type'=>'tel','class'=>'input-medium','placeholder'=>'Fax','required')); ?> + + site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?> + + site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?> + + +
+
+ + +
+
+ diff --git a/application/views/setup/admin/module.php b/application/views/setup/admin/module.php index 24795324..1508d4d1 100644 --- a/application/views/setup/admin/module.php +++ b/application/views/setup/admin/module.php @@ -1,30 +1,32 @@ -
-
-
-
- +
+
+ Application Setup -
- module_config_id($mid) as $id => $data) : ?> +
+ + + +
+ module_config_id($mid) as $id => $data) : ?>
$v) : ?> $k,'placeholder'=>$k)); ?>
- -
-
-
+ +
-
-
- - -
+
+ + +
+
+ +
-
-
+
+
diff --git a/modules/adsl/classes/Adsl/Billing/Exetelvisp.php b/modules/adsl/classes/Adsl/Billing/Exetelvisp.php index 8dbe52cd..33ac71fe 100644 --- a/modules/adsl/classes/Adsl/Billing/Exetelvisp.php +++ b/modules/adsl/classes/Adsl/Billing/Exetelvisp.php @@ -149,7 +149,7 @@ class ADSL_Billing_Exetelvisp { // @todo This could be optimised better. foreach ($aso->services(TRUE) as $so) - $this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->adsl_supplier_plan->display('base_cost')); + $this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->supplier_plan->display('base_cost')); return $this; } diff --git a/modules/adsl/classes/Controller/Admin/Adsl.php b/modules/adsl/classes/Controller/Admin/Adsl.php index fe60bf61..731d4202 100644 --- a/modules/adsl/classes/Controller/Admin/Adsl.php +++ b/modules/adsl/classes/Controller/Admin/Adsl.php @@ -90,7 +90,7 @@ class Controller_Admin_Adsl extends Controller_Adsl { ->title_icon('icon-th-list') ->body(Table::factory() ->jssort('traffic') - ->data($apo->products()->find_all()) + ->data($apo->products()) ->columns(array( 'id'=>'ID', 'title()'=>'Name', diff --git a/modules/adsl/classes/Model/ADSL/Supplier.php b/modules/adsl/classes/Model/ADSL/Supplier.php index 182b068d..269796d4 100644 --- a/modules/adsl/classes/Model/ADSL/Supplier.php +++ b/modules/adsl/classes/Model/ADSL/Supplier.php @@ -14,7 +14,7 @@ class Model_ADSL_Supplier extends ORM_OSB { // Relationships protected $_has_many = array( - 'adsl_supplier_plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'supplier_id','far_key'=>'id'), + 'plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'supplier_id','far_key'=>'id'), 'traffic'=>array('model'=>'Service_Plugin_Adsl_Traffic','foreign_key'=>'supplier_id','far_key'=>'id'), ); @@ -50,7 +50,7 @@ class Model_ADSL_Supplier extends ORM_OSB { * Return a list of plans that this supplier makes available */ public function find_plans($active=TRUE) { - return $active ? $this->adsl_supplier_plan->where_active() : $this->adsl_supplier_plan; + return $active ? $this->plan->where_active() : $this->plan; } /** @@ -63,8 +63,8 @@ class Model_ADSL_Supplier extends ORM_OSB { foreach ($this->find_plans(FALSE)->find_all() as $aspo) { foreach ($aspo->plan->find_all() as $apo) { - foreach ($apo->products(FALSE)->find_all() as $po) { - foreach ($po->services($active)->find_all() as $so) { + foreach ($apo->products(FALSE) as $po) { + foreach ($po->service->list_active() as $so) { array_push($result,$so); } } diff --git a/modules/adsl/classes/Model/Product/Plugin/Adsl.php b/modules/adsl/classes/Model/Product/Plugin/Adsl.php index 4ce01346..779e566c 100644 --- a/modules/adsl/classes/Model/Product/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Product/Plugin/Adsl.php @@ -19,9 +19,6 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin { protected $_belongs_to = array( 'supplier_plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'adsl_supplier_plan_id'), ); - protected $_has_many = array( - 'product'=>array('far_key'=>'id','foreign_key'=>'prod_plugin_data'), - ); /** * Filters used to format the display of values into friendlier values @@ -59,14 +56,6 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin { 'extra_up_offpeak', ); - // Map the table fields - private $_map = array( - 'base_up_offpeak'=>'extra_up_offpeak', - 'base_down_offpeak'=>'extra_down_offpeak', - 'base_up_peak'=>'extra_up_peak', - 'base_down_peak'=>'extra_down_peak', - ); - // Our required abstract methods public function cost($annual=FALSE) { @@ -75,25 +64,24 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin { return $annual ? $x*12 : $x; } - public function feature_summary() { - return View::factory(sprintf('product/plugin/%s/feature_summary',$this->plugin())) - ->set('o',$this); - } - // @todo Select the ADSL Plan for this product. public function render_edit() { return ''; } - public function render_order() { - return View::factory(sprintf('product/plugin/%s/order',$this->plugin())); - } - public function supplier() { return $this->supplier_plan->supplier_id; } - /** LOCAL FUNCTIONS **/ + // Local functions + + // Map the table fields + private $_map = array( + 'base_up_offpeak'=>'extra_up_offpeak', + 'base_down_offpeak'=>'extra_down_offpeak', + 'base_up_peak'=>'extra_up_peak', + 'base_down_peak'=>'extra_down_peak', + ); /** * Calculate the allowance array or traffic used array @@ -204,19 +192,5 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin { return TRUE; } - - /** - * Get all the products using this plan - */ - public function products($active=FALSE) { - $x = ORM::factory('Product') - ->where('prod_plugin_file','=','ADSL') - ->and_where('prod_plugin_data','=',$this); - - if ($active) - $x->where_active(); - - return $x; - } } ?> diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php index 693013ae..40026975 100644 --- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php @@ -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); diff --git a/modules/adsl/classes/Service/Traffic/Adsl/iiNetADSL.php b/modules/adsl/classes/Service/Traffic/Adsl/iiNetADSL.php index 568de090..04768368 100644 --- a/modules/adsl/classes/Service/Traffic/Adsl/iiNetADSL.php +++ b/modules/adsl/classes/Service/Traffic/Adsl/iiNetADSL.php @@ -42,10 +42,10 @@ class Service_Traffic_ADSL_iiNetADSL extends Service_Traffic_ADSL { // Find our services that need to be collected this way. $update = array(); - foreach ($this->so->services() as $so) { + foreach ($this->aso->services() as $so) { if ($so->service_adsl->service_stats_collect AND $so->service_adsl->service_stats_lastupdate < $date) { $lastperiod = ''; - for ($servicedate=date('Y-m-d',strtotime($this->so->stats_lastupdate.'+1 day')); + for ($servicedate=date('Y-m-d',strtotime($this->aso->stats_lastupdate.'+1 day')); $servicedate <= $this->today; $servicedate=date('Y-m-d',strtotime('+1 day',strtotime($servicedate)))) { @@ -67,7 +67,7 @@ class Service_Traffic_ADSL_iiNetADSL extends Service_Traffic_ADSL { if ($debug AND file_exists($debug_file)) $data = file_get_contents($debug_file); else - $data = Remote::get($this->so->stats_url,$this->curlopts+array(CURLOPT_POSTFIELDS=>$postfields)); + $data = Remote::get($this->aso->stats_url,$this->curlopts+array(CURLOPT_POSTFIELDS=>$postfields)); // @todo There exists a possibility to skip a month, if we get a bad fetch on a previous month. if ($data) diff --git a/modules/adsl/views/adsl/admin/edit.php b/modules/adsl/views/adsl/admin/edit.php index 43763fbf..18a07a5d 100644 --- a/modules/adsl/views/adsl/admin/edit.php +++ b/modules/adsl/views/adsl/admin/edit.php @@ -1,128 +1,146 @@ -
-
+
+
+ ADSL Plan Details +
-
- base_down_peak,array('label'=>'Base Down Peak','class'=>'span1')); ?> -
-
- extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?> -
+
+ + +
+
+ +
+
+ base_down_peak,array('label'=>'Base Down','class'=>'span1')); ?> +
+
+ extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?> +
+
+ +
+
+ base_up_peak,array('label'=>'Base Up','class'=>'span1')); ?> +
+
+ extra_up_peak,array('label'=>'Extra','class'=>'span1')); ?> +
+
+ +
+ +
+ +
+
+ base_down_offpeak,array('label'=>'Base Down','class'=>'span1')); ?> +
+
+ extra_down_offpeak,array('label'=>'Extra','class'=>'span1')); ?> +
+
+ +
+
+ base_up_offpeak,array('label'=>'Base Up','class'=>'span1')); ?> +
+
+ extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?> +
+
+ +
+
+
+
+ +
+ contract_term,array('label'=>'Contract Term','class'=>'span1')); ?>
-
- base_down_offpeak,array('label'=>'Base Down Off Peak','class'=>'span1')); ?> -
-
- extra_down_offpeak,array('label'=>'Extra','class'=>'span1')); ?> -
+ extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?>
-
- base_up_peak,array('label'=>'Base Up Peak','class'=>'span1')); ?> -
-
- extra_up_peak,array('label'=>'Extra','class'=>'span1')); ?> -
+ list_select(),$o->adsl_supplier_plan_id,array('label'=>'Supplier Plan','class'=>'span4')); ?>
+
+ +
+
+ + +
+
+
+ +
+
+ Supplier Details + +
+
Supplier
+
supplier_plan->supplier->name; ?>
+ +
Allowance
+
allowance($o->supplier_plan->traffic_data(),TRUE); ?>
+ +
Cost
+
supplier_plan->display('base_cost'); ?>
+ +
Excess
+
supplier_plan->cost_extra($o->allowance($o->supplier_plan->traffic_data()),TRUE); ?>
+ +
Speed
+
supplier_plan->speed; ?>
+
+
+
+ +
+
+ Test Traffic
- base_up_offpeak,array('label'=>'Base Up Off Peak','class'=>'span1')); ?> + 'Down Peak','class'=>'span1')); ?>
- extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?> + 'Offpeak','class'=>'span1')); ?>
-
- contract_term,array('label'=>'Contract Term','class'=>'span1')); ?> + 'Up Peak','class'=>'span1')); ?> +
+
+ 'Offpeak','class'=>'span1')); ?>
-
- extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?> + 'Charges','class'=>'span1')); ?>
+
-
-
- list_select(),$o->adsl_supplier_plan_id,array('label'=>'Supplier Plan')); ?> -
-
- -
-
- - -
-
-
- -
+
- Supplier Details -
-
Supplier
-
supplier_plan->supplier->name; ?>
+ Test Traffic Result -
Allowance
-
allowance($o->supplier_plan->traffic_data(),TRUE); ?>
+
+ $v) : ?> +
+
+ -
Cost
-
supplier_plan->display('base_cost'); ?>
- -
Excess
-
supplier_plan->cost_extra($o->allowance($o->supplier_plan->traffic_data()),TRUE); ?>
- -
Speed
-
supplier_plan->speed; ?>
-
-
-
- -
-
- Test Traffic -
-
- 'Down Peak','class'=>'span1')); ?> -
-
- 'Offpeak','class'=>'span1')); ?> -
-
-
-
- 'Up Peak','class'=>'span1')); ?> -
-
- 'Offpeak','class'=>'span1')); ?> -
-
-
-
- 'Charges','class'=>'span1')); ?> -
+
Has Offpeak?
+
hasOffpeak(); ?>
- - -
- Test Traffic Result -
- $v) : ?> -
-
- - -
Has Offpeak?
-
hasOffpeak(); ?>
-
-
- -
-
+ +
diff --git a/modules/adsl/views/adsl/admin/stats.php b/modules/adsl/views/adsl/admin/stats.php index 47e0d869..918aff4f 100644 --- a/modules/adsl/views/adsl/admin/stats.php +++ b/modules/adsl/views/adsl/admin/stats.php @@ -31,5 +31,4 @@ - diff --git a/modules/adsl/views/adsl/reseller/billing.php b/modules/adsl/views/adsl/reseller/billing.php index 62ae3e7d..b35894b5 100644 --- a/modules/adsl/views/adsl/reseller/billing.php +++ b/modules/adsl/views/adsl/reseller/billing.php @@ -14,14 +14,14 @@ services(TRUE) as $so) : ?> plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?> - + id),$so->id); ?> - adsl_supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?> + supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?> contract_date_start(TRUE); ?> contract_date_end(TRUE); ?> - adsl_supplier_plan->display('base_cost'); ?> + supplier_plan->display('base_cost'); ?> charge($service_number)); ?> excess($service_number)); ?> diff --git a/modules/adsl/views/adsl/reseller/billing/exetelvisp.php b/modules/adsl/views/adsl/reseller/billing/exetelvisp.php index 488e5638..2ee19f12 100644 --- a/modules/adsl/views/adsl/reseller/billing/exetelvisp.php +++ b/modules/adsl/views/adsl/reseller/billing/exetelvisp.php @@ -1,12 +1,10 @@ -
-
-
+
+
Exetel VISP Billing - - 'Invoice File','required')); ?> -
+ + 'Invoice File','required')); ?> +
- 'btn btn-primary')); ?> -
-
+ 'btn btn-primary')); ?> +
diff --git a/modules/adsl/views/product/category/list/adslcompare-large.php b/modules/adsl/views/product/category/list/adslcompare-large.php index a45540ba..3d931742 100644 --- a/modules/adsl/views/product/category/list/adslcompare-large.php +++ b/modules/adsl/views/product/category/list/adslcompare-large.php @@ -4,72 +4,76 @@
-
-
-
- - - - products() as $po) : ?> - - - +
+
Plan Nametitle(); ?> (id; ?>)
+ + - - - products() as $po) : ?> - price(0,1,'price_base',TRUE)); ?> - - - + products() as $po) : ?> + + + - - - products() as $po) : ?> - - - + + - - - products() as $po) : ?> - - - + products() as $po) : ?> + price_best($o->recur_schedule,TRUE); ?> + price($go->id,$o->recur_schedule,'base',TRUE)); ?> - - - products() as $po) : ?> - - - + + + - plugin()->base_down_offpeak) : ?> - + + + + products() as $po) : ?> + price_best($o->recur_schedule,TRUE); ?> + + + + + + + + products() as $po) : ?> + + + + + + + products() as $po) : ?> + + + + + plugin()->base_down_offpeak) : ?> + - products() as $po) : ?> + products() as $po) : ?> - + + - - - products() as $po) : ?> - - - + + + products() as $po) : ?> + + + - - - products() as $po) : ?> - - - + + + products() as $po) : ?> + + + -
Plan Name
Price - $ . -
title(); ?> (id; ?>)
Connection$price(0,1,'price_setup',TRUE)); ?>
Price
Speedplugin()->supplier_plan->display('speed'); ?>
Peak Downloadsplugin()->base_down_peak/1000; ?>GB
+ $ .recur_schedule); ?> +
Connection$price($go->id,$o->recur_schedule,'setup',TRUE)); ?>
Speedplugin()->supplier_plan->display('speed'); ?>
Peak Downloadsplugin()->base_down_peak/1000; ?>GB
OffPeak Downloadsplugin()->base_down_offpeak/1000; ?>GB
Extra Traffic$plugin()->display('extra_down_peak'); ?>/GB
Extra Traffic$plugin()->display('extra_down_peak'); ?>/GB
Contract Termplugin()->display('contract_term'); ?> mths
Contract Termplugin()->display('contract_term'); ?> mths
-
-
-
+ +
diff --git a/modules/adsl/views/product/category/list/adslcompare.php b/modules/adsl/views/product/category/list/adslcompare.php index a3561781..a0dda90d 100644 --- a/modules/adsl/views/product/category/list/adslcompare.php +++ b/modules/adsl/views/product/category/list/adslcompare.php @@ -4,58 +4,60 @@
-
-
-
-
- products() as $po) : ?> - 1) : ?> -
-
-
- +
+
+ products() as $po) : ?> + price_best($o->recur_schedule,TRUE); ?> + price($go->id,$o->recur_schedule,'base',TRUE)); ?> -
-
+ -
+ 1) : ?> +
+
+
+ -
- title(); ?> (id; ?>) -
+
+
-
- price(0,1,'price_base',TRUE)); ?> - $ . -
+
-
+
+ title(); ?> (id; ?>) +
-
-
    -
  • $price(0,1,'price_setup',TRUE)); ?> Connection
  • -
  • plugin()->supplier_plan->display('speed'); ?> Speed
  • -
  • plugin()->base_down_peak/1000; ?>GB Peak Downloads
  • - plugin()->base_down_offpeak) : ?> +
    + $ .recur_schedule); ?> +
    + +
+ +
+
    +
  • $price($go->id,$o->recur_schedule,'setup',TRUE)); ?> Connection
  • +
  • plugin()->supplier_plan->display('speed'); ?> Speed
  • +
  • plugin()->base_down_peak/1000; ?>GB Peak Downloads
  • + + plugin()->base_down_offpeak) : ?>
  • plugin()->base_down_offpeak/1000; ?>GB OffPeak Downloads
  • - -
  • $plugin()->display('extra_down_peak'); ?>/GB Extra Traffic
  • -
  • plugin()->display('contract_term'); ?> Months Contract
  • -
-
+ -
- -
+
  • $plugin()->display('extra_down_peak'); ?>/GB Extra Traffic
  • +
  • plugin()->display('contract_term'); ?> Months Contract
  • + +
    -
    -
    - +
    + +
    -
    -
    -
    -
    +
    +
    + + +
    +
    diff --git a/modules/adsl/views/product/plugin/adsl/feature_summary.php b/modules/adsl/views/product/plugin/adsl/view.php similarity index 95% rename from modules/adsl/views/product/plugin/adsl/feature_summary.php rename to modules/adsl/views/product/plugin/adsl/view.php index f1c2190c..c3dc5547 100644 --- a/modules/adsl/views/product/plugin/adsl/feature_summary.php +++ b/modules/adsl/views/product/plugin/adsl/view.php @@ -1,4 +1,4 @@ -
    +
    ADSL Features
    diff --git a/modules/adsl/views/service/admin/plugin/adsl/edit.php b/modules/adsl/views/service/admin/plugin/adsl/edit.php index a47de888..96a14b30 100644 --- a/modules/adsl/views/service/admin/plugin/adsl/edit.php +++ b/modules/adsl/views/service/admin/plugin/adsl/edit.php @@ -1,45 +1,39 @@ -
    -
    +
    + ADSL Service Details + +
    service_number,array('class'=>'span2','label'=>'Service Number','placeholder'=>'Service Number')); ?> -
    -
    +
    -
    -
    +
    service_address,array('class'=>'span6','label'=>'Service Address','placeholder'=>'Service Address')); ?> -
    -
    +
    -
    -
    - display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'','disabled')); ?> -
    +
    +
    + display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'','disabled')); ?> +
    - service_connect_date,array('id'=>'service_connect_date')); ?> -
    + service_connect_date,array('id'=>'service_connect_date')); ?> +
    -
    -
    - display('service_contract_date'),array('class'=>'span2','label'=>'Contract Start Date','add-on'=>'','disabled')); ?> -
    +
    +
    + display('service_contract_date'),array('class'=>'span2','label'=>'Contract Start Date','add-on'=>'','disabled')); ?> +
    - service_contract_date,array('id'=>'service_contract_date')); ?> -
    + service_contract_date,array('id'=>'service_contract_date')); ?> +
    -
    -
    +
    service_username,array('class'=>'span6','label'=>'Service Username','placeholder'=>'Service Username')); ?> -
    -
    +
    -
    -
    +
    service_password,array('class'=>'span6','label'=>'Service Password','placeholder'=>'Service Password')); ?> -
    -
    +
    -
    -
    +
    ipaddress,array('class'=>'span6','label'=>'Service IP Address','placeholder'=>'Service IP Address')); ?> -
    -
    +
    +
    diff --git a/modules/adsl/views/service/user/plugin/adsl/table_traffic.php b/modules/adsl/views/service/user/plugin/adsl/table_traffic.php index 4ef2b235..664aab1d 100644 --- a/modules/adsl/views/service/user/plugin/adsl/table_traffic.php +++ b/modules/adsl/views/service/user/plugin/adsl/table_traffic.php @@ -5,6 +5,7 @@ friendly($i); ?> + $details) : ?> diff --git a/modules/adsl/views/service/user/plugin/adsl/view.php b/modules/adsl/views/service/user/plugin/adsl/view.php index b49f404d..1dd755ad 100644 --- a/modules/adsl/views/service/user/plugin/adsl/view.php +++ b/modules/adsl/views/service/user/plugin/adsl/view.php @@ -1,80 +1,79 @@ -
    - Service Details +
    +
    + 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
    -
    display('service_password'); ?>
    - -
    Service IP
    -
    ipaddress(); ?>
    - - hasOffPeak() AND $o->offpeak_start AND $o->offpeak_end) : ?> -
    Offpeak Period
    -
    offpeak_start,$o->offpeak_end); ?>
    - - -
    -
    - -
    - Traffic Usage - -
    -
    Last Month
    -
     traffic_month(strtotime('last month'),TRUE,TRUE); ?>
    - -
    This Month
    -
     traffic_month(strtotime('yesterday'),TRUE,TRUE); ?>
    - -
    Excess Traffic
    -
     $traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?>
    -
    -
    - -
    -
    -
    View Traffic for
    -
    get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?> -
    +
    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
    +
    display('service_password'); ?>
    + +
    Service IP
    +
    ipaddress(); ?>
    + + hasOffPeak() AND $o->offpeak_start AND $o->offpeak_end) : ?> +
    Offpeak Period
    +
    offpeak_start,$o->offpeak_end); ?>
    +
    -
    +
    +
    -
    - +
    +
    + Traffic Usage -
    -
    - traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?> -
    +
    +
    Last Month
    +
     traffic_month(strtotime('last month'),TRUE,TRUE); ?>
    -
    - traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?> -
    +
    This Month
    +
     traffic_month(strtotime('yesterday'),TRUE,TRUE); ?>
    -
    -
    +
    Excess Traffic
    +
     $traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?>
    +
    -
    +
    +
    +
    View Traffic for
    +
    get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?> +
    +
    +
    + +
    + + +
    +
    + traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?> +
    + +
    + traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?> +
    + +
    +
    +
    + diff --git a/modules/charge/classes/Controller/Reseller/Charge.php b/modules/charge/classes/Controller/Reseller/Charge.php index 68bb0f28..30938148 100644 --- a/modules/charge/classes/Controller/Reseller/Charge.php +++ b/modules/charge/classes/Controller/Reseller/Charge.php @@ -69,12 +69,9 @@ class Controller_Reseller_Charge extends Controller_Charge { ->type('stdin') ->data(' $(document).ready(function() { - var nowTemp = new Date(); - var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); - $("#date_charge_label").datepicker({ autoclose : true, - endDate : now, + endDate : new Date(), format : "dd-M-yyyy", todayBtn : true, }).on("hide",function(ev) { diff --git a/modules/charge/views/charge/reseller/add_edit.php b/modules/charge/views/charge/reseller/add_edit.php index 977ea867..0acdf12d 100644 --- a/modules/charge/views/charge/reseller/add_edit.php +++ b/modules/charge/views/charge/reseller/add_edit.php @@ -1,31 +1,28 @@ -
    -
    +
    +
    + Charge Details -
    - Charge Details +
    + display('date_charge'),array('class'=>'span2','label'=>'Date of Charge','add-on'=>'','disabled')); ?> +
    -
    - display('date_charge'),array('class'=>'span2','label'=>'Date of Charge','add-on'=>'','disabled')); ?> -
    + date_charge); ?> + account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead','required')); ?> + account_id); ?> + account_id ? $o->account->service->list_select() : array(),$o->service_id,array('class'=>'span5','label'=>'Service')); ?> + sweep_type) ? 6 : $o->sweep_type,FALSE,array('label'=>'Sweep')); ?> + type) ? 6 : $o->type,FALSE,array('label'=>'Item Type')); ?> - date_charge); ?> - account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead','required')); ?> - account_id); ?> - account_id ? $o->account->service->list_select() : array(),$o->service_id,array('class'=>'span5','label'=>'Service')); ?> - sweep_type) ? 6 : $o->sweep_type,FALSE,array('label'=>'Sweep')); ?> - type) ? 6 : $o->type,FALSE,array('label'=>'Item Type')); ?> + quantity,array('class'=>'span1','label'=>'Quantity','placeholder'=>'Quantity')); ?> + amount,array('class'=>'span1','label'=>'Amount','placeholder'=>'Total',)); ?> + taxable) ? TRUE : $o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?> + description,array('class'=>'span5','label'=>'Description','placeholder'=>'Any notes about this charge?')); ?> - quantity,array('class'=>'span1','label'=>'Quantity','placeholder'=>'Quantity')); ?> - amount,array('class'=>'span1','label'=>'Amount','placeholder'=>'Total',)); ?> - taxable) ? TRUE : $o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?> - description,array('class'=>'span5','label'=>'Description','placeholder'=>'Any notes about this charge?')); ?> + + attributes[$i]) ? $o->attributes[$i] : "",array('class'=>'span5','label'=>'Attributes')); + endfor ?> +
    - - attributes[$i]) ? $o->attributes[$i] : "",array('class'=>'span5','label'=>'Attributes')); - endfor ?> -
    - - 'btn btn-primary')); ?> -
    -
    + 'btn btn-primary')); ?> +
    diff --git a/modules/checkout/classes/Checkout/Plugin.php b/modules/checkout/classes/Checkout/Plugin.php index 3b85bab6..5465f4e3 100644 --- a/modules/checkout/classes/Checkout/Plugin.php +++ b/modules/checkout/classes/Checkout/Plugin.php @@ -8,13 +8,15 @@ * @author Deon George * @copyright (c) 2009-2013 Open Source Billing * @license http://dev.osbill.net/license.html + * * @todo Does this need to be Serializable? */ abstract class Checkout_Plugin implements Serializable { protected $co; // Our Checkout Object protected $_object; - // Our required abstract classes + // Our required abstract classes + public function serialize() { return (string)$this->_object; } @@ -23,6 +25,7 @@ abstract class Checkout_Plugin implements Serializable { } // Required abstract classes + // Present pre-plugin processing information abstract public function before(Cart $co); abstract public function notify(Model_Checkout_Notify $cno); diff --git a/modules/domain/classes/Domain.php b/modules/domain/classes/Domain.php index 72fdd190..b5395650 100644 --- a/modules/domain/classes/Domain.php +++ b/modules/domain/classes/Domain.php @@ -47,7 +47,7 @@ $(document).ready(function() { if ($o->registrar_ns) return is_array($o->registrar_ns) ? implode(',',$o->registrar_ns) : '>Invalid<'; else - return is_array($o->domain_registrar->whitelabel_ns) ? implode(',',$o->domain_registrar->whitelabel_ns) : '>Unknown<'; + return is_array($o->registrar->whitelabel_ns) ? implode(',',$o->registrar->whitelabel_ns) : '>Unknown<'; } } ?> diff --git a/modules/domain/classes/Model/Product/Plugin/Domain.php b/modules/domain/classes/Model/Product/Plugin/Domain.php index fbc9d9d3..72bc101c 100644 --- a/modules/domain/classes/Model/Product/Plugin/Domain.php +++ b/modules/domain/classes/Model/Product/Plugin/Domain.php @@ -10,11 +10,8 @@ * @license http://dev.osbill.net/license.html */ class Model_Product_Plugin_Domain extends Model_Product_Plugin { - // This model doesnt have a database table - public function __construct() { - } - // Our required abstract methods + public function cost($annual=FALSE) { // @todo $x = 0; @@ -22,8 +19,6 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin { return $annual ? $x*12 : $x; } - public function feature_summary() {} - public function render_edit() {} // @todo @@ -31,7 +26,16 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin { return 'internal'; } - /** LOCAL FUNCTIONS **/ + // Overload functions + + // This model doesnt have a database table + public function __construct() { + } + + // Not used + public function render_view() {} + + // Local functions // @todo This is not used, but should be. public function order_features() { diff --git a/modules/domain/classes/Model/Service/Plugin/Domain.php b/modules/domain/classes/Model/Service/Plugin/Domain.php index fa0ebe98..fbd174a8 100644 --- a/modules/domain/classes/Model/Service/Plugin/Domain.php +++ b/modules/domain/classes/Model/Service/Plugin/Domain.php @@ -11,16 +11,14 @@ */ class Model_Service_Plugin_Domain extends Model_Service_Plugin { protected $_table_name = 'service__domain'; + protected $_created_column = FALSE; protected $_updated_column = FALSE; // Relationships protected $_has_one = array( - 'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'), - 'domain_registrar'=>array('foreign_key'=>'id','far_key'=>'domain_registrar_id'), - 'service_plugin_host'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'), - ); - protected $_belongs_to = array( - 'service'=>array(), + 'host'=>array('model'=>'Service_Plugin_Host','through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'), + 'registrar'=>array('model'=>'Domain_Registrar','foreign_key'=>'id','far_key'=>'domain_registrar_id'), + 'tld'=>array('model'=>'Domain_TLD','foreign_key'=>'id','far_key'=>'domain_tld_id'), ); protected $_display_filters = array( @@ -35,44 +33,41 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin { ), ); + protected $_save_message = TRUE; + // Required abstract functions - public function admin_update() { - return ''; - } public function expire() { return $this->domain_expire; } public function name() { - return sprintf('%s.%s',$this->display('domain_name'),$this->domain_TLD->display('name')); + return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name')); } - public function service_name() { - return sprintf('%s - %s',_('Domain Name License'),$this->name()); + public function password() { + return $this->registrar_password; } - public function username_value() { + public function username() { return $this->registrar_username; } - public function password_value() { - return $this->registrar_password; - } + // Local functions /** * This provides us with a manage button to jump to the registrar * to manage the domain. */ public function manage_button($t='') { - if (! parent::manage_button($t)) + if (! parent::manage()) return NULL; - return ($this->username_value() AND $this->password_value()) ? $this->domain_registrar->manage_button($this,$t) : _('Please contact us'); + return ($this->username() AND $this->password()) ? $this->registrar->manage_button($this,$t) : _('Please contact us'); } - public function manage_dns_button() { - return $this->service_plugin_host->manage_button('service_plugin_host'); + public function manage_button_dns() { + return $this->host->manage_button('host'); } /** diff --git a/modules/domain/classes/Service/Domain/PlanetDomain.php b/modules/domain/classes/Service/Domain/PlanetDomain.php index 26f853eb..3a683e15 100644 --- a/modules/domain/classes/Service/Domain/PlanetDomain.php +++ b/modules/domain/classes/Service/Domain/PlanetDomain.php @@ -22,8 +22,8 @@ class Service_Domain_PlanetDomain extends Service_Domain { sprintf('%s/%s',$this->so->whitelabel_url,'newdnr/action/user/login.jsp'), array('target'=>'pd','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t)) ); - $output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t))); - $output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t))); + $output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t))); + $output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t))); $output .= Form::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden')); $output .= Form::close(); $output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t))); diff --git a/modules/domain/classes/Service/Domain/TPP.php b/modules/domain/classes/Service/Domain/TPP.php index 90a96481..94f728d2 100644 --- a/modules/domain/classes/Service/Domain/TPP.php +++ b/modules/domain/classes/Service/Domain/TPP.php @@ -23,8 +23,8 @@ class Service_Domain_TPP extends Service_Domain { $debug ? 'debug/site' : sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'), array('target'=>'tpp','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t)) ); - $output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t))); - $output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t))); + $output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t))); + $output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t))); $output .= Form::close(); $output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t))); diff --git a/modules/domain/views/product/plugin/domain/order.php b/modules/domain/views/product/plugin/domain/order.php new file mode 100644 index 00000000..9bea8386 --- /dev/null +++ b/modules/domain/views/product/plugin/domain/order.php @@ -0,0 +1,7 @@ +
    + Domain Service Details + +
    + 'span2','label'=>'Domain Name','placeholder'=>'Domain Name','required')); ?> +
    +
    diff --git a/modules/domain/views/service/user/plugin/domain/view.php b/modules/domain/views/service/user/plugin/domain/view.php index 10e3cdbb..e2156049 100644 --- a/modules/domain/views/service/user/plugin/domain/view.php +++ b/modules/domain/views/service/user/plugin/domain/view.php @@ -17,7 +17,7 @@
    - manage_dns_button()) : ?> + manage_button_dns()) : ?>
    DNS
    diff --git a/modules/email/classes/Email/Template.php b/modules/email/classes/Email/Template.php index d7592e1a..32de7a0d 100644 --- a/modules/email/classes/Email/Template.php +++ b/modules/email/classes/Email/Template.php @@ -134,8 +134,8 @@ class Email_Template { } } - if (isset($this->_data['bcc'])) - $sm->setBcc($this->bcc); + if ($x=Arr::merge($this->bcc,Kohana::$config->load('debug.email_bcc_admin'))) + $sm->setBcc($x); if ($admin OR ($admin = Config::testmail($this->_etto->template->name))) { $sm->setTo($admin); diff --git a/modules/email/classes/Model/Email/Template/Translate.php b/modules/email/classes/Model/Email/Template/Translate.php index 38050d7d..4d17496b 100644 --- a/modules/email/classes/Model/Email/Template/Translate.php +++ b/modules/email/classes/Model/Email/Template/Translate.php @@ -17,6 +17,10 @@ class Model_Email_Template_Translate extends ORM_OSB { 'template'=>array('model'=>'Email_Template','foreign_key'=>'email_template_id'), ); + protected $_has_one = array( + 'language'=>array('foreign_key'=>'id'), + ); + protected $_save_message = TRUE; public function complete($data,$column) { diff --git a/modules/email/views/email/admin/add_edit_template.php b/modules/email/views/email/admin/add_edit_template.php index 6acb7e09..85d357c3 100644 --- a/modules/email/views/email/admin/add_edit_template.php +++ b/modules/email/views/email/admin/add_edit_template.php @@ -1,38 +1,30 @@ -
    -
    -
    -
    - name,array('label'=>'Name','class'=>'span3')); ?> -
    -
    +
    +
    + Update Template
    -
    - status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?> -
    + name,array('label'=>'Name','class'=>'span3')); ?>
    -
    - notes,array('label'=>'Notes','class'=>'span8')); ?> -
    -
    + status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?> +
    -
    - list_select(TRUE),'',array('label'=>'Language','required')); ?> -
    -
    + notes,array('label'=>'Notes','class'=>'span8')); ?> +
    -
    -
    + list_select(TRUE),'',array('label'=>'Language','required')); ?> +
    + -
    -
    - - -
    +
    + +
    +
    + +
    -
    + diff --git a/modules/email/views/email/admin/ajaxtemplatetranslate.php b/modules/email/views/email/admin/ajaxtemplatetranslate.php index fa52ea05..17d080cd 100644 --- a/modules/email/views/email/admin/ajaxtemplatetranslate.php +++ b/modules/email/views/email/admin/ajaxtemplatetranslate.php @@ -1,4 +1,7 @@ -
    +
    + $o->id,':language'=>$o->language->name)); ?> + +
    subject,array( 'label'=>'Email Subject', 'placeholder'=>'Email Subject', @@ -6,7 +9,7 @@ 'required', 'help-block'=>sprintf('This is the subject line on the email. Uses variables: %s',implode(', ',array_values($o->variables('subject')))))); ?>
    -
    +
    message_text,array( 'label'=>'Message Text', 'placeholder'=>'Message Text', @@ -14,7 +17,7 @@ 'required', 'help-block'=>sprintf('The message in plain text that is used in the email for email clients that cannot render HTML. Uses variables: %s',implode(', ',array_values($o->variables('message_text')))))); ?>
    -
    +
    message_html,array( 'label'=>'Message HTML', 'placeholder'=>'Message HTML', @@ -23,6 +26,7 @@ 'editor'=>'tinymce', 'help-block'=>sprintf('The message in HTML that is used in the email. Uses variables: %s',implode(', ',array_values($o->variables('message_html')))))); ?>'
    +
    render_all(); ?> render_all(); ?> diff --git a/modules/email/views/email/user/view.php b/modules/email/views/email/user/view.php index db7168e9..9c5cad05 100644 --- a/modules/email/views/email/user/view.php +++ b/modules/email/views/email/user/view.php @@ -1,32 +1,34 @@ -
    -
    +
    - - - - - - - - - - - - - - - - - - - -
    To:account->name(),$elo->display('email')); ?>
    Date:display('date_orig'); ?>
    Subject:resolve('subject'); ?>

    - - - - -
    resolve('message_html'); ?>
    -
    + + + + + - - + + + + + + + + + + + + + + + + + +
    To:account->name(),$elo->display('email')); ?>
    Date:display('date_orig'); ?>
    Subject:resolve('subject'); ?>

    + + + + +
    resolve('message_html'); ?>
    +
    + +
    diff --git a/modules/export/views/export/admin/add.php b/modules/export/views/export/admin/add.php index 2f407581..41bffaf5 100644 --- a/modules/export/views/export/admin/add.php +++ b/modules/export/views/export/admin/add.php @@ -1,21 +1,19 @@ -
    -
    -
    - Add Export Data Map +
    +
    + Add Export Data Map - list_itemsnoexport($module,$emo->id),NULL,array('label'=>'Product')); ?> - 'Accounting Code','placeholder'=>'Account Code')); ?> - 'Inventory Code','placeholder'=>'Inventory Code')); ?> + list_itemsnoexport($module,$emo->id),NULL,array('label'=>'Product')); ?> + 'Accounting Code','placeholder'=>'Account Code')); ?> + 'Inventory Code','placeholder'=>'Inventory Code')); ?> - id); ?> - mid()); ?> + id); ?> + mid()); ?> +
    -
    -
    - - -
    -
    -
    -
    -
    +
    +
    + + +
    +
    +
    diff --git a/modules/export/views/export/module/admin/edit.php b/modules/export/views/export/module/admin/edit.php index b2437c12..9a772a71 100644 --- a/modules/export/views/export/module/admin/edit.php +++ b/modules/export/views/export/module/admin/edit.php @@ -1,20 +1,18 @@ -
    -
    -
    - Export Module Update +
    +
    + Export Module Update -

    Available module->table_name(); ?> Columns to display

    +

    Available module->table_name(); ?> Columns to display

    - data($o->module->module()->table_columns()) - ->jssort(FALSE) - ->columns(array( - 'column_name'=>'Name', - )) - ->select(URL::link('reseller','export/export'),$o->id,array('export_module_id'=>$o->id)) - ->prepend(array( - 'column_name'=>array('input'=>array('key'=>'display[__VALUE__]','values'=>$o->display)), - )); ?> -
    -
    -
    + data($o->module->module()->table_columns()) + ->jssort(FALSE) + ->columns(array( + 'column_name'=>'Name', + )) + ->select(URL::link('reseller','export/export'),$o->id,array('export_module_id'=>$o->id)) + ->prepend(array( + 'column_name'=>array('input'=>array('key'=>'display[__VALUE__]','values'=>$o->display)), + )); ?> + +
    diff --git a/modules/gchart/classes/GoogleChart/Legacy.php b/modules/gchart/classes/GoogleChart/Legacy.php index 1f388b71..f3b02556 100644 --- a/modules/gchart/classes/GoogleChart/Legacy.php +++ b/modules/gchart/classes/GoogleChart/Legacy.php @@ -91,19 +91,19 @@ class GoogleChart_Legacy extends GoogleChart { /** CHART FIELDS **/ - private function chd() { - $result = array(); + private function chd() { + $result = array(); $maxes = $this->maxes(); - // Perform our encoding - foreach ($this->_axis as $l => $axis) - array_push($result,$this->encode($this->_data[$l],$maxes[$axis])); + // Perform our encoding + foreach ($this->_axis as $l => $axis) + array_push($result,$this->encode($this->_data[$l],$maxes[$axis])); - $prefix = (count($maxes) > 1) ? sprintf('%s:',$this->axiscount('yl')) : ':'; + $prefix = (count($maxes) > 1) ? sprintf('%s:',$this->axiscount('yl')) : ':'; - // If encoding is text, we need to separate the series with a | - return ($this->_encodetype == 't') ? $prefix.implode('|',$result) : $prefix.implode(',',$result); - } + // If encoding is text, we need to separate the series with a | + return ($this->_encodetype == 't') ? $prefix.implode('|',$result) : $prefix.implode(',',$result); + } private function chm() { $result = array(); diff --git a/modules/host/classes/Model/Product/Plugin/Host.php b/modules/host/classes/Model/Product/Plugin/Host.php index d0c25e58..ed813e86 100644 --- a/modules/host/classes/Model/Product/Plugin/Host.php +++ b/modules/host/classes/Model/Product/Plugin/Host.php @@ -10,10 +10,6 @@ * @license http://dev.osbill.net/license.html */ class Model_Product_Plugin_Host extends Model_Product_Plugin { - // @todo This model doesnt have a database table - public function __construct() { - } - // Our required abstract methods public function cost($annual=FALSE) { // @todo @@ -22,8 +18,6 @@ class Model_Product_Plugin_Host extends Model_Product_Plugin { return $annual ? $x*12 : $x; } - public function feature_summary() {} - public function render_edit() {} // @todo @@ -31,6 +25,17 @@ class Model_Product_Plugin_Host extends Model_Product_Plugin { return 'internal'; } + // Overload functions + + // @todo This model doesnt have a database table + public function __construct() { + } + + // Not used + public function render_view() {} + + // Local functions + // @todo This is not used, but should be. public function order_features() {} } diff --git a/modules/host/classes/Model/Service/Plugin/Host.php b/modules/host/classes/Model/Service/Plugin/Host.php index 131515bd..bdff7d32 100644 --- a/modules/host/classes/Model/Service/Plugin/Host.php +++ b/modules/host/classes/Model/Service/Plugin/Host.php @@ -19,8 +19,8 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin { // Relationships protected $_has_one = array( - 'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'), - 'host_server'=>array('far_key'=>'host_server_id','foreign_key'=>'id'), + 'host'=>array('model'=>'Host_Server','far_key'=>'host_server_id','foreign_key'=>'id'), + 'tld'=>array('model'=>'Domain_TLD','foreign_key'=>'id','far_key'=>'domain_tld_id'), ); protected $_belongs_to = array( 'service'=>array(), @@ -35,40 +35,41 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin { ), ); + protected $_save_message = TRUE; + // Required abstract functions - public function admin_update() { - return ''; - } public function expire() { return $this->host_expire; } - + public function name() { - return sprintf('%s.%s',$this->display('domain_name'),$this->domain_TLD->display('name')); + return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name')); } - public function username_value() { + public function password() { + return $this->host_password; + } + + public function username() { return $this->host_username; } - public function password_value() { - return $this->host_password; - } + // Local functions /** * This provides us with a manage button to jump to the hosting server * to manage the domain. */ public function manage_button($t='') { - if (! parent::manage_button($t)) - return NULL; - // @todo Convert this to a Static_List display if ($this->service->queue == 'PROVISION') return _('To Be Provisioned'); - return ($this->username_value() AND $this->password_value() AND $a=$this->host_server->plugin()) ? $a->manage_button($this,$t) : ''; + if (! parent::manage($t)) + return NULL; + + return ($this->username() AND $this->password() AND $a=$this->host->plugin()) ? $a->manage_button($this,$t) : ''; } /** diff --git a/modules/host/views/product/category/list/hostcompare.php b/modules/host/views/product/category/list/hostcompare.php index dae42b75..f3d7ac4d 100644 --- a/modules/host/views/product/category/list/hostcompare.php +++ b/modules/host/views/product/category/list/hostcompare.php @@ -4,49 +4,49 @@
    -
    -
    -
    -
    - products() as $po) : ?> - 1) : ?> -
    -
    -
    - +
    +
    + products() as $po) : ?> + price_best($o->recur_schedule,TRUE); ?> + price($go->id,$o->recur_schedule,'base',TRUE)); ?> -
    -
    + -
    + 1) : ?> +
    +
    +
    + -
    - title(); ?> -
    +
    +
    -
    - price(0,4,'price_base',TRUE)); ?> - $ . -
    +
    -
    +
    + title(); ?> +
    -
    -
      -
    • $price(0,4,'price_setup',TRUE)); ?> setup
    • -
    -
    +
    + $ .recur_schedule); ?> +
    - +
    -
    -
    - +
    +
      +
    • $price($go->id,$o->recur_schedule,'setup',TRUE)); ?> Setup
    • +
    +
    -
    -
    -
    -
    + + +
    +
    + + +
    +
    diff --git a/modules/invoice/classes/Task/Invoice/Remindoverdue1.php b/modules/invoice/classes/Task/Invoice/Remindoverdue1.php index d290a7fe..f0ce36da 100644 --- a/modules/invoice/classes/Task/Invoice/Remindoverdue1.php +++ b/modules/invoice/classes/Task/Invoice/Remindoverdue1.php @@ -10,6 +10,17 @@ * @license http://dev.osbill.net/license.html */ class Task_Invoice_Remindoverdue1 extends Minion_Task { + // @todo This should be moved to somewhere else + private $_css = ' +'; + protected function remind_overdue($notice=1) { $action = array(); @@ -44,7 +55,7 @@ class Task_Invoice_Remindoverdue1 extends Minion_Task { 'INV_NUM'=>$io->refnum(), 'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'), 'LATE_FEE'=>'5.50', // @todo This should come from a config file. - 'PAYMENTS_TABLE'=>$io->account->payment->list_recent_table(), + 'PAYMENTS_TABLE'=>$this->_css.$io->account->payment->list_recent_table(), 'SITE_NAME'=>Company::instance()->name(), ); diff --git a/modules/invoice/views/invoice/user/view.php b/modules/invoice/views/invoice/user/view.php index c0737554..6105b6ec 100644 --- a/modules/invoice/views/invoice/user/view.php +++ b/modules/invoice/views/invoice/user/view.php @@ -1,43 +1,43 @@
    -
    -
    -
    - - - - - -
    - name(); ?>
    - taxid(); ?>
    -
    - address(); ?>
    -
    - contacts(); ?> -
    -
    -
    +
    + + + + + +
    + name(); ?>
    + taxid(); ?>
    +
    + address(); ?>
    +
    + contacts(); ?> +
    +
    -
    -
    -
    -
    Tax Invoice
    -
    id(); ?>
    -
    Issue Date
    -
    display('date_orig'); ?>
    -
    Due Date
    -
    display('due_date'); ?>
    -
    Current Charges
    -
    total_charges(TRUE); ?>
    -
    Payments Received
    -
    payments_total(TRUE); ?>
    -
    Credits Applied
    -
    total_credits(TRUE); ?>
    -
    Still Due
    -
    due(TRUE); ?>
    -
    -
    -
    +
    +
    +
    Tax Invoice
    +
    id(); ?>
    + +
    Issue Date
    +
    display('date_orig'); ?>
    + +
    Due Date
    +
    display('due_date'); ?>
    + +
    Current Charges
    +
    total_charges(TRUE); ?>
    + +
    Payments Received
    +
    payments_total(TRUE); ?>
    + +
    Credits Applied
    +
    total_credits(TRUE); ?>
    + +
    Still Due
    +
    due(TRUE); ?>
    +
    @@ -46,67 +46,60 @@

    Charge Details

    render('html','body'); ?> -
    -
    -
    -
    -
    Reminder Details
    -
    - reminders() as $eto) : ?> -
    reminders($eto->name,TRUE); ?>
    -
    name(); ?>
    - -
    -
    -
    +
    +
    Reminder Details
    -
    -
    -
    - -
    Sub Total
    -
    subtotal(TRUE); ?>
    - +
    + reminders() as $eto) : ?> +
    reminders($eto->name,TRUE); ?>
    +
    name(); ?>
    + +
    +
    - - total_credits()) : ?> -
    Credits
    -
    total_credits(TRUE); ?>
    - - +
    +
    + +
    Sub Total
    +
    subtotal(TRUE); ?>
    + - - total_discounts()) : ?> -
    Discounts
    -
    total_discounts(TRUE); ?>
    - - + + total_credits()) : ?> +
    Credits
    +
    total_credits(TRUE); ?>
    + + - -
    Taxes Included:
    - tax_summary() as $tid => $amount) : - $m = ORM::factory('Tax',$tid); ?> -
    description); ?>
    - - + + total_discounts()) : ?> +
    Discounts
    +
    total_discounts(TRUE); ?>
    + + - -
    Total Invoice:
    -
    total(TRUE); ?>
    - + +
    Taxes Included:
    + tax_summary() as $tid => $amount) : + $m = ORM::factory('Tax',$tid); ?> +
    description); ?>
    + + - -
    Account Due:
    -
    account->invoices_due_total(NULL,TRUE); ?>
    - + +
    Total Invoice:
    +
    total(TRUE); ?>
    + -
    -
    -
    + +
    Account Due:
    +
    account->invoices_due_total(NULL,TRUE); ?>
    + +
    diff --git a/modules/lnApp b/modules/lnApp index c1323576..319b4b29 160000 --- a/modules/lnApp +++ b/modules/lnApp @@ -1 +1 @@ -Subproject commit c13235763045db771ecf2cfeb332cc8f3a314650 +Subproject commit 319b4b29db9c1e467b34f75bb03d1d908d17afbc diff --git a/modules/oauth/classes/Auth.php b/modules/oauth/classes/Auth.php index f9da792a..0e7f5ea9 100644 --- a/modules/oauth/classes/Auth.php +++ b/modules/oauth/classes/Auth.php @@ -11,7 +11,7 @@ * @license http://dev.osbill.net/license.html */ abstract class Auth extends Kohana_Auth { - public static function instance($type=NULL) { + public static function instance($type=NULL) { if (is_null($type) OR (! $type instanceof Model_Oauth)) return parent::instance(); diff --git a/modules/oauth/classes/Auth/Facebook_Connect.php b/modules/oauth/classes/Auth/Facebook_Connect.php index ece59e50..b3be773a 100644 --- a/modules/oauth/classes/Auth/Facebook_Connect.php +++ b/modules/oauth/classes/Auth/Facebook_Connect.php @@ -37,9 +37,9 @@ class Auth_Facebook extends Auth_ORM_External { // Create new Facebook object $this->ao = new Facebook(array( - 'appId' => $oo->app_id, - 'secret' => $oo->secret, - 'cookie' => $this->config->cookie, + 'appId' => $oo->app_id, + 'secret' => $oo->secret, + 'cookie' => $this->config->cookie, 'session_type' => $this->config->session_type, )); diff --git a/modules/payment/classes/Controller/Admin/Payment.php b/modules/payment/classes/Controller/Admin/Payment.php index 1587bef9..a4b5d0d4 100644 --- a/modules/payment/classes/Controller/Admin/Payment.php +++ b/modules/payment/classes/Controller/Admin/Payment.php @@ -121,12 +121,9 @@ class Controller_Admin_Payment extends Controller_Payment { ->type('stdin') ->data(' $(document).ready(function() { - var nowTemp = new Date(); - var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); - $("#date_payment_label").datepicker({ autoclose : true, - endDate : now, + endDate : new Date(), format : "dd-mm-yyyy", todayBtn : true, }).on("hide",function(ev) { diff --git a/modules/payment/classes/Model/Payment.php b/modules/payment/classes/Model/Payment.php index 746a345c..b70e0d8b 100644 --- a/modules/payment/classes/Model/Payment.php +++ b/modules/payment/classes/Model/Payment.php @@ -214,6 +214,22 @@ class Model_Payment extends ORM_OSB { /** LIST FUNCTIONS **/ + /** + * Show recent payments for this account + */ + public function list_recent_table() { + return Table::factory() + ->data($this->limit(10)->find_all()) + ->columns(array( + 'id'=>'ID', + 'date_payment'=>'Date', + 'checkout->display("name")'=>'Method', + 'total_amt'=>'Total', + 'balance(TRUE)'=>'Balance', + 'invoicelist()'=>'Invoices' + )); + } + public function list_unapplied() { $pid = array(); @@ -232,32 +248,5 @@ class Model_Payment extends ORM_OSB { return $this->where('id','IN',$pid)->order_by('account_id')->find_all(); } - - public function list_recent_table() { - // @todo This should be in a config file. - $css = ''; - - return $css.Table::display( - $this->limit(10)->find_all(), - 25, - array( - 'id'=>array('label'=>'ID'), - 'date_payment'=>array('label'=>'Date'), - 'checkout->display("name")'=>array('label'=>'Method'), - 'total_amt'=>array('label'=>'Total','class'=>'right'), - 'balance(TRUE)'=>array('label'=>'Balance','class'=>'right'), - 'invoicelist()'=>array('label'=>'Invoices'), - ), - array( - 'type'=>'list', - )); - } } ?> diff --git a/modules/payment/views/payment/admin/add_edit.php b/modules/payment/views/payment/admin/add_edit.php index de8fce3c..ae53371f 100644 --- a/modules/payment/views/payment/admin/add_edit.php +++ b/modules/payment/views/payment/admin/add_edit.php @@ -1,23 +1,21 @@ -
    -
    +
    +
    + Payment Details -
    - Payment Details +
    + display('date_payment'),array('class'=>'span2','label'=>'Date Paid','add-on'=>'','disabled')); ?> +
    -
    - display('date_payment'),array('class'=>'span2','label'=>'Date Paid','add-on'=>'','disabled')); ?> -
    + date_payment); ?> + list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?> + total_amt,array('class'=>'span2','label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?> + fees_amt,array('class'=>'span2','label'=>'Fees','placeholder'=>'Fees')); ?> + account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?> + account_id); ?> + notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?> +
    - date_payment); ?> - list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?> - total_amt,array('class'=>'span2','label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?> - fees_amt,array('class'=>'span2','label'=>'Fees','placeholder'=>'Fees')); ?> - account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?> - account_id); ?> - notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?> -
    +
    -
    - 'btn btn-primary')); ?> -
    -
    + 'btn btn-primary')); ?> +
    diff --git a/modules/payment/views/payment/admin/addbulk/ezypay.php b/modules/payment/views/payment/admin/addbulk/ezypay.php index 50c7838c..48537db8 100644 --- a/modules/payment/views/payment/admin/addbulk/ezypay.php +++ b/modules/payment/views/payment/admin/addbulk/ezypay.php @@ -1,13 +1,11 @@ -
    -
    -
    - Ezypay Payment +
    +
    + Ezypay Payment - - 'Transaction File','required','help-block'=>'AddItems')); ?> - 'Payment File','required','help-block'=>'BillDetails')); ?> -
    + + 'Transaction File','required','help-block'=>'AddItems')); ?> + 'Payment File','required','help-block'=>'BillDetails')); ?> +
    - 'btn btn-primary')); ?> -
    -
    + 'btn btn-primary')); ?> +
    diff --git a/modules/payment/views/payment/admin/addbulk/ezypay_processed.php b/modules/payment/views/payment/admin/addbulk/ezypay_processed.php index 7c78ccc3..6cfacae2 100644 --- a/modules/payment/views/payment/admin/addbulk/ezypay_processed.php +++ b/modules/payment/views/payment/admin/addbulk/ezypay_processed.php @@ -1,18 +1,16 @@ -
    -
    -
    - Bulk Payment Details -
    +
    +
    + Bulk Payment Details +
    -
    -
    Total
    -
    +
    +
    Total
    +
    -
    Fees
    -
    +
    Fees
    +
    -
    Payments
    -
    -
    -
    -
    +
    Payments
    +
    +
    +
    diff --git a/modules/payment/views/payment/admin/ajaxitemlist.php b/modules/payment/views/payment/admin/ajaxitemlist.php index 310e6a54..68077aac 100644 --- a/modules/payment/views/payment/admin/ajaxitemlist.php +++ b/modules/payment/views/payment/admin/ajaxitemlist.php @@ -1,16 +1,17 @@ - - - - - - - - - - - - +
    InvoiceDate IssueDate DueTotalPaymentsDueAlloc
    + + + + + + + + + + + + items('ALLOC') as $pio) : ?> @@ -22,10 +23,10 @@ - + - -
    InvoiceDate IssueDate DueTotalPaymentsDueAlloc
    invoice_id),$pio->invoice->id()); ?>invoice_id.']',$pio->display('alloc_amt'),array('class'=>'span1','nocg'=>TRUE,'tabindex'=>++$c)); ?>
    Unapplied balance(TRUE),array('class'=>'span1','nocg'=>TRUE,'disabled'=>'disabled')); ?>
    + + diff --git a/modules/product/classes/Controller/Admin/Product.php b/modules/product/classes/Controller/Admin/Product.php index 10cf0ad4..cc58624f 100644 --- a/modules/product/classes/Controller/Admin/Product.php +++ b/modules/product/classes/Controller/Admin/Product.php @@ -47,7 +47,7 @@ class Controller_Admin_Product extends Controller_Product { $output = _('Unable to find translate data'); } else { - $pcto = $pco->product_category_translate->where('language_id','=',$_REQUEST['key'])->find(); + $pcto = $pco->translate->where('language_id','=',$_REQUEST['key'])->find(); $output = View::factory('product/category/admin/ajaxtranslate') ->set('o',$pcto); @@ -161,24 +161,22 @@ $(document).ready(function() { Block::factory() ->title(_('Products')) ->title_icon('icon-th') - ->body(Table::display( - $products, - 25, - array( - 'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')), - 'title()'=>array('label'=>'Details'), - 'status'=>array('label'=>'Active'), - 'prod_plugin_file'=>array('label'=>'Plugin Name'), - 'prod_plugin_data'=>array('label'=>'Plugin Data'), - 'price_type'=>array('label'=>'Price Type'), - 'taxable'=>array('label'=>'Taxable'), - 'count_services()'=>array('label'=>'Services'), - 'count_invoices()'=>array('label'=>'Invoices'), - ), - array( - 'page'=>TRUE, - 'type'=>'select', - 'form'=>URL::link('admin','product/view'), + ->body(Table::factory() + ->data($products) + ->page_items(25) + ->columns(array( + 'id'=>'ID', + 'title()'=>'Details', + 'status'=>'Active', + 'prod_plugin_file'=>'Plugin Name', + 'prod_plugin_data'=>'Plugin Data', + 'price_type'=>'Price Type', + 'taxable'=>'Taxable', + 'service->list_count()'=>'Services', + 'invoice->list_count()'=>'Invoices', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('admin','product/edit/')), ))); } @@ -191,21 +189,19 @@ $(document).ready(function() { Block::factory() ->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title())) ->title_icon('icon-th-list') - ->body(Table::display( - $po->services()->find_all(), - 25, - array( - 'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')), - 'account->accnum()'=>array(), - 'account->name()'=>array('label'=>'Account'), - 'name()'=>array('label'=>'Details'), - 'status'=>array('label'=>'Active'), - 'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'), - ), - array( - 'page'=>TRUE, - 'type'=>'select', - 'form'=>URL::link('user','service/view'), + ->body(Table::factory() + ->data($po->service->where_active()->find_all()) + ->page_items(25) + ->columns(array( + 'id'=>'ID', + 'account->accnum()'=>'Acc Num', + 'account->name()'=>'Account', + 'name()'=>'Details', + 'status'=>'Active', + 'price(TRUE,TRUE)'=>'Price', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('user','service/view/')), ))); } } diff --git a/modules/product/classes/Model/Product.php b/modules/product/classes/Model/Product.php index b3c54aac..6e85750c 100644 --- a/modules/product/classes/Model/Product.php +++ b/modules/product/classes/Model/Product.php @@ -48,12 +48,11 @@ class Model_Product extends ORM_OSB { protected $_save_message = TRUE; - /** - * Which categories is this product available in - */ - public function categories() { - return $this->avail_category; - } + // Our database index for pricing values + private $_price_options = array( + 'base'=>'price_base', + 'setup'=>'price_setup', + ); public function cost($annual=FALSE) { return $this->plugin() ? $this->plugin()->cost($annual) : 0; @@ -72,7 +71,7 @@ class Model_Product extends ORM_OSB { * This will render the product feature summary information */ public function feature_summary() { - return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary(); + return (is_null($x=$this->plugin())) ? HTML::nbsp('') : $x->render_view(); } /** @@ -116,6 +115,54 @@ class Model_Product extends ORM_OSB { return (is_null($x = $this->plugin())) ? NULL : $x->render_edit(); } + /** + * Return the price for the particular group and price option for the period + */ + public function price($grp,$period,$price_option,$taxed=FALSE) { + if (is_null($option=$this->price_option($price_option)) OR is_null($x=$this->keyget('price_group',$period))) + return NULL; + + if (isset($x[$grp][$option])) + return $taxed ? Tax::add($x[$grp][$option]) : $x[$grp][$option]; + else + return NULL; + } + + /** + * For the specific user, get the best price + * + * @todo change this to be the overall contract price, if there is a contract + */ + public function price_best($period,$taxed=FALSE) { + $result = NULL; + + $x = NULL; + foreach (Auth::instance()->get_groups() as $go) { + $price = $this->price($go->id,$period,'base',$taxed); + + if ($go->pricing AND ! is_null($price) AND (is_null($result) OR $x > $price)) { + $result = $go; + $x = $price; + } + } + + return is_null($result) ? ORM::factory('Group',0) : $result; + } + + /** + * Get the database index for a price option + */ + public function price_option($option) { + return isset($this->_price_options[$option]) ? $this->_price_options[$option] : NULL; + } + + /** + * Return the available pricing options + */ + public function price_options() { + return $this->_price_options; + } + public function save(Validation $validation=NULL) { parent::save($validation); @@ -135,13 +182,6 @@ class Model_Product extends ORM_OSB { return $this; } - /** - * List the services that are linked to this product - */ - public function services($active=FALSE) { - return $active ? $this->service->where_active() : $this->service; - } - public function supplier() { return $this->plugin() ? $this->plugin()->supplier() : 'other'; } @@ -158,84 +198,5 @@ class Model_Product extends ORM_OSB { return $x->loaded() ? $x->display('name') : 'No Title'; } - - public function list_type($type) { - return $this->where('prod_plugin_file','=',$type)->find_all(); - } - - /** - * Return the best price to the uesr based on the users group's memberships - * @todo This needs to be tested with more than one price group enabled - */ - public function get_price_array() { - // Figure out our eligable groups - // @todo Need to work out our default groups elsewhere, not in product - // All users are members of the all user group "0" - $groups = array(0); - if (Auth::instance()->logged_in()) - foreach (Auth::instance()->get_user()->group->find_all() as $go) - array_push($groups,$go->id); - - // Work out the best price for the user - $price = array(); - if (is_array($this->price_group)) - foreach ($this->price_group as $bill_freq => $pg) { - if (isset($pg['show']) AND $pg['show']) - foreach ($groups as $gid) { - if (! empty($pg[$gid])) { - if (empty($price[$bill_freq]['price_base']) - OR ($pg[$gid]['price_base'] AND $price[$bill_freq]['price_base'] > $pg[$gid]['price_base'])) { - $price[$bill_freq]['price_setup'] = $pg[$gid]['price_setup']; - $price[$bill_freq]['price_base'] = $pg[$gid]['price_base']; - } - } - } - } - - // @todo Ugly hack - return $price ? $price : array('0'=>array('price_base'=>0,'price_setup'=>0)); - } - - /** - * Return the configured price groups for this product - */ - public function availPriceGroups() { - // @todo This needs to be worked out dynamically - return array(0,1); - } - - /** - * Return the available pricing options - */ - public function availPriceOptions() { - // @todo This needs to be worked out dynamically - return array('price_base','price_setup'); - } - - /** - * List the number of services using this product - */ - public function count_services() { - return $this->service->list_count(TRUE); - } - - /** - * List the number of invoices using this product - */ - public function count_invoices() { - return $this->invoice->list_count(TRUE); - } - - /** - * Return the price for the particle group and price option for the period - */ - public function price($grp,$period,$option,$taxed=FALSE) { - $x = $this->keyget('price_group',$period); - - if (isset($x[$grp][$option])) - return $taxed ? Tax::add($x[$grp][$option]) : $x[$grp][$option]; - else - return NULL; - } } ?> diff --git a/modules/product/classes/Model/Product/Category.php b/modules/product/classes/Model/Product/Category.php index 154cce6c..10c64069 100644 --- a/modules/product/classes/Model/Product/Category.php +++ b/modules/product/classes/Model/Product/Category.php @@ -46,7 +46,7 @@ class Model_Product_Category extends ORM_OSB { $result = array(); foreach (ORM::factory('Product')->where_active()->find_all() as $po) - if (in_array($this->id,$po->categories())) + if (in_array($this->id,$po->avail_category)) array_push($result,$po); return $result; diff --git a/modules/product/classes/Model/Product/Category/Translate.php b/modules/product/classes/Model/Product/Category/Translate.php index fe3c8781..02da4541 100644 --- a/modules/product/classes/Model/Product/Category/Translate.php +++ b/modules/product/classes/Model/Product/Category/Translate.php @@ -14,8 +14,8 @@ class Model_Product_Category_Translate extends ORM_OSB { protected $_created_column = FALSE; protected $_updated_column = FALSE; - protected $_belongs_to = array( - 'product_category'=>array(), + protected $_has_one = array( + 'language'=>array('foreign_key'=>'id'), ); protected $_save_message = TRUE; diff --git a/modules/product/classes/Model/Product/Plugin.php b/modules/product/classes/Model/Product/Plugin.php index 6ec5f150..b9926d30 100644 --- a/modules/product/classes/Model/Product/Plugin.php +++ b/modules/product/classes/Model/Product/Plugin.php @@ -18,12 +18,6 @@ abstract class Model_Product_Plugin extends ORM_OSB { */ abstract public function cost($annual=FALSE); - /** - * The feature summary should be implemented in plugins. - * It is displayed on the product overview page, as a summary of the products features. - */ - abstract public function feature_summary(); - /** * Return the name of the plugin */ @@ -31,12 +25,38 @@ abstract class Model_Product_Plugin extends ORM_OSB { return strtolower(preg_replace('/(.*)_([a-zA-Z]+)$/',"$2",get_class($this))); } + /** + * Get all the products using this plugin + */ + public function products($active=FALSE) { + $x = ORM::factory('Product') + ->where('prod_plugin_file','=',$this->plugin()) + ->and_where('prod_plugin_data','=',$this); + + if ($active) + $x->where_active(); + + return $x->find_all(); + } + /** * Form info for admins to update with plugin data */ abstract public function render_edit(); - abstract public function render_order(); + /** + * Form used during service ordering + */ + public function render_order() { + return View::factory(sprintf('product/plugin/%s/order',$this->plugin())); + } + + /** + * View the details of the product + */ + public function render_view() { + return View::factory(sprintf('product/plugin/%s/view',$this->plugin()))->set('o',$this); + } abstract public function supplier(); } diff --git a/modules/product/classes/Model/Product/Translate.php b/modules/product/classes/Model/Product/Translate.php index 35f55cc8..bd5636d1 100644 --- a/modules/product/classes/Model/Product/Translate.php +++ b/modules/product/classes/Model/Product/Translate.php @@ -17,6 +17,10 @@ class Model_Product_Translate extends ORM_OSB { 'product'=>array(), ); + protected $_has_one = array( + 'language'=>array('foreign_key'=>'id'), + ); + protected $_save_message = TRUE; } ?> diff --git a/modules/product/views/product/admin/ajaxtranslate.php b/modules/product/views/product/admin/ajaxtranslate.php index bde751b2..25810713 100644 --- a/modules/product/views/product/admin/ajaxtranslate.php +++ b/modules/product/views/product/admin/ajaxtranslate.php @@ -1,4 +1,7 @@ -
    +
    + $o->id,':language'=>$o->language->name)); ?> + +
    name,array( 'label'=>'Category Title', 'placeholder'=>'Descriptive Title', @@ -6,7 +9,7 @@ 'required', 'help-block'=>'The title is shown when uses search products by category')); ?>
    -
    +
    description_short,array( 'label'=>'Short Product Description', 'placeholder'=>'Short Description', @@ -14,7 +17,7 @@ 'required', 'help-block'=>'Complete description of this category')); ?>
    -
    +
    description_full,array( 'label'=>'Full Product Description', 'placeholder'=>'Full Description', @@ -23,6 +26,7 @@ 'editor'=>'wysihtml5', 'help-block'=>'Complete description of this category')); ?>
    +
    render_all(); ?> render_all(); ?> diff --git a/modules/product/views/product/admin/edit.php b/modules/product/views/product/admin/edit.php index 3ebb5603..e511fad2 100644 --- a/modules/product/views/product/admin/edit.php +++ b/modules/product/views/product/admin/edit.php @@ -1,76 +1,70 @@ -
    -
    -
    - Update Product +
    +
    + Update Product -
    -
    - + +
    + $v) : ?> -
    - $v) : ?>
    is_price_shown($k),array('label'=>'Price Active','class'=>'span2')); ?> - availPriceGroups() as $g) : ?> -
    -
    name; ?>
    - availPriceOptions() as $po) : ?> -
    - price($g,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?> + list_pricegroups() as $go) : ?> + +
    +
    name; ?>
    + + price_options()) as $po) : ?> +
    + id}][{$o->price_option($po)}]",$o->price($go->id,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?> +
    +
    - -
    - + +
    - -
    -
    -
    -
    + +
    -
    -
    - status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?> -
    -
    +
    +
    -
    -
    - price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?> -
    -
    +
    -
    -
    - position,array('label'=>'Order','class'=>'span1')); ?> -
    -
    +
    + status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?> +
    -
    -
    - list_select(TRUE),'',array('label'=>'Language','required')); ?> -
    -
    +
    + price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?> +
    -
    -
    -
    +
    + position,array('label'=>'Order','class'=>'span1')); ?> +
    - '.$plugin_form; } ?> +
    + list_select(TRUE),'',array('label'=>'Language','required')); ?> +
    +
    -
    -
    - - -
    -
    +
    - -
    -
    + '.$plugin_form; } ?> + +
    +
    + + +
    +
    +
    diff --git a/modules/product/views/product/category/admin/ajaxtranslate.php b/modules/product/views/product/category/admin/ajaxtranslate.php index 428dda7b..484807f6 100644 --- a/modules/product/views/product/category/admin/ajaxtranslate.php +++ b/modules/product/views/product/category/admin/ajaxtranslate.php @@ -1,4 +1,7 @@ -
    +
    + $o->id,':language'=>$o->language->name)); ?> + +
    name,array( 'label'=>'Category Title', 'placeholder'=>'Descriptive Title', @@ -6,7 +9,7 @@ 'required', 'help-block'=>'The title is shown when uses search products by category')); ?>
    -
    +
    description,array( 'label'=>'Category Description', 'placeholder'=>'Description', @@ -15,6 +18,7 @@ 'editor'=>'wysihtml5', 'help-block'=>'Complete description of this category')); ?>
    +
    render_all(); ?> render_all(); ?> diff --git a/modules/product/views/product/category/admin/edit.php b/modules/product/views/product/category/admin/edit.php index 7e49f1ea..34252e54 100644 --- a/modules/product/views/product/category/admin/edit.php +++ b/modules/product/views/product/category/admin/edit.php @@ -1,36 +1,31 @@ -
    -
    -
    - Update Category +
    +
    + Update Category -
    -
    - status,FALSE,array('label'=>'Active','class'=>'span1')); ?> -
    -
    +
    + status,FALSE,array('label'=>'Active','class'=>'span1')); ?> +
    -
    -
    - templates(),$o->template,array('label'=>'List Template')); ?> -
    -
    +
    + templates(),$o->template,array('label'=>'List Template')); ?> +
    -
    -
    - list_select(TRUE),'',array('label'=>'Language','required')); ?> -
    -
    +
    + recur_schedule,FALSE,array('label'=>'Show Pricing Schedule','required'));?> +
    -
    -
    -
    +
    + list_select(TRUE),'',array('label'=>'Language','required')); ?> +
    -
    -
    - - -
    -
    -
    -
    -
    + + +
    + +
    +
    + + +
    +
    +
    diff --git a/modules/product/views/product/category/list/supercat.php b/modules/product/views/product/category/list/supercat.php index b4a2ac98..703f7539 100644 --- a/modules/product/views/product/category/list/supercat.php +++ b/modules/product/views/product/category/list/supercat.php @@ -5,23 +5,21 @@
    subcategories->find_all() as $pco) : ?> - 1) : ?> -
    -
    -
    + 1) : ?> +
    +
    +
    +
     
    + +
    -   +
    +

    title(); ?>

    + + description())<$x ? $pco->description() : substr($pco->description(),0,$x).'...'; ?> +

    More Details »

    +
    - - -
    -
    -

    title(); ?>

    - description())<$x ? $pco->description() : substr($pco->description(),0,$x).'...'; ?> -

    More Details »

    -
    -
    -
    diff --git a/modules/product/views/product/view.php b/modules/product/views/product/view.php index 1f4d1eeb..01ad6a7a 100644 --- a/modules/product/views/product/view.php +++ b/modules/product/views/product/view.php @@ -1,15 +1,11 @@
    -

    title(); ?>

    - description(); ?> +

    title(); ?>

    + + description(); ?>
    -
    -
    - description(TRUE); ?> -
    +
    + description(TRUE); ?>
    - - -
    diff --git a/modules/service/classes/Controller/Admin/Service.php b/modules/service/classes/Controller/Admin/Service.php index 665a8ba0..237594a4 100644 --- a/modules/service/classes/Controller/Admin/Service.php +++ b/modules/service/classes/Controller/Admin/Service.php @@ -28,9 +28,6 @@ class Controller_Admin_Service extends Controller_Service { Script::factory() ->type('stdin') ->data(' -var nowTemp = new Date(); -var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); - $(document).ready(function() { $("select[name=product_id]").change(function() { // If we select a blank, then dont continue @@ -56,11 +53,10 @@ $(document).ready(function() { $("#date_next_invoice_label").datepicker({ autoclose : true, - startDate : now, format : "dd-M-yyyy", todayBtn : true, }).on("hide",function(ev) { - $("input[name=date_next_invoicel]").val(ev.date.valueOf()/1000); + $("input[name=date_next_invoice]").val(ev.date.valueOf()/1000); }); $("input[name=account_id_label]").typeahead({ @@ -127,17 +123,29 @@ $(document).ready(function() { Script::factory() ->type('stdin') ->data(' -var nowTemp = new Date(); -var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); - $(document).ready(function() { $("#date_next_invoice_label").datepicker({ autoclose : true, - startDate : now, format : "dd-M-yyyy", todayBtn : true, }).on("hide",function(ev) { - $("input[name=date_next_invoicel]").val(ev.date.valueOf()/1000); + $("input[name=date_next_invoice]").val(ev.date.valueOf()/1000); + }); + + $("#service_connect_date_label").datepicker({ + autoclose : true, + 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, + format : "dd-M-yyyy", + todayBtn : true, + }).on("hide",function(ev) { + $("input[id=service_contract_date]").val(ev.date.valueOf()/1000); }); }); '); @@ -188,12 +196,12 @@ $(document).ready(function() { public function action_listdomainservicesbydnshost() { $svs = ORM::factory('Service')->list_bylistgroup('DOMAIN'); - Sort::MAsort($svs,'plugin()->service_plugin_host,name()'); + Sort::MAsort($svs,'plugin()->host,name()'); $list = array(); foreach ($svs as $so) - $list[$so->plugin()->service_plugin_host->host_server_id][] = $so; + $list[$so->plugin()->host->host_server_id][] = $so; foreach (array_keys($list) as $sid) Block::add(array( @@ -204,8 +212,8 @@ $(document).ready(function() { array( 'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')), 'service_name()'=>array('label'=>'Details'), - 'plugin()->domain_registrar->id'=>array('label'=>'SID'), - 'plugin()->domain_registrar->name'=>array('label'=>'Supplier'), + 'plugin()->registrar->id'=>array('label'=>'SID'), + 'plugin()->registrar->name'=>array('label'=>'Supplier'), 'display("date_next_invoice")'=>array('label'=>'Next Invoice'), ), array( @@ -218,7 +226,7 @@ $(document).ready(function() { public function action_listhostservicesbysupplier() { $svs = ORM::factory('Service')->list_bylistgroup('HOST'); - Sort::MAsort($svs,'plugin()->host_server,name()'); + Sort::MAsort($svs,'plugin()->host,name()'); $list = array(); @@ -264,26 +272,28 @@ $(document).ready(function() { // Validate the transactions $bt = NULL; - $save = (isset($_REQUEST['go']) && $_REQUEST['go']=1) ? 1 : 0; - $xsid=197; + $pr = TRUE; // Next entry is a pro-rata foreach ($so->transactions()->where('item_type','=',0)->find_all() as $iio) { - if (! $iio->invoice->status) continue; // @todo This hard coding of 3070 should be removed. - if ($iio->service_id == $xsid AND $iio->invoice_id < 3070) continue; - if ($iio->quantity < 0 OR $iio->price_base < 0) - continue; - if (in_array($iio->id,array(960))) +// $xsid=197; +// if (($iio->service_id == $xsid AND $iio->invoice_id < 3070) OR in_array($iio->id,array(960))) continue; + + if (! $iio->invoice->status OR $iio->void) continue; - if ($iio->invoice_id > 4000 OR $iio->product->prod_plugin_file=="ADSL") - $a = FALSE; - else - $a = TRUE; + if ($iio->quantity < 0 OR $iio->price_base < 0) { + $bt = $iio->date_start; + $pr = TRUE; + + continue; + } if (is_null($bt)) $bt = $iio->date_start; - $pdata = Period::details($iio->recurring_schedule,$a ? NULL : $iio->product->price_recurr_weekday,$bt,TRUE,TRUE); + $a = ($iio->invoice_id > 4000 OR $iio->product->prod_plugin_file == 'ADSL') ? FALSE : TRUE; + + $pdata = Period::details($iio->recurring_schedule,$a ? NULL : $iio->product->price_recurr_weekday,$bt,TRUE,$iio->product->price_recurr_strict); switch ($iio->recurring_schedule) { case 1: @@ -295,22 +305,25 @@ $(document).ready(function() { $iio->date_start=$pdata['start_time']; } - if ($iio->date_stop != $pdata['end_time']) { + if (! $pr AND $iio->date_stop != $pdata['end_time']) { $doutput .= sprintf('%s: Set end_time: %s [%s]
    ',$iio->id,Config::date($pdata['end_time']),$pdata['end_time']); - $iio->date_stop=$pdata['end_time']; + $iio->date_stop = $pdata['end_time']; } - $bt = $pdata['end_time']+86400; - //$doutput .= sprintf('%s: BT now: %s (%s) [%s]
    ',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt); + $bt = ($pr ? $iio->date_stop : $pdata['end_time'])+86400; + + // $doutput .= sprintf('%s: BT now: %s (%s) [%s]
    ',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt); break; default: $doutput .= sprintf('%s: %s Not handled',$iio->id,$iio->recurring_schedule); } + + $pr = FALSE; + //$doutput .= '
    '; - if ($save) { + if (($x=$this->request->query('go')) AND $x==1) $iio->save(); - } } if (isset($_REQUEST['go'])) diff --git a/modules/service/classes/Controller/User/Service.php b/modules/service/classes/Controller/User/Service.php index 9da5b38a..94f37916 100644 --- a/modules/service/classes/Controller/User/Service.php +++ b/modules/service/classes/Controller/User/Service.php @@ -25,8 +25,8 @@ class Controller_User_Service extends Controller_Service { $amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : ''); $o = array( - 'u'=>$amo->username_value() ? $amo->username_value() : strtolower($amo->name()), - 'p'=>(! $k OR ! $this->request->is_ajax() OR ! $so->loaded() OR ! isset($_REQUEST['k']) OR $k != $_REQUEST['k']) ? Random::char() : $amo->password_value(), + 'u'=>$amo->username() ? $amo->username() : strtolower($amo->name()), + 'p'=>(! $k OR ! $this->request->is_ajax() OR ! $so->loaded() OR ! isset($_REQUEST['k']) OR $k != $_REQUEST['k']) ? Random::char() : $amo->password(), ); $this->response->headers('Content-Type','application/json'); diff --git a/modules/service/classes/Model/Service.php b/modules/service/classes/Model/Service.php index 6ffbe59f..305336cf 100644 --- a/modules/service/classes/Model/Service.php +++ b/modules/service/classes/Model/Service.php @@ -29,6 +29,8 @@ class Model_Service extends ORM_OSB { 'account'=>array(), ); + protected $_save_message = TRUE; + // Validation rules public function rules() { $x = Arr::merge(parent::rules(), array( @@ -167,7 +169,7 @@ class Model_Service extends ORM_OSB { $iio->find(); - $x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : $iio->date_stop; + $x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : ($iio->total() < 0 ? $iio->date_start-86400 : $iio->date_stop); return $format ? Config::date($x) : $x; } @@ -255,7 +257,7 @@ class Model_Service extends ORM_OSB { * Return a descriptive name for this service */ public function service_name() { - return is_null($plugin=$this->plugin()) ? $this->name() : $plugin->service_name(); + return is_null($x=$this->plugin()) ? $this->name() : $x->service_name(); } /** @@ -286,16 +288,17 @@ class Model_Service extends ORM_OSB { case 'invoice_detail_items': return is_null($plugin) ? array() : $plugin->_details($type); - case 'service_view': - return is_null($plugin) ? HTML::nbsp('') : $plugin->render_view(); - default: throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type)); } } + public function service_view() { + return ! is_object($x=$this->plugin()) ? HTML::nbsp('') : $x->render_view(); + } + public function transactions() { - return $this->invoice_item->order_by('date_start')->order_by('date_stop'); + return $this->invoice_item->order_by('date_start','ASC')->order_by('product_id','ASC')->order_by('date_stop','ASC'); } /** LIST FUNCTIONS **/ diff --git a/modules/service/classes/Model/Service/Plugin.php b/modules/service/classes/Model/Service/Plugin.php index fad8ca39..6cb61fe7 100644 --- a/modules/service/classes/Model/Service/Plugin.php +++ b/modules/service/classes/Model/Service/Plugin.php @@ -13,6 +13,10 @@ abstract class Model_Service_Plugin extends ORM_OSB { // Reset any sorting that may be defined in our parent protected $_sorting = array(); + protected $_belongs_to = array( + 'service'=>array(), + ); + /** * When does our service expire */ @@ -26,56 +30,43 @@ abstract class Model_Service_Plugin extends ORM_OSB { /** * The table attributes that provide username/password values */ - abstract public function password_value(); - abstract public function username_value(); - - /** - * 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)); - } - } + abstract public function password(); + abstract public function username(); /** * Provide the button that launches the management of this service, generally from a 3rd party */ - public function manage_button() { + protected function manage() { + // Dont show the manage button for expired or inactive services if (! $this->service->status OR $this->service->expiring()) return FALSE; - static $k = ''; + static $x = ''; - // If $k is already set, we've rendered this JS - if ($k) - return TRUE; + // If $x is already set, we've rendered this JS + if (! $x) { + $x = Random::char(); - $k = Random::char(); - Session::instance()->set('manage_button',$k); + Session::instance()->set('manage_button',$x); - Script::add(array('type'=>'stdin','data'=>' - $(document).ready(function() { - var x=0; - $("button[name=submit]").click(function() { - var t=$(this).val().split(":"); - if (x++) { alert("Session expired, please refresh the page!"); return false; } - $.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) { - $.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); - }).error(function() { alert("There was a problem with the request"); return false; }).success( -function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); }); - }); - });' - )); + Script::factory() + ->type('stdin') + ->data(' +$(document).ready(function() { + var x=0; + + $("button[name=submit]").click(function() { + var t=$(this).val().split(":"); + if (x++) { alert("Session expired, please refresh the page!"); return false; } + + $.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$x.'",t: t[1] }, + function(data) {$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); }) + .error(function() { alert("There was a problem with the request"); return false; }) + .success(function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); }); + }); +});' + ); + } return TRUE; } @@ -109,5 +100,23 @@ function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); }); 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/service/views/service/admin/add.php b/modules/service/views/service/admin/add.php index c0ef709b..acf31120 100644 --- a/modules/service/views/service/admin/add.php +++ b/modules/service/views/service/admin/add.php @@ -40,7 +40,7 @@
    -
    +
    @@ -48,4 +48,4 @@
    - + diff --git a/modules/service/views/service/admin/edit.php b/modules/service/views/service/admin/edit.php index e137cdcf..21b91018 100644 --- a/modules/service/views/service/admin/edit.php +++ b/modules/service/views/service/admin/edit.php @@ -1,54 +1,42 @@ -
    -
    -
    - Update Service +
    +
    + Update Service -
    -
    - status,FALSE,array('label'=>'Active','class'=>'span1')); ?> -
    -
    +
    + status,FALSE,array('label'=>'Active','class'=>'span1')); ?> +
    -
    -
    - recur_schedule,FALSE,array('label'=>'Billing Period','required'));?> -
    -
    +
    + recur_schedule,FALSE,array('label'=>'Billing Period','required'));?> +
    -
    -
    - display('date_next_invoice'),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'','disabled')); ?> -
    - - date_next_invoice); ?> -
    - -
    -
    - taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?> -
    -
    - -
    -
    - suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?> -
    -
    - -
    -
    - price_override,array('label'=>'Override Price','class'=>'span1')); ?> -
    -
    - - - -
    -
    - - -
    +
    +
    + display('date_next_invoice'),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'','disabled')); ?>
    -
    -
    -
    + + date_next_invoice); ?> +
    + +
    + taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?> +
    + +
    + suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?> +
    + +
    + price_override,array('label'=>'Override Price','class'=>'span1')); ?> +
    + + + + +
    +
    + + +
    +
    + diff --git a/modules/service/views/service/admin/view.php b/modules/service/views/service/admin/view.php index 6735b57a..e367b374 100644 --- a/modules/service/views/service/admin/view.php +++ b/modules/service/views/service/admin/view.php @@ -1,40 +1,50 @@ -pending_change()) {?> -Pending change to: service_change->list_details(); ?> - -
    - - - - - - - - - - - - - - - transactions()->find_all() as $iio) { ?> - product_id) AND $lp != $iio->product_id) { - $lp = $iio->product_id; ?> - - - - - - - - - - - - - - - - - - -
    IDInvoiceProductITRSStartStopDescQuantityCharge
    product_id; ?>product->title(); ?>
    id; ?>invoice_id),$iio->invoice_id); ?>display('product_id'); ?>display('item_type'); ?>display('recurring_schedule'); ?>display('date_start'); ?>display('date_stop'); ?>display('product_name'); ?>display('quantity'); ?>display('price_base'); ?>
    +pending_change()) : ?> +
    + Pending change to: service_change->list_details(); ?> +
    + + +
    +
    + Service Transaction Details + + + + + + + + + + + + + + + + + + transactions()->find_all() as $iio) : ?> + product_id) AND $lp != $iio->product_id) : $lp = $iio->product_id; ?> + + + + + + + + + + + + + + + + + + + +
    IDInvoiceITRSStartStopQuantityChargeDesc
    product_id; ?>product->title(); ?>
    id; ?>invoice_id),$iio->invoice_id); ?>display('item_type'); ?>display('recurring_schedule'); ?>display('date_start'); ?>display('date_stop'); ?>display('quantity'); ?>display('price_base'); ?>display('product_name'); ?>
    +
    +
    diff --git a/modules/service/views/service/user/view.php b/modules/service/views/service/user/view.php index 8b50cb9a..9834d4c9 100644 --- a/modules/service/views/service/user/view.php +++ b/modules/service/views/service/user/view.php @@ -1,9 +1,8 @@ -
    -
    +
    +
    Service Information
    -
    Account
    account->name(),$o->account->accnum()); ?>
    @@ -16,7 +15,8 @@
    Cost
    price_override) ? sprintf('%s ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?>
    - price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'price_base'))) : ?> + + price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'base'))) : ?>
    Service
    product_id,$o->product->title()); ?>
    @@ -32,103 +32,109 @@
    Current Invoices Due
    due(TRUE); ?>
    -
    - product->feature_summary()) : - echo $o->product->feature_summary(); - endif ?> + product->feature_summary(); ?> +
    -
    +
    + service_view(); ?> +
    -
    - details('service_view'); ?> -
    +service_billing->loaded()) : ?> +
    +
    + Automatic Payment Details -
    - service_billing->loaded()) : ?> -
    - Automatic Payment Details +
    +
    Direct Payment
    +
    service_billing->checkout->display('name'); ?>
    +
    +
    +
    + -
    service_billing->checkout->display('name'); ?>
    -
     
    +charges()) : ?> +
    +
    + Service Charges to Bill: charges(TRUE,TRUE); ?> -
    - + data($o->charge_list(TRUE)) + ->columns(array( + 'date_orig'=>'Date', + 'description'=>'Description', + 'total(TRUE)'=>'Amount', + )); ?> +
    +
    + - charges()) : ?> -
    - Service Charges to Bill: charges(TRUE,TRUE); ?> +status) : ?> +
    +
    + Next Invoice Charges - data($o->charge_list(TRUE)) - ->columns(array( - 'date_orig'=>'Date', - 'description'=>'Description', - 'total(TRUE)'=>'Amount', - )); ?> + add_service($o)->render('html','body',array('noid'=>TRUE)); ?> +
    +
    + -
    - - -
    +
    +
    Invoices for this Service + data($o->invoice_list()) ->columns(array( 'id'=>'ID', 'date_orig'=>'Date', 'due_date'=>'Due', - 'total(TRUE)'=>'Amount', + 'total(TRUE)'=>'Amount', 'due(TRUE)'=>'Due', )) ->prepend(array( 'id'=>array('url'=>URL::link('user','invoice/view/')), )); ?>
    - - status) : ?> -
    - Next Invoice Charges - add_service($o)->render('html','body',array('noid'=>TRUE)); ?> -
    - -
    + service_memo->find_all(); if ($x->count()) : ?> -
    -
    - Service Memos - data($x) - ->columns(array( - 'id'=>'ID', - 'date_orig'=>'Date', - 'account->name()'=>'Account', - 'memo'=>'Memo', - )); ?> -
    -
    +
    +
    + Service Memos + + data($x) + ->columns(array( + 'id'=>'ID', + 'date_orig'=>'Date', + 'account->name()'=>'Account', + 'memo'=>'Memo', + )); ?> +
    +
    email()->find_all(); if ($x->count()) : ?> -
    -
    - Emails about this service - data($x) - ->columns(array( - 'id'=>'ID', - 'date_orig'=>'Date', - 'resolve("subject")'=>'Subject', - )) - ->prepend(array( - 'id'=>array('url'=>URL::link('user','email/view/')), - )) - ->postproc(array( - 'resolve("subject")'=>array('trim'=>45), - )); ?> -
    -
    +
    +
    + Emails about this service + + data($x) + ->columns(array( + 'id'=>'ID', + 'date_orig'=>'Date', + 'resolve("subject")'=>'Subject', + )) + ->prepend(array( + 'id'=>array('url'=>URL::link('user','email/view/')), + )) + ->postproc(array( + 'resolve("subject")'=>array('trim'=>45), + )); ?> +
    +
    diff --git a/modules/ssl/classes/Model/Product/Plugin/Ssl.php b/modules/ssl/classes/Model/Product/Plugin/Ssl.php index 4f35c316..c403e0b8 100644 --- a/modules/ssl/classes/Model/Product/Plugin/Ssl.php +++ b/modules/ssl/classes/Model/Product/Plugin/Ssl.php @@ -13,20 +13,16 @@ class Model_Product_Plugin_Ssl extends Model_Product_Plugin { protected $_table_name = 'ssl'; // Our required abstract methods - public function render_edit() {} - public function cost($annual=FALSE) { + // @todo $x = 0; return $annual ? $x*12 : $x; } - public function feature_summary() { - // @todo This view should render based on the the results of this::allowance(); - return View::factory('product/plugin/ssl/feature_summary') - ->set('po',$this); - } + public function render_edit() {} + // @todo public function supplier() { return 'internal'; } diff --git a/modules/ssl/classes/Model/Service/Plugin/Ssl.php b/modules/ssl/classes/Model/Service/Plugin/Ssl.php index 273abd60..689dd5fc 100644 --- a/modules/ssl/classes/Model/Service/Plugin/Ssl.php +++ b/modules/ssl/classes/Model/Service/Plugin/Ssl.php @@ -30,7 +30,10 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin { ), ); + protected $_save_message = TRUE; + // Required abstract functions + public function expire($format=FALSE) { return $this->_so->get_valid_to($format); } @@ -39,8 +42,11 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin { return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr'); } - public function password_value() {} // Not used - public function username_value() {} // Not used + public function password() {} // Not used + + public function username() {} // Not used + + // Local functions private $_so = NULL; diff --git a/modules/ssl/views/product/plugin/ssl/feature_summary.php b/modules/ssl/views/product/plugin/ssl/view.php similarity index 60% rename from modules/ssl/views/product/plugin/ssl/feature_summary.php rename to modules/ssl/views/product/plugin/ssl/view.php index 01300a8f..11299edb 100644 --- a/modules/ssl/views/product/plugin/ssl/feature_summary.php +++ b/modules/ssl/views/product/plugin/ssl/view.php @@ -1,10 +1,8 @@ -
    +
    SSL Features
    -
    Type
    -
    display('extensions'); ?>
    - +
    display('extensions'); ?>
    diff --git a/modules/ssl/views/service/admin/plugin/ssl/edit.php b/modules/ssl/views/service/admin/plugin/ssl/edit.php index 5ac6e73e..74c6000d 100644 --- a/modules/ssl/views/service/admin/plugin/ssl/edit.php +++ b/modules/ssl/views/service/admin/plugin/ssl/edit.php @@ -1,17 +1,15 @@ -
    -
    +
    + SSL Certificate Service Details + +
    service->plugin()->csr,array('class'=>'span6','label'=>'CSR','placeholder'=>'CSR','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->csr))); ?>
    -
    -
    -
    +
    service->plugin()->pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->pk))); ?>
    -
    -
    -
    +
    service->plugin()->cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->cert))); ?>
    -
    +
    diff --git a/modules/ssl/views/service/user/plugin/ssl/view.php b/modules/ssl/views/service/user/plugin/ssl/view.php index 75b947f9..228de39d 100644 --- a/modules/ssl/views/service/user/plugin/ssl/view.php +++ b/modules/ssl/views/service/user/plugin/ssl/view.php @@ -1,57 +1,60 @@ -
    - Service Details +
    +
    + Service Details -
    +
    +
    DN
    +
    dn(); ?>
    -
    DN
    -
    dn(); ?>
    +
    Serial Number
    +
    serial(); ?>
    -
    Serial Number
    -
    serial(); ?>
    +
    Subject Key Id
    +
    ski(); ?>
    -
    Subject Key Id
    -
    ski(); ?>
    +
    Issuer
    +
    + validCA() AND $o->authorised($o->ca)) : ?> + ca->id,$o->issuer()); ?> + + issuer(); ?> + +
    -
    Issuer
    -
    - validCA() AND $o->authorised($o->ca)) : ?> - ca->id,$o->issuer()); ?> - - issuer(); ?> - -
    +
    Issuer Serial
    +
    aki_keyid(), $o->aki_serial()); ?>
    -
    Issuer Serial
    -
    aki_keyid(), $o->aki_serial()); ?>
    +
    Valid From
    +
    valid_from(TRUE); ?>
    -
    Valid From
    -
    valid_from(TRUE); ?>
    +
    Valid To
    +
    valid_to(TRUE); ?>
    -
    Valid To
    -
    valid_to(TRUE); ?>
    +
    Hash
    +
    hash(); ?>
    -
    Hash
    -
    hash(); ?>
    +
    Version
    +
    version(); ?>
    -
    Version
    -
    version(); ?>
    +
    Algorithm
    +
    algorithm(); ?>
    -
    Algorithm
    -
    algorithm(); ?>
    +
    +
    +
    - -
    +
    +
    + Certificate +
    cert; ?>
    -
    - Certificate -
    cert; ?>
    + download_button(); + if ($ao=Auth::instance()->get_user() AND ($ao->isAdmin() OR $ao->isReseller()) AND $o->service->status AND ($o->valid_to()-(Kohana::$config->load('ssl.min_renew_days')*86400) <= time()) AND $o->service->paid_to() > time()) : + echo Form::open(URL::link('reseller','ssl/renew/'.$o->service->id)); + echo Form::button('submit','Renew',array('class'=>'btn btn-primary')); + endif + ?> - download_button(); - if ($ao=Auth::instance()->get_user() AND ($ao->isAdmin() OR $ao->isReseller()) AND $o->service->status AND ($o->valid_to()-(Kohana::$config->load('ssl.min_renew_days')*86400) <= time()) AND $o->service->paid_to() > time()) : - echo Form::open(URL::link('reseller','ssl/renew/'.$o->service->id)); - echo Form::button('submit','Renew',array('class'=>'btn btn-primary')); - endif - ?> - -
    +
    +
    diff --git a/modules/ssl/views/ssl/reseller/add_edit.php b/modules/ssl/views/ssl/reseller/add_edit.php index 9592818c..4e295148 100644 --- a/modules/ssl/views/ssl/reseller/add_edit.php +++ b/modules/ssl/views/ssl/reseller/add_edit.php @@ -1,8 +1,8 @@ -
    -
    +
    +
    + SSL CA Certificate Edit/Update
    -
    Subject
    subject(); ?>
    @@ -46,13 +46,11 @@
    Key Algorithm
    algorithm(); ?>
    -
    -
    +
    - sign_pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_pk))); ?> - sign_cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_cert))); ?> + sign_pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_pk))); ?> + sign_cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_cert))); ?> - 'btn btn-primary')); ?> -
    -
    + 'btn btn-primary')); ?> +
    diff --git a/modules/static_page/classes/controller/staticpage/category.php b/modules/static_page/classes/controller/staticpage/category.php index fee3d482..88b8efc7 100644 --- a/modules/static_page/classes/controller/staticpage/category.php +++ b/modules/static_page/classes/controller/staticpage/category.php @@ -14,7 +14,7 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault { * By default show a menu of available categories */ public function action_index() { - HTTP::redirect('staticpage_category/list'); + HTTP::redirect('staticpage_category/list'); } public function action_list() { diff --git a/modules/task/classes/Controller/Admin/Task.php b/modules/task/classes/Controller/Admin/Task.php index 7bb9208b..f719832f 100644 --- a/modules/task/classes/Controller/Admin/Task.php +++ b/modules/task/classes/Controller/Admin/Task.php @@ -24,7 +24,7 @@ class Controller_Admin_Task extends Controller_Task { ->title(_('Task Log')) ->title_icon('icon-th-list') ->body(Table::factory() - ->page_items(50) + ->page_items(50) ->data(ORM::factory('Task_Log')->find_all()) ->columns(array( 'id'=>'ID', @@ -32,8 +32,7 @@ class Controller_Admin_Task extends Controller_Task { 'task->display("name")'=>'Task', 'result'=>'Result', 'message'=>'Message', - )) - ); + ))); } } ?> diff --git a/modules/task/classes/Task/Task/Clean.php b/modules/task/classes/Task/Task/Clean.php index c736094e..424ded1c 100644 --- a/modules/task/classes/Task/Task/Clean.php +++ b/modules/task/classes/Task/Task/Clean.php @@ -17,41 +17,47 @@ class Task_Task_Clean extends Minion_Task { foreach ($tl->find_all() as $to) { // Delete Task already running messages. - if (preg_match('/^Task\ [0-9]+\ is already running$/',$to->message) AND $to->date_orig < time()+$delay) { + if (preg_match('/^Task\ [0-9]+\ is already running$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } // Delete Empty Invoices Sent - if (preg_match('/^Invoices Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) { + if (preg_match('/^Invoices Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } // Delete Overdue Notes Sent - if (preg_match('/^OverDue Notice #[0-9] Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) { + if (preg_match('/^OverDue Notice #[0-9] Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } // Over Notes Sent - if (preg_match('/^(Overdue|Due) Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) { + if (preg_match('/^(Overdue|Due) Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } // Services Invoiced - if (preg_match('/^Services Invoiced:\s+$/',$to->message) AND $to->date_orig < time()+$delay) { + if (preg_match('/^Services Invoiced:\s+$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } - if (in_array($to->task_id,array(2,4,13)) AND $to->date_orig < time()+$delay) { + // Alerts Sent + if (preg_match('/^0 alerts sent \(\)$/',$to->message) AND $to->date_orig < time()-$delay) { $to->delete(); continue; } - if (in_array($to->task_id,array(3)) AND $to->date_orig < time()+86400*60) { + if (in_array($to->task_id,array(4,13)) AND $to->date_orig < time()-$delay) { + $to->delete(); + continue; + } + + if (in_array($to->task_id,array(3)) AND $to->date_orig < time()-86400*60) { $to->delete(); continue; } @@ -63,7 +69,7 @@ class Task_Task_Clean extends Minion_Task { OR preg_match('/View_Exception\s+/',$to->message) OR preg_match('/Kohana_Exception\s+/',$to->message)) - AND $to->date_orig < time()+$delay) { + AND $to->date_orig < time()-$delay) { $to->delete(); continue;