Internal overhaul

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

View File

@ -188,6 +188,10 @@ class Auth_OSB extends Auth_ORM {
return $uo; 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. * OSB authentication is controlled via database queries.
* *

View File

@ -171,13 +171,11 @@ class Controller_Admin_Module extends Controller_Module {
* List our installed modules * List our installed modules
*/ */
public function action_list() { public function action_list() {
$mo = ORM::factory('Module');
Block::factory() Block::factory()
->title('Defined Modules') ->title('Defined Modules')
->title_icon('icon-cog') ->title_icon('icon-cog')
->body(Table::factory() ->body(Table::factory()
->data($mo->find_all()) ->data(ORM::factory('Module')->where('parent_id','is',NULL)->find_all())
->jssort(TRUE) ->jssort(TRUE)
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',

View File

@ -33,7 +33,7 @@ class Controller_Reseller_Account extends Controller_Account {
'name(TRUE)'=>'Account', 'name(TRUE)'=>'Account',
'email'=>'Email', 'email'=>'Email',
'invoices_due_total(NULL,TRUE)'=>'Invoices', 'invoices_due_total(NULL,TRUE)'=>'Invoices',
'services_count(TRUE)'=>'Services', 'service->list_count()'=>'Services',
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('reseller','account/view/')), 'id'=>array('url'=>URL::link('reseller','account/view/')),

View File

@ -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) : '')); 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 * The key we use to sort entries of this model type
*/ */

View File

@ -67,5 +67,12 @@ class Model_Group extends Model_Auth_Role {
return $result; 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();
}
} }
?> ?>

View File

@ -261,8 +261,10 @@ abstract class ORM_OSB extends ORM {
/** /**
* Function help to find records that are active * Function help to find records that are active
*/ */
public function list_active() { public function list_active($active=TRUE) {
return $this->_where_active()->find_all(); $x=($active ? $this->_where_active() : $this);
return $x->find_all();
} }
public function list_count($active=TRUE) { public function list_count($active=TRUE) {

View File

@ -19,6 +19,9 @@ return array
'email_admin_only'=> array( // Override emails and send them to an admin instead 'email_admin_only'=> array( // Override emails and send them to an admin instead
#'task_invoice_list_overdue'=>array('deon@leenooks.net'=>'Deon George'), #'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 'invoice'=>0, // Number of invoices to generate in a pass
'site'=>FALSE, // Glogal site debug 'site'=>FALSE, // Glogal site debug
'show_errors'=>FALSE, // Show errors instead of logging in the DB. 'show_errors'=>FALSE, // Show errors instead of logging in the DB.

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Update Account Details</legend> <legend>Update Account Details</legend>
@ -9,9 +8,11 @@
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?> <?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?>
<?php echo Form::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'input-small','label'=>'Title','required')); ?>
<div class="row"> <div class="row">
<div class="span1">
<?php echo Form::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'input-small','label'=>'Title','required')); ?>
</div>
<div class="span2"> <div class="span2">
<?php echo Form::input('first_name',$o->display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?> <?php echo Form::input('first_name',$o->display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?>
</div> </div>
@ -46,6 +47,7 @@
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(),$o->language_id,array('label'=>'Language','required')); ?> <?php echo Form::select('language_id',ORM::factory('Language')->list_select(),$o->language_id,array('label'=>'Language','required')); ?>
<?php echo Form::select('currency_id',ORM::factory('Currency')->list_select(),$o->currency_id,array('label'=>'Currency','required')); ?> <?php echo Form::select('currency_id',ORM::factory('Currency')->list_select(),$o->currency_id,array('label'=>'Currency','required')); ?>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -53,6 +55,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,16 +1,14 @@
<div class="row"> <div class="span11">
<div class="span8 offset1">
<fieldset> <fieldset>
<legend>Reset Password</legend> <legend>Reset Password</legend>
<?php echo Form::input('password','',array('label'=>'Password','type'=>'password','required','minlength'=>8)); ?> <?php echo Form::input('password','',array('label'=>'Password','type'=>'password','required','minlength'=>8)); ?>
<?php echo Form::input('password_confirm','',array('label'=>'Confirm','type'=>'password','required','minlength'=>8)); ?> <?php echo Form::input('password_confirm','',array('label'=>'Confirm','type'=>'password','required','minlength'=>8)); ?>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
<button type="submit" class="btn btn-primary">Update</button> <button type="submit" class="btn btn-primary">Update</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,11 +1,11 @@
<div class="row"> <div class="span11">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Add Method</legend> <legend>Add Method</legend>
<?php echo Form::input('name',$name,array('label'=>'Method','disabled')); ?> <?php echo Form::input('name',$name,array('label'=>'Method','disabled')); ?>
<?php echo Form::input('notes','',array('label'=>'Description','placeholder'=>'Method Description','class'=>'span8')); ?> <?php echo Form::input('notes','',array('label'=>'Description','placeholder'=>'Method Description','class'=>'span8')); ?>
<?php echo Form::input('menu_display','',array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?> <?php echo Form::input('menu_display','',array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -13,6 +13,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset> </div> <!-- /span -->
</div> <!-- /span10 -->
</div> <!-- /row -->

View File

@ -1,19 +1,16 @@
<div class="row"> <div class="span5">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Configure Method </legend> <legend>Method Details</legend>
<?php echo Form::input('notes',$o->notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span8')); ?> <?php echo Form::input('notes',$o->notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span5')); ?>
<?php echo Form::input('menu_display',$o->menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?> <?php echo Form::input('menu_display',$o->menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?>
</fieldset> </fieldset>
</div> <!-- /span10 --> </div> <!-- /span -->
</div> <!-- /row -->
<div class="row"> <div class="span6">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Configure Method Security</legend> <legend>Method Security</legend>
<table class="table table-striped table-condensed table-hover" id="list-table"> <table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr> <thead><tr>
@ -34,6 +31,7 @@
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -41,7 +39,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</div> <!-- /span -->
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Application Setup</legend> <legend>Application Setup</legend>
@ -32,6 +31,7 @@
<?php echo Form::input('site_details[email]',$o->site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?> <?php echo Form::input('site_details[email]',$o->site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?>
<?php echo Form::input('site_details[faqurl]',$o->site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?> <?php echo Form::input('site_details[faqurl]',$o->site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -39,6 +39,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,7 +1,9 @@
<div class="row"> <div class="span11">
<div class="span10 offset1"> <fieldset>
<div class="row"> <legend>Application Setup</legend>
<div class="tabbable span9"> <div class="tabbable span9">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<?php $c=0;foreach ($o->module_config_id($mid) as $id => $data) : ?> <?php $c=0;foreach ($o->module_config_id($mid) as $id => $data) : ?>
<li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $c; ?>" data-toggle="tab"><?php echo $data['object']->display('name'); ?></a></li> <li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $c; ?>" data-toggle="tab"><?php echo $data['object']->display('name'); ?></a></li>
@ -17,8 +19,9 @@
</div> <!-- /tab-pane --> </div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule --> <?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content --> </div> <!-- /tab-content -->
</div> <!-- /tabbable --> </div> <!-- /tabbable -->
</div> <!-- /row --> </fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -27,4 +30,3 @@
</div> </div>
</div> </div>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -149,7 +149,7 @@ class ADSL_Billing_Exetelvisp {
// @todo This could be optimised better. // @todo This could be optimised better.
foreach ($aso->services(TRUE) as $so) 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; return $this;
} }

View File

@ -90,7 +90,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
->title_icon('icon-th-list') ->title_icon('icon-th-list')
->body(Table::factory() ->body(Table::factory()
->jssort('traffic') ->jssort('traffic')
->data($apo->products()->find_all()) ->data($apo->products())
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'title()'=>'Name', 'title()'=>'Name',

View File

@ -14,7 +14,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
// Relationships // Relationships
protected $_has_many = array( 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'), '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 * Return a list of plans that this supplier makes available
*/ */
public function find_plans($active=TRUE) { 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 ($this->find_plans(FALSE)->find_all() as $aspo) {
foreach ($aspo->plan->find_all() as $apo) { foreach ($aspo->plan->find_all() as $apo) {
foreach ($apo->products(FALSE)->find_all() as $po) { foreach ($apo->products(FALSE) as $po) {
foreach ($po->services($active)->find_all() as $so) { foreach ($po->service->list_active() as $so) {
array_push($result,$so); array_push($result,$so);
} }
} }

View File

@ -19,9 +19,6 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
protected $_belongs_to = array( protected $_belongs_to = array(
'supplier_plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'adsl_supplier_plan_id'), '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 * 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', '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 // Our required abstract methods
public function cost($annual=FALSE) { public function cost($annual=FALSE) {
@ -75,25 +64,24 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
return $annual ? $x*12 : $x; 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. // @todo Select the ADSL Plan for this product.
public function render_edit() { public function render_edit() {
return ''; return '';
} }
public function render_order() {
return View::factory(sprintf('product/plugin/%s/order',$this->plugin()));
}
public function supplier() { public function supplier() {
return $this->supplier_plan->supplier_id; 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 * Calculate the allowance array or traffic used array
@ -204,19 +192,5 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
return TRUE; 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;
}
} }
?> ?>

View File

@ -15,10 +15,6 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
// Relationships // Relationships
protected $_belongs_to = array(
'service'=>array(),
);
protected $_has_one = array( protected $_has_one = array(
'provided_plan'=>array('model'=>'Product_Plugin_Adsl','far_key'=>'provided_adsl_plan_id','foreign_key'=>'id'), '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 // Required abstract functions
public function expire() { public function expire() {
// We'll leave it to the Service record to determine when this service expires // We'll leave it to the Service record to determine when this service expires
return NULL; return NULL;
@ -46,43 +45,15 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
return $this->service_number; return $this->service_number;
} }
public function username_value() { public function password() {
return $this->service_username;
}
public function password_value() {
return $this->service_password; return $this->service_password;
} }
// Override our parent function to include some JS. public function username() {
public function admin_update() { return $this->service_username;
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();
} }
/** LOCAL FUNCTIONS **/ // Local functions
/** /**
* If we override the plan that the customers gets (from what the supplier provides). * 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) { 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; return $format ? Config::date($x) : $x;
} }
@ -475,6 +447,7 @@ $(document).ready(function() {
->where_open() ->where_open()
->and_where($this->_table_name.'.service_number','like','%'.$term.'%') ->and_where($this->_table_name.'.service_number','like','%'.$term.'%')
->or_where($this->_table_name.'.service_address','like','%'.$term.'%') ->or_where($this->_table_name.'.service_address','like','%'.$term.'%')
->or_where($this->_table_name.'.ipaddress','like','%'.$term.'%')
->where_close(); ->where_close();
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options); return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);

View File

@ -42,10 +42,10 @@ class Service_Traffic_ADSL_iiNetADSL extends Service_Traffic_ADSL {
// Find our services that need to be collected this way. // Find our services that need to be collected this way.
$update = array(); $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) { if ($so->service_adsl->service_stats_collect AND $so->service_adsl->service_stats_lastupdate < $date) {
$lastperiod = ''; $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 <= $this->today;
$servicedate=date('Y-m-d',strtotime('+1 day',strtotime($servicedate)))) { $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)) if ($debug AND file_exists($debug_file))
$data = file_get_contents($debug_file); $data = file_get_contents($debug_file);
else 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. // @todo There exists a possibility to skip a month, if we get a bad fetch on a previous month.
if ($data) if ($data)

View File

@ -1,8 +1,20 @@
<div class="row">
<div class="span6"> <div class="span6">
<fieldset>
<legend>ADSL Plan Details</legend>
<div class="row">
<div class="tabbable span5">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Peak</a></li>
<li><a href="#tab2" data-toggle="tab">Offpeak</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="row"> <div class="row">
<div class="span2"> <div class="span2">
<?php echo Form::input('base_down_peak',$o->base_down_peak,array('label'=>'Base Down Peak','class'=>'span1')); ?> <?php echo Form::input('base_down_peak',$o->base_down_peak,array('label'=>'Base Down','class'=>'span1')); ?>
</div> </div>
<div class="span2"> <div class="span2">
<?php echo Form::input('extra_down_peak',$o->extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?> <?php echo Form::input('extra_down_peak',$o->extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?>
@ -11,7 +23,20 @@
<div class="row"> <div class="row">
<div class="span2"> <div class="span2">
<?php echo Form::input('base_down_offpeak',$o->base_down_offpeak,array('label'=>'Base Down Off Peak','class'=>'span1')); ?> <?php echo Form::input('base_up_peak',$o->base_up_peak,array('label'=>'Base Up','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_up_peak',$o->extra_up_peak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
</div>
</div> <!-- /tab-pane -->
<div class="tab-pane" id="tab2">
<div class="row">
<div class="span2">
<?php echo Form::input('base_down_offpeak',$o->base_down_offpeak,array('label'=>'Base Down','class'=>'span1')); ?>
</div> </div>
<div class="span2"> <div class="span2">
<?php echo Form::input('extra_down_offpeak',$o->extra_down_offpeak,array('label'=>'Extra','class'=>'span1')); ?> <?php echo Form::input('extra_down_offpeak',$o->extra_down_offpeak,array('label'=>'Extra','class'=>'span1')); ?>
@ -20,39 +45,30 @@
<div class="row"> <div class="row">
<div class="span2"> <div class="span2">
<?php echo Form::input('base_up_peak',$o->base_up_peak,array('label'=>'Base Up Peak','class'=>'span1')); ?> <?php echo Form::input('base_up_offpeak',$o->base_up_offpeak,array('label'=>'Base Up','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_up_peak',$o->extra_up_peak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?php echo Form::input('base_up_offpeak',$o->base_up_offpeak,array('label'=>'Base Up Off Peak','class'=>'span1')); ?>
</div> </div>
<div class="span2"> <div class="span2">
<?php echo Form::input('extra_up_offpeak',$o->extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?> <?php echo Form::input('extra_up_offpeak',$o->extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?>
</div> </div>
</div> </div>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span2">
<?php echo Form::input('contract_term',$o->contract_term,array('label'=>'Contract Term','class'=>'span1')); ?> <?php echo Form::input('contract_term',$o->contract_term,array('label'=>'Contract Term','class'=>'span1')); ?>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="span2">
<?php echo StaticList_YesNo::form('extra_charged',$o->extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('extra_charged',$o->extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="span6"> <?php echo Form::select('adsl_supplier_plan_id',ORM::factory('ADSL_Supplier_Plan')->list_select(),$o->adsl_supplier_plan_id,array('label'=>'Supplier Plan','class'=>'span4')); ?>
<?php echo Form::select('adsl_supplier_plan_id',ORM::factory('ADSL_Supplier_Plan')->list_select(),$o->adsl_supplier_plan_id,array('label'=>'Supplier Plan')); ?>
</div>
</div> </div>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -65,6 +81,7 @@
<div class="span5"> <div class="span5">
<fieldset> <fieldset>
<legend>Supplier Details</legend> <legend>Supplier Details</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Supplier</dt> <dt>Supplier</dt>
<dd><?php echo $o->supplier_plan->supplier->name; ?></dd> <dd><?php echo $o->supplier_plan->supplier->name; ?></dd>
@ -87,6 +104,7 @@
<div class="span5"> <div class="span5">
<fieldset> <fieldset>
<legend>Test Traffic</legend> <legend>Test Traffic</legend>
<div class="row"> <div class="row">
<div class="span2"> <div class="span2">
<?php echo Form::input('test[base_down_peak]',10000,array('label'=>'Down Peak','class'=>'span1')); ?> <?php echo Form::input('test[base_down_peak]',10000,array('label'=>'Down Peak','class'=>'span1')); ?>
@ -113,6 +131,7 @@
<?php if ($test_result) : ?> <?php if ($test_result) : ?>
<fieldset> <fieldset>
<legend>Test Traffic Result</legend> <legend>Test Traffic Result</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<?php foreach ($test_result as $k=>$v) : ?> <?php foreach ($test_result as $k=>$v) : ?>
<dt><?php echo $k; ?></dt> <dt><?php echo $k; ?></dt>
@ -125,4 +144,3 @@
</fieldset> </fieldset>
<?php endif ?> <?php endif ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -31,5 +31,4 @@
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>

View File

@ -14,14 +14,14 @@
<?php foreach ($aso->services(TRUE) as $so) : ?> <?php foreach ($aso->services(TRUE) as $so) : ?>
<?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?> <?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?>
<tr class="<?php echo $o->charge($service_number) == $po->adsl_supplier_plan->display('base_cost') ? '' : 'error'; ?>"> <tr class="<?php echo $o->charge($service_number) == $po->supplier_plan->display('base_cost') ? '' : 'error'; ?>">
<td><?php echo $service_number; ?></td> <td><?php echo $service_number; ?></td>
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td> <td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td>
<td><?php echo $po->adsl_supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td> <td><?php echo $po->supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td>
<td><?php echo $p->contract_date_start(TRUE); ?></td> <td><?php echo $p->contract_date_start(TRUE); ?></td>
<td><?php echo $p->contract_date_end(TRUE); ?></td> <td><?php echo $p->contract_date_end(TRUE); ?></td>
<td><?php echo $po->adsl_supplier_plan->display('base_cost'); ?></td> <td><?php echo $po->supplier_plan->display('base_cost'); ?></td>
<td><?php echo Currency::display($o->charge($service_number)); ?></td> <td><?php echo Currency::display($o->charge($service_number)); ?></td>
<td><?php echo Currency::display($o->excess($service_number)); ?></td> <td><?php echo Currency::display($o->excess($service_number)); ?></td>

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Exetel VISP Billing</legend> <legend>Exetel VISP Billing</legend>
@ -9,4 +8,3 @@
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?> <?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -4,44 +4,49 @@
</div> <!-- /page-title --> </div> <!-- /page-title -->
<div id="container"> <div id="container">
<div class="row">
<div class="grid-12">
<div class="tablewrapper"> <div class="tablewrapper">
<table class="plan plain"> <table class="plan plain">
<tr class="plan-header"> <tr class="plan-header">
<th class="plan-title">Plan Name</th> <th class="plan-title">Plan Name</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<?php foreach ($o->products() as $po) : ?>
<td class="plan-title"><?php echo $po->title(); ?> <small>(<?php echo $po->id; ?>)</small></td> <td class="plan-title"><?php echo $po->title(); ?> <small>(<?php echo $po->id; ?>)</small></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<tr class="plan-header"> <tr class="plan-header">
<th class="plan-price" >Price</th> <th class="plan-price" >Price</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<?php $x = (string)Currency::display($po->price(0,1,'price_base',TRUE)); ?> <?php foreach ($o->products() as $po) : ?>
<?php $go = $po->price_best($o->recur_schedule,TRUE); ?>
<?php $price = (string)Currency::display($po->price($go->id,$o->recur_schedule,'base',TRUE)); ?>
<td class="plan-price"> <td class="plan-price">
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(1); ?></span> <span class="note">$</span><?php echo substr($price,0,strpos($price,'.')); ?><span class="cents"> .<?php echo substr($price,-2,strpos($price,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get($o->recur_schedule); ?></span>
</td> </td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<tr class="plan-features"> <tr class="plan-features">
<th>Connection</th> <th>Connection</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><span class="note">$</span><?php echo Currency::display($po->price(0,1,'price_setup',TRUE)); ?></td> <?php foreach ($o->products() as $po) : ?>
<?php $go = $po->price_best($o->recur_schedule,TRUE); ?>
<td><span class="note">$</span><?php echo Currency::display($po->price($go->id,$o->recur_schedule,'setup',TRUE)); ?></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<tr class="plan-features"> <tr class="plan-features">
<th>Speed</th> <th>Speed</th>
<?php $c=0; foreach ($o->products() as $po) : ?> <?php foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->supplier_plan->display('speed'); ?></td> <td><?php echo $po->plugin()->supplier_plan->display('speed'); ?></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<tr class="plan-features"> <tr class="plan-features">
<th>Peak Downloads</th> <th>Peak Downloads</th>
<?php $c=0; foreach ($o->products() as $po) : ?> <?php foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_peak/1000; ?><span class="normal">GB</span></td> <td><?php echo $po->plugin()->base_down_peak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
@ -49,27 +54,26 @@
<?php if ($po->plugin()->base_down_offpeak) : ?> <?php if ($po->plugin()->base_down_offpeak) : ?>
<tr class="plan-features"> <tr class="plan-features">
<th>OffPeak Downloads</th> <th>OffPeak Downloads</th>
<?php $c=0; foreach ($o->products() as $po) : ?> <?php foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_offpeak/1000; ?><span class="normal">GB</span></td> <td><?php echo $po->plugin()->base_down_offpeak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?> <?php endforeach ?>
</tr>
<?php endif ?> <?php endif ?>
<tr class="plan-features"> <tr class="plan-features">
<th>Extra Traffic</th> <th>Extra Traffic</th>
<?php $c=0; foreach ($o->products() as $po) : ?> <?php foreach ($o->products() as $po) : ?>
<td><span class="note">$</span><?php echo $po->plugin()->display('extra_down_peak'); ?><span class="normal">/GB</span></td> <td><span class="note">$</span><?php echo $po->plugin()->display('extra_down_peak'); ?><span class="normal">/GB</span></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<tr class="plan-features"> <tr class="plan-features">
<th>Contract Term</th> <th>Contract Term</th>
<?php $c=0; foreach ($o->products() as $po) : ?> <?php foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->display('contract_term'); ?> <span class="normal">mths</span></td> <td><?php echo $po->plugin()->display('contract_term'); ?> <span class="normal">mths</span></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
</table> </table>
</div> <!-- /tablewrapper --> </div> <!-- /tablewrapper -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container --> </div> <!-- /container -->

View File

@ -4,11 +4,14 @@
</div> <!-- /page-title --> </div> <!-- /page-title -->
<div id="container"> <div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4"> <div class="pricing-plans plans-4">
<div class="row"> <div class="row">
<?php $c=0; foreach ($o->products() as $po) : ?> <?php $c=0; foreach ($o->products() as $po) : ?>
<?php $go = $po->price_best($o->recur_schedule,TRUE); ?>
<?php $price = (string)Currency::display($po->price($go->id,$o->recur_schedule,'base',TRUE)); ?>
<?php if (is_null($price)) continue; ?>
<?php if (! ($c++%4) AND $c>1) : ?> <?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row --> </div> <!-- /row -->
<hr class="row-divider" /> <hr class="row-divider" />
@ -25,20 +28,21 @@
</div> <!-- /plan-title --> </div> <!-- /plan-title -->
<div class="plan-price"> <div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,1,'price_base',TRUE)); ?> <span class="note">$</span><?php echo substr($price,0,strpos($price,'.')); ?><span class="cents"> .<?php echo substr($price,-2,strpos($price,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get($o->recur_schedule); ?></span>
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(1); ?></span>
</div> <!-- /plan-price --> </div> <!-- /plan-price -->
</div> <!-- /plan-header --> </div> <!-- /plan-header -->
<div class="plan-features"> <div class="plan-features">
<ul> <ul>
<li><span class="note">$</span><strong><?php echo Currency::display($po->price(0,1,'price_setup',TRUE)); ?></strong> Connection</li> <li><span class="note">$</span><strong><?php echo Currency::display($po->price($go->id,$o->recur_schedule,'setup',TRUE)); ?></strong> Connection</li>
<li><strong><?php echo $po->plugin()->supplier_plan->display('speed'); ?></strong> Speed</li> <li><strong><?php echo $po->plugin()->supplier_plan->display('speed'); ?></strong> Speed</li>
<li><strong><?php echo $po->plugin()->base_down_peak/1000; ?></strong>GB Peak Downloads</li> <li><strong><?php echo $po->plugin()->base_down_peak/1000; ?></strong>GB Peak Downloads</li>
<?php if ($po->plugin()->base_down_offpeak) : ?> <?php if ($po->plugin()->base_down_offpeak) : ?>
<li><strong><?php echo $po->plugin()->base_down_offpeak/1000; ?></strong>GB OffPeak Downloads</li> <li><strong><?php echo $po->plugin()->base_down_offpeak/1000; ?></strong>GB OffPeak Downloads</li>
<?php endif ?> <?php endif ?>
<li><span class="note">$</span><strong><?php echo $po->plugin()->display('extra_down_peak'); ?></strong>/GB Extra Traffic</li> <li><span class="note">$</span><strong><?php echo $po->plugin()->display('extra_down_peak'); ?></strong>/GB Extra Traffic</li>
<li><strong><?php echo $po->plugin()->display('contract_term'); ?></strong> Months Contract</li> <li><strong><?php echo $po->plugin()->display('contract_term'); ?></strong> Months Contract</li>
</ul> </ul>
@ -56,6 +60,4 @@
</div> <!-- /row --> </div> <!-- /row -->
</div> <!-- /pricing-plans --> </div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container --> </div> <!-- /container -->

View File

@ -1,4 +1,4 @@
<fieldset class="span6"> <fieldset>
<legend>ADSL Features</legend> <legend>ADSL Features</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">

View File

@ -1,17 +1,16 @@
<fieldset>
<legend>ADSL Service Details</legend>
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::input('plugin[service_number]',$o->service_number,array('class'=>'span2','label'=>'Service Number','placeholder'=>'Service Number')); ?> <?php echo Form::input('plugin[service_number]',$o->service_number,array('class'=>'span2','label'=>'Service Number','placeholder'=>'Service Number')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::input('plugin[service_address]',$o->service_address,array('class'=>'span6','label'=>'Service Address','placeholder'=>'Service Address')); ?> <?php echo Form::input('plugin[service_address]',$o->service_address,array('class'=>'span6','label'=>'Service Address','placeholder'=>'Service Address')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5 input-append date" id="service_connect_date_label"> <div class="input-append date" id="service_connect_date_label">
<?php echo Form::input('service_connect_date_label',$o->display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?> <?php echo Form::input('service_connect_date_label',$o->display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div> </div>
@ -19,7 +18,7 @@
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5 input-append date" id="service_contract_date_label"> <div class="input-append date" id="service_contract_date_label">
<?php echo Form::input('service_contract_date_label',$o->display('service_contract_date'),array('class'=>'span2','label'=>'Contract Start Date','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?> <?php echo Form::input('service_contract_date_label',$o->display('service_contract_date'),array('class'=>'span2','label'=>'Contract Start Date','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div> </div>
@ -27,19 +26,14 @@
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::input('plugin[service_username]',$o->service_username,array('class'=>'span6','label'=>'Service Username','placeholder'=>'Service Username')); ?> <?php echo Form::input('plugin[service_username]',$o->service_username,array('class'=>'span6','label'=>'Service Username','placeholder'=>'Service Username')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::input('plugin[service_password]',$o->service_password,array('class'=>'span6','label'=>'Service Password','placeholder'=>'Service Password')); ?> <?php echo Form::input('plugin[service_password]',$o->service_password,array('class'=>'span6','label'=>'Service Password','placeholder'=>'Service Password')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::input('plugin[ipaddress]',$o->ipaddress,array('class'=>'span6','label'=>'Service IP Address','placeholder'=>'Service IP Address')); ?> <?php echo Form::input('plugin[ipaddress]',$o->ipaddress,array('class'=>'span6','label'=>'Service IP Address','placeholder'=>'Service IP Address')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
</fieldset>

View File

@ -5,6 +5,7 @@
<th><?php echo $o->friendly($i); ?></th> <th><?php echo $o->friendly($i); ?></th>
<?php endforeach ?> <?php endforeach ?>
</tr></thead> </tr></thead>
<tbody> <tbody>
<?php foreach ($td as $i => $details) : ?> <?php foreach ($td as $i => $details) : ?>
<tr> <tr>

View File

@ -1,8 +1,8 @@
<fieldset class="span5"> <div class="span6">
<fieldset>
<legend>Service Details</legend> <legend>Service Details</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Service Number</dt> <dt>Service Number</dt>
<dd><?php echo $o->display('service_number'); ?></dd> <dd><?php echo $o->display('service_number'); ?></dd>
@ -31,11 +31,12 @@
<dt>Offpeak Period</dt> <dt>Offpeak Period</dt>
<dd><?php printf('%s-%s',$o->offpeak_start,$o->offpeak_end); ?></dd> <dd><?php printf('%s-%s',$o->offpeak_start,$o->offpeak_end); ?></dd>
<?php endif ?> <?php endif ?>
</div> <!-- dl-horizontal --> </div> <!-- dl-horizontal -->
</fieldset> </fieldset>
</div> <!-- /span -->
<fieldset class="span6"> <div class="span6">
<fieldset>
<legend>Traffic Usage</legend> <legend>Traffic Usage</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
@ -48,9 +49,7 @@
<dt>Excess Traffic</dt> <dt>Excess Traffic</dt>
<dd>&nbsp;$<?php echo $o->traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?></dd> <dd>&nbsp;$<?php echo $o->traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?></dd>
</div> <!-- dl-horizontal --> </div> <!-- dl-horizontal -->
</fieldset>
<fieldset class="span6">
<form class="form-inline" method="POST"> <form class="form-inline" method="POST">
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>View Traffic for</dt> <dt>View Traffic for</dt>
@ -76,5 +75,5 @@
</div> <!-- /tab-content --> </div> <!-- /tab-content -->
</div> <!-- /tabbable --> </div> <!-- /tabbable -->
</fieldset> </fieldset>
</div> <!-- /span -->

View File

@ -69,12 +69,9 @@ class Controller_Reseller_Charge extends Controller_Charge {
->type('stdin') ->type('stdin')
->data(' ->data('
$(document).ready(function() { $(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({ $("#date_charge_label").datepicker({
autoclose : true, autoclose : true,
endDate : now, endDate : new Date(),
format : "dd-M-yyyy", format : "dd-M-yyyy",
todayBtn : true, todayBtn : true,
}).on("hide",function(ev) { }).on("hide",function(ev) {

View File

@ -1,6 +1,4 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Charge Details</legend> <legend>Charge Details</legend>
@ -28,4 +26,3 @@
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?> <?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -8,6 +8,7 @@
* @author Deon George * @author Deon George
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*
* @todo Does this need to be Serializable? * @todo Does this need to be Serializable?
*/ */
abstract class Checkout_Plugin implements Serializable { abstract class Checkout_Plugin implements Serializable {
@ -15,6 +16,7 @@ abstract class Checkout_Plugin implements Serializable {
protected $_object; protected $_object;
// Our required abstract classes // Our required abstract classes
public function serialize() { public function serialize() {
return (string)$this->_object; return (string)$this->_object;
} }
@ -23,6 +25,7 @@ abstract class Checkout_Plugin implements Serializable {
} }
// Required abstract classes // Required abstract classes
// Present pre-plugin processing information // Present pre-plugin processing information
abstract public function before(Cart $co); abstract public function before(Cart $co);
abstract public function notify(Model_Checkout_Notify $cno); abstract public function notify(Model_Checkout_Notify $cno);

View File

@ -47,7 +47,7 @@ $(document).ready(function() {
if ($o->registrar_ns) if ($o->registrar_ns)
return is_array($o->registrar_ns) ? implode(',',$o->registrar_ns) : '&gt;Invalid&lt;'; return is_array($o->registrar_ns) ? implode(',',$o->registrar_ns) : '&gt;Invalid&lt;';
else else
return is_array($o->domain_registrar->whitelabel_ns) ? implode(',',$o->domain_registrar->whitelabel_ns) : '&gt;Unknown&lt;'; return is_array($o->registrar->whitelabel_ns) ? implode(',',$o->registrar->whitelabel_ns) : '&gt;Unknown&lt;';
} }
} }
?> ?>

View File

@ -10,11 +10,8 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Product_Plugin_Domain extends Model_Product_Plugin { class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// This model doesnt have a database table
public function __construct() {
}
// Our required abstract methods // Our required abstract methods
public function cost($annual=FALSE) { public function cost($annual=FALSE) {
// @todo // @todo
$x = 0; $x = 0;
@ -22,8 +19,6 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
return $annual ? $x*12 : $x; return $annual ? $x*12 : $x;
} }
public function feature_summary() {}
public function render_edit() {} public function render_edit() {}
// @todo // @todo
@ -31,7 +26,16 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
return 'internal'; 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. // @todo This is not used, but should be.
public function order_features() { public function order_features() {

View File

@ -11,16 +11,14 @@
*/ */
class Model_Service_Plugin_Domain extends Model_Service_Plugin { class Model_Service_Plugin_Domain extends Model_Service_Plugin {
protected $_table_name = 'service__domain'; protected $_table_name = 'service__domain';
protected $_created_column = FALSE;
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
// Relationships // Relationships
protected $_has_one = array( protected $_has_one = array(
'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'), 'host'=>array('model'=>'Service_Plugin_Host','through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'),
'domain_registrar'=>array('foreign_key'=>'id','far_key'=>'domain_registrar_id'), 'registrar'=>array('model'=>'Domain_Registrar','foreign_key'=>'id','far_key'=>'domain_registrar_id'),
'service_plugin_host'=>array('through'=>'service','far_key'=>'service_id','foreign_key'=>'service_id'), 'tld'=>array('model'=>'Domain_TLD','foreign_key'=>'id','far_key'=>'domain_tld_id'),
);
protected $_belongs_to = array(
'service'=>array(),
); );
protected $_display_filters = array( protected $_display_filters = array(
@ -35,44 +33,41 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
), ),
); );
protected $_save_message = TRUE;
// Required abstract functions // Required abstract functions
public function admin_update() {
return '';
}
public function expire() { public function expire() {
return $this->domain_expire; return $this->domain_expire;
} }
public function name() { 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() { public function password() {
return sprintf('%s - %s',_('Domain Name License'),$this->name()); return $this->registrar_password;
} }
public function username_value() { public function username() {
return $this->registrar_username; return $this->registrar_username;
} }
public function password_value() { // Local functions
return $this->registrar_password;
}
/** /**
* This provides us with a manage button to jump to the registrar * This provides us with a manage button to jump to the registrar
* to manage the domain. * to manage the domain.
*/ */
public function manage_button($t='') { public function manage_button($t='') {
if (! parent::manage_button($t)) if (! parent::manage())
return NULL; 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() { public function manage_button_dns() {
return $this->service_plugin_host->manage_button('service_plugin_host'); return $this->host->manage_button('host');
} }
/** /**

View File

@ -22,8 +22,8 @@ class Service_Domain_PlanetDomain extends Service_Domain {
sprintf('%s/%s',$this->so->whitelabel_url,'newdnr/action/user/login.jsp'), 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)) 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_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_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%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::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden'));
$output .= Form::close(); $output .= Form::close();
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t))); $output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));

View File

@ -23,8 +23,8 @@ class Service_Domain_TPP extends Service_Domain {
$debug ? 'debug/site' : sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'), $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)) 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_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_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%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::close();
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t))); $output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));

View File

@ -0,0 +1,7 @@
<fieldset>
<legend>Domain Service Details</legend>
<div class="row">
<?php echo Form::input('plugin[domain_name]',NULL,array('class'=>'span2','label'=>'Domain Name','placeholder'=>'Domain Name','required')); ?>
</div> <!-- /row -->
</fieldset>

View File

@ -17,7 +17,7 @@
<dd><?php echo $x; ?></dd> <dd><?php echo $x; ?></dd>
<?php endif ?> <?php endif ?>
<?php if ($x=$o->manage_dns_button()) : ?> <?php if ($x=$o->manage_button_dns()) : ?>
<dt>DNS</dt> <dt>DNS</dt>
<dd><?php echo $x; ?></dd> <dd><?php echo $x; ?></dd>
<?php endif ?> <?php endif ?>

View File

@ -134,8 +134,8 @@ class Email_Template {
} }
} }
if (isset($this->_data['bcc'])) if ($x=Arr::merge($this->bcc,Kohana::$config->load('debug.email_bcc_admin')))
$sm->setBcc($this->bcc); $sm->setBcc($x);
if ($admin OR ($admin = Config::testmail($this->_etto->template->name))) { if ($admin OR ($admin = Config::testmail($this->_etto->template->name))) {
$sm->setTo($admin); $sm->setTo($admin);

View File

@ -17,6 +17,10 @@ class Model_Email_Template_Translate extends ORM_OSB {
'template'=>array('model'=>'Email_Template','foreign_key'=>'email_template_id'), 'template'=>array('model'=>'Email_Template','foreign_key'=>'email_template_id'),
); );
protected $_has_one = array(
'language'=>array('foreign_key'=>'id'),
);
protected $_save_message = TRUE; protected $_save_message = TRUE;
public function complete($data,$column) { public function complete($data,$column) {

View File

@ -1,32 +1,25 @@
<div class="span11">
<fieldset>
<legend>Update Template</legend>
<div class="row"> <div class="row">
<div class="span9 offset1">
<div class="row">
<div class="span3">
<?php echo Form::input('name',$o->name,array('label'=>'Name','class'=>'span3')); ?> <?php echo Form::input('name',$o->name,array('label'=>'Name','class'=>'span3')); ?>
</div> </div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="span8">
<?php echo Form::textarea('notes',$o->notes,array('label'=>'Notes','class'=>'span8')); ?> <?php echo Form::textarea('notes',$o->notes,array('label'=>'Notes','class'=>'span8')); ?>
</div> </div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?> <?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div> </div>
</div> <!-- /row --> </fieldset>
<div class="row">
<div id="translate"></div> <div id="translate"></div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -34,5 +27,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</div> </div> <! -- /span -->
</div> <!-- /row -->

View File

@ -1,4 +1,7 @@
<div class="span9"> <fieldset>
<legend><?php echo __(':language description for email template :pid',array(':pid'=>$o->id,':language'=>$o->language->name)); ?></legend>
<div class="row">
<?php echo Form::input('translate[subject]',$o->subject,array( <?php echo Form::input('translate[subject]',$o->subject,array(
'label'=>'Email Subject', 'label'=>'Email Subject',
'placeholder'=>'Email Subject', 'placeholder'=>'Email Subject',
@ -6,7 +9,7 @@
'required', 'required',
'help-block'=>sprintf('This is the subject line on the email. Uses variables: %s',implode(', ',array_values($o->variables('subject')))))); ?> 'help-block'=>sprintf('This is the subject line on the email. Uses variables: %s',implode(', ',array_values($o->variables('subject')))))); ?>
</div> </div>
<div class="span9"> <div class="row">
<?php echo Form::textarea('translate[message_text]',$o->message_text,array( <?php echo Form::textarea('translate[message_text]',$o->message_text,array(
'label'=>'Message Text', 'label'=>'Message Text',
'placeholder'=>'Message Text', 'placeholder'=>'Message Text',
@ -14,7 +17,7 @@
'required', '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')))))); ?> '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')))))); ?>
</div> </div>
<div class="span9"> <div class="row">
<?php echo Form::textarea('translate[message_html]',$o->message_html,array( <?php echo Form::textarea('translate[message_html]',$o->message_html,array(
'label'=>'Message HTML', 'label'=>'Message HTML',
'placeholder'=>'Message HTML', 'placeholder'=>'Message HTML',
@ -23,6 +26,7 @@
'editor'=>'tinymce', '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')))))); ?>' 'help-block'=>sprintf('The message in HTML that is used in the email. Uses variables: %s',implode(', ',array_values($o->variables('message_html')))))); ?>'
</div> </div>
</fieldset>
<?php echo Style::factory()->render_all(); ?> <?php echo Style::factory()->render_all(); ?>
<?php echo Script::factory()->render_all(); ?> <?php echo Script::factory()->render_all(); ?>

View File

@ -1,4 +1,3 @@
<div class="row">
<div class="span11"> <div class="span11">
<table> <table>
@ -6,17 +5,21 @@
<td><strong>To:</strong></td> <td><strong>To:</strong></td>
<td><?php printf('%s (%s)',$elo->account->name(),$elo->display('email')); ?></td> <td><?php printf('%s (%s)',$elo->account->name(),$elo->display('email')); ?></td>
</tr> </tr>
<tr> <tr>
<td><strong>Date:</strong></td> <td><strong>Date:</strong></td>
<td><?php echo $elo->display('date_orig'); ?></td> <td><?php echo $elo->display('date_orig'); ?></td>
</tr> </tr>
<tr> <tr>
<td><strong>Subject:</strong></td> <td><strong>Subject:</strong></td>
<td><?php echo $elo->resolve('subject'); ?></td> <td><?php echo $elo->resolve('subject'); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><hr/></td> <td colspan="2"><hr/></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<table> <table>
@ -29,4 +32,3 @@
</table> </table>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Add Export Data Map</legend> <legend>Add Export Data Map</legend>
@ -9,6 +8,7 @@
<?php echo Form::hidden('export_module_id',$emo->id); ?> <?php echo Form::hidden('export_module_id',$emo->id); ?>
<?php echo Form::hidden('module_id',$module->mid()); ?> <?php echo Form::hidden('module_id',$module->mid()); ?>
</fieldset>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -16,6 +16,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset> </div> <!-- /span -->
</div> <!-- /span10 -->
</div> <!-- /row -->

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span10 offset1">
<fieldset> <fieldset>
<legend>Export Module Update</legend> <legend>Export Module Update</legend>
@ -17,4 +16,3 @@
)); ?> )); ?>
</fieldset> </fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -10,10 +10,6 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Product_Plugin_Host extends Model_Product_Plugin { class Model_Product_Plugin_Host extends Model_Product_Plugin {
// @todo This model doesnt have a database table
public function __construct() {
}
// Our required abstract methods // Our required abstract methods
public function cost($annual=FALSE) { public function cost($annual=FALSE) {
// @todo // @todo
@ -22,8 +18,6 @@ class Model_Product_Plugin_Host extends Model_Product_Plugin {
return $annual ? $x*12 : $x; return $annual ? $x*12 : $x;
} }
public function feature_summary() {}
public function render_edit() {} public function render_edit() {}
// @todo // @todo
@ -31,6 +25,17 @@ class Model_Product_Plugin_Host extends Model_Product_Plugin {
return 'internal'; 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. // @todo This is not used, but should be.
public function order_features() {} public function order_features() {}
} }

View File

@ -19,8 +19,8 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
// Relationships // Relationships
protected $_has_one = array( protected $_has_one = array(
'domain_TLD'=>array('foreign_key'=>'id','far_key'=>'domain_tld_id'), 'host'=>array('model'=>'Host_Server','far_key'=>'host_server_id','foreign_key'=>'id'),
'host_server'=>array('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( protected $_belongs_to = array(
'service'=>array(), 'service'=>array(),
@ -35,40 +35,41 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
), ),
); );
protected $_save_message = TRUE;
// Required abstract functions // Required abstract functions
public function admin_update() {
return '';
}
public function expire() { public function expire() {
return $this->host_expire; return $this->host_expire;
} }
public function name() { 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; return $this->host_username;
} }
public function password_value() { // Local functions
return $this->host_password;
}
/** /**
* This provides us with a manage button to jump to the hosting server * This provides us with a manage button to jump to the hosting server
* to manage the domain. * to manage the domain.
*/ */
public function manage_button($t='') { public function manage_button($t='') {
if (! parent::manage_button($t))
return NULL;
// @todo Convert this to a Static_List display // @todo Convert this to a Static_List display
if ($this->service->queue == 'PROVISION') if ($this->service->queue == 'PROVISION')
return _('To Be Provisioned'); 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) : '';
} }
/** /**

View File

@ -4,11 +4,14 @@
</div> <!-- /page-title --> </div> <!-- /page-title -->
<div id="container"> <div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4"> <div class="pricing-plans plans-4">
<div class="row"> <div class="row">
<?php $c=0; foreach ($o->products() as $po) : ?> <?php $c=0; foreach ($o->products() as $po) : ?>
<?php $go = $po->price_best($o->recur_schedule,TRUE); ?>
<?php $price = (string)Currency::display($po->price($go->id,$o->recur_schedule,'base',TRUE)); ?>
<?php if (is_null($price)) continue; ?>
<?php if (! ($c++%4) AND $c>1) : ?> <?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row --> </div> <!-- /row -->
<hr class="row-divider" /> <hr class="row-divider" />
@ -25,15 +28,14 @@
</div> <!-- /plan-title --> </div> <!-- /plan-title -->
<div class="plan-price"> <div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,4,'price_base',TRUE)); ?> <span class="note">$</span><?php echo substr($price,0,strpos($price,'.')); ?><span class="cents"> .<?php echo substr($price,-2,strpos($price,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get($o->recur_schedule); ?></span>
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(4); ?></span>
</div> <!-- /plan-price --> </div> <!-- /plan-price -->
</div> <!-- /plan-header --> </div> <!-- /plan-header -->
<div class="plan-features"> <div class="plan-features">
<ul> <ul>
<li><span class="note">$</span><strong><?php echo Currency::display($po->price(0,4,'price_setup',TRUE)); ?></strong> setup</li> <li><span class="note">$</span><strong><?php echo Currency::display($po->price($go->id,$o->recur_schedule,'setup',TRUE)); ?></strong> Setup</li>
</ul> </ul>
</div> <!-- /plan-features --> </div> <!-- /plan-features -->
@ -47,6 +49,4 @@
</div> <!-- /row --> </div> <!-- /row -->
</div> <!-- /pricing-plans --> </div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container --> </div> <!-- /container -->

View File

@ -10,6 +10,17 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Task_Invoice_Remindoverdue1 extends Minion_Task { class Task_Invoice_Remindoverdue1 extends Minion_Task {
// @todo This should be moved to somewhere else
private $_css = '
<style type="text/css">
table.box-left { border: 1px solid #AAAACC; margin-right: auto; }
tr.head { font-weight: bold; }
td.head { font-weight: bold; }
td.right { text-align: right; }
tr.odd { background-color: #FCFCFE; }
tr.even { background-color: #F6F6F8; }
</style>';
protected function remind_overdue($notice=1) { protected function remind_overdue($notice=1) {
$action = array(); $action = array();
@ -44,7 +55,7 @@ class Task_Invoice_Remindoverdue1 extends Minion_Task {
'INV_NUM'=>$io->refnum(), 'INV_NUM'=>$io->refnum(),
'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'), 'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'),
'LATE_FEE'=>'5.50', // @todo This should come from a config file. '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(), 'SITE_NAME'=>Company::instance()->name(),
); );

View File

@ -1,7 +1,5 @@
<div class="row"> <div class="row">
<div class="span11">
<div class="span5"> <div class="span5">
<div class="row">
<table> <table>
<tr> <tr>
<td style="vertical-align: top"><?php echo HTML::image('http://www.gth.bgo.co/logo-blue'); ?></td> <td style="vertical-align: top"><?php echo HTML::image('http://www.gth.bgo.co/logo-blue'); ?></td>
@ -15,29 +13,31 @@
</td> </td>
</tr> </tr>
</table> </table>
</div> <!-- /row -->
</div> <!-- /span --> </div> <!-- /span -->
<div class="span5"> <div class="span5">
<div class="row">
<div class="dl-horizontal pull-right"> <div class="dl-horizontal pull-right">
<dt>Tax Invoice</dt> <dt>Tax Invoice</dt>
<dd><?php echo $o->id(); ?></dd> <dd><?php echo $o->id(); ?></dd>
<dt>Issue Date</dt> <dt>Issue Date</dt>
<dd><?php echo $o->display('date_orig'); ?></dd> <dd><?php echo $o->display('date_orig'); ?></dd>
<dt>Due Date</dt> <dt>Due Date</dt>
<dd><?php echo $o->display('due_date'); ?></dd> <dd><?php echo $o->display('due_date'); ?></dd>
<dt>Current Charges</dt> <dt>Current Charges</dt>
<dd><?php echo $o->total_charges(TRUE); ?></dd> <dd><?php echo $o->total_charges(TRUE); ?></dd>
<dt>Payments Received</dt> <dt>Payments Received</dt>
<dd><?php echo $o->payments_total(TRUE); ?></dd> <dd><?php echo $o->payments_total(TRUE); ?></dd>
<dt>Credits Applied</dt> <dt>Credits Applied</dt>
<dd><?php echo $o->total_credits(TRUE); ?></dd> <dd><?php echo $o->total_credits(TRUE); ?></dd>
<dt>Still Due</dt> <dt>Still Due</dt>
<dd><?php echo $o->due(TRUE); ?></dd> <dd><?php echo $o->due(TRUE); ?></dd>
</div> </div>
</div> <!-- /row -->
</div> <!-- /span -->
</div> <!-- /span --> </div> <!-- /span -->
</div> </div>
@ -46,26 +46,22 @@
<h4>Charge Details</h4> <h4>Charge Details</h4>
<?php echo Invoice::instance($o)->render('html','body'); ?> <?php echo Invoice::instance($o)->render('html','body'); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> </div>
<div class="row"> <div class="row">
<div class="span11">
<div class="span5"> <div class="span5">
<div class="row">
<h5>Reminder Details</h5> <h5>Reminder Details</h5>
<div class="dl-horizontal pull-left"> <div class="dl-horizontal pull-left">
<?php foreach ($o->reminders() as $eto) : ?> <?php foreach ($o->reminders() as $eto) : ?>
<dt><?php echo $o->reminders($eto->name,TRUE); ?></dt> <dt><?php echo $o->reminders($eto->name,TRUE); ?></dt>
<dd><?php echo $eto->name(); ?></dd> <dd><?php echo $eto->name(); ?></dd>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</div> <!-- /row -->
</div> <!-- /span --> </div> <!-- /span -->
<div class="span5"> <div class="span5">
<div class="row">
<div class="dl-horizontal pull-right"> <div class="dl-horizontal pull-right">
<!-- Sub Total --> <!-- Sub Total -->
<dt>Sub Total</dt> <dt>Sub Total</dt>
@ -103,10 +99,7 @@
<dt>Account Due:</dt> <dt>Account Due:</dt>
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd> <dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
<!-- END Account Total Due --> <!-- END Account Total Due -->
</div> </div>
</div> <!-- /row -->
</div> <!-- /span -->
</div> <!-- /span --> </div> <!-- /span -->
</div> </div>

@ -1 +1 @@
Subproject commit c13235763045db771ecf2cfeb332cc8f3a314650 Subproject commit 319b4b29db9c1e467b34f75bb03d1d908d17afbc

View File

@ -121,12 +121,9 @@ class Controller_Admin_Payment extends Controller_Payment {
->type('stdin') ->type('stdin')
->data(' ->data('
$(document).ready(function() { $(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({ $("#date_payment_label").datepicker({
autoclose : true, autoclose : true,
endDate : now, endDate : new Date(),
format : "dd-mm-yyyy", format : "dd-mm-yyyy",
todayBtn : true, todayBtn : true,
}).on("hide",function(ev) { }).on("hide",function(ev) {

View File

@ -214,6 +214,22 @@ class Model_Payment extends ORM_OSB {
/** LIST FUNCTIONS **/ /** 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() { public function list_unapplied() {
$pid = array(); $pid = array();
@ -232,32 +248,5 @@ class Model_Payment extends ORM_OSB {
return $this->where('id','IN',$pid)->order_by('account_id')->find_all(); 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 = '<style type="text/css">';
$css .= 'table.box-left { border: 1px solid #AAAACC; margin-right: auto; }';
$css .= 'tr.head { font-weight: bold; }';
$css .= 'td.head { font-weight: bold; }';
$css .= 'td.right { text-align: right; }';
$css .= 'tr.odd { background-color: #FCFCFE; }';
$css .= 'tr.even { background-color: #F6F6F8; }';
$css .= '</style>';
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',
));
}
} }
?> ?>

View File

@ -1,6 +1,4 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Payment Details</legend> <legend>Payment Details</legend>
@ -17,7 +15,7 @@
<?php echo Form::input('notes',$o->notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?> <?php echo Form::input('notes',$o->notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
</fieldset> </fieldset>
<td><div id='items'></div></td> <div class="span8" id="items"</div>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?> <?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Ezypay Payment</legend> <legend>Ezypay Payment</legend>
@ -10,4 +9,3 @@
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?> <?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,5 +1,4 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Bulk Payment Details</legend> <legend>Bulk Payment Details</legend>
</fieldset> </fieldset>
@ -15,4 +14,3 @@
<dd><?php echo $table; ?></dd> <dd><?php echo $table; ?></dd>
</div> <!-- /dl-horizontal --> </div> <!-- /dl-horizontal -->
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -11,6 +11,7 @@
</tr> </tr>
</thead> </thead>
<tbody>
<?php $c=0;foreach ($o->items('ALLOC') as $pio) : ?> <?php $c=0;foreach ($o->items('ALLOC') as $pio) : ?>
<tr> <tr>
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->id()); ?></td> <td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->id()); ?></td>
@ -27,5 +28,5 @@
<td class="text-right" colspan="6">Unapplied</td> <td class="text-right" colspan="6">Unapplied</td>
<td class="text-right"><?php echo Form::input('invoice_item[excess]',$o->balance(TRUE),array('class'=>'span1','nocg'=>TRUE,'disabled'=>'disabled')); ?></td> <td class="text-right"><?php echo Form::input('invoice_item[excess]',$o->balance(TRUE),array('class'=>'span1','nocg'=>TRUE,'disabled'=>'disabled')); ?></td>
</tr> </tr>
</tbody>
</table> </table>

View File

@ -47,7 +47,7 @@ class Controller_Admin_Product extends Controller_Product {
$output = _('Unable to find translate data'); $output = _('Unable to find translate data');
} else { } 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') $output = View::factory('product/category/admin/ajaxtranslate')
->set('o',$pcto); ->set('o',$pcto);
@ -161,24 +161,22 @@ $(document).ready(function() {
Block::factory() Block::factory()
->title(_('Products')) ->title(_('Products'))
->title_icon('icon-th') ->title_icon('icon-th')
->body(Table::display( ->body(Table::factory()
$products, ->data($products)
25, ->page_items(25)
array( ->columns(array(
'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')), 'id'=>'ID',
'title()'=>array('label'=>'Details'), 'title()'=>'Details',
'status'=>array('label'=>'Active'), 'status'=>'Active',
'prod_plugin_file'=>array('label'=>'Plugin Name'), 'prod_plugin_file'=>'Plugin Name',
'prod_plugin_data'=>array('label'=>'Plugin Data'), 'prod_plugin_data'=>'Plugin Data',
'price_type'=>array('label'=>'Price Type'), 'price_type'=>'Price Type',
'taxable'=>array('label'=>'Taxable'), 'taxable'=>'Taxable',
'count_services()'=>array('label'=>'Services'), 'service->list_count()'=>'Services',
'count_invoices()'=>array('label'=>'Invoices'), 'invoice->list_count()'=>'Invoices',
), ))
array( ->prepend(array(
'page'=>TRUE, 'id'=>array('url'=>URL::link('admin','product/edit/')),
'type'=>'select',
'form'=>URL::link('admin','product/view'),
))); )));
} }
@ -191,21 +189,19 @@ $(document).ready(function() {
Block::factory() Block::factory()
->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title())) ->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title()))
->title_icon('icon-th-list') ->title_icon('icon-th-list')
->body(Table::display( ->body(Table::factory()
$po->services()->find_all(), ->data($po->service->where_active()->find_all())
25, ->page_items(25)
array( ->columns(array(
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')), 'id'=>'ID',
'account->accnum()'=>array(), 'account->accnum()'=>'Acc Num',
'account->name()'=>array('label'=>'Account'), 'account->name()'=>'Account',
'name()'=>array('label'=>'Details'), 'name()'=>'Details',
'status'=>array('label'=>'Active'), 'status'=>'Active',
'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'), 'price(TRUE,TRUE)'=>'Price',
), ))
array( ->prepend(array(
'page'=>TRUE, 'id'=>array('url'=>URL::link('user','service/view/')),
'type'=>'select',
'form'=>URL::link('user','service/view'),
))); )));
} }
} }

View File

@ -48,12 +48,11 @@ class Model_Product extends ORM_OSB {
protected $_save_message = TRUE; protected $_save_message = TRUE;
/** // Our database index for pricing values
* Which categories is this product available in private $_price_options = array(
*/ 'base'=>'price_base',
public function categories() { 'setup'=>'price_setup',
return $this->avail_category; );
}
public function cost($annual=FALSE) { public function cost($annual=FALSE) {
return $this->plugin() ? $this->plugin()->cost($annual) : 0; 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 * This will render the product feature summary information
*/ */
public function feature_summary() { 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 (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) { public function save(Validation $validation=NULL) {
parent::save($validation); parent::save($validation);
@ -135,13 +182,6 @@ class Model_Product extends ORM_OSB {
return $this; 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() { public function supplier() {
return $this->plugin() ? $this->plugin()->supplier() : 'other'; 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'; 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;
}
} }
?> ?>

View File

@ -46,7 +46,7 @@ class Model_Product_Category extends ORM_OSB {
$result = array(); $result = array();
foreach (ORM::factory('Product')->where_active()->find_all() as $po) 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); array_push($result,$po);
return $result; return $result;

View File

@ -14,8 +14,8 @@ class Model_Product_Category_Translate extends ORM_OSB {
protected $_created_column = FALSE; protected $_created_column = FALSE;
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
protected $_belongs_to = array( protected $_has_one = array(
'product_category'=>array(), 'language'=>array('foreign_key'=>'id'),
); );
protected $_save_message = TRUE; protected $_save_message = TRUE;

View File

@ -18,12 +18,6 @@ abstract class Model_Product_Plugin extends ORM_OSB {
*/ */
abstract public function cost($annual=FALSE); 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 * 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))); 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 * Form info for admins to update with plugin data
*/ */
abstract public function render_edit(); 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(); abstract public function supplier();
} }

View File

@ -17,6 +17,10 @@ class Model_Product_Translate extends ORM_OSB {
'product'=>array(), 'product'=>array(),
); );
protected $_has_one = array(
'language'=>array('foreign_key'=>'id'),
);
protected $_save_message = TRUE; protected $_save_message = TRUE;
} }
?> ?>

View File

@ -1,4 +1,7 @@
<div class="span6"> <fieldset>
<legend><?php echo __(':language description for product :pid',array(':pid'=>$o->id,':language'=>$o->language->name)); ?></legend>
<div class="row">
<?php echo Form::input('translate[name]',$o->name,array( <?php echo Form::input('translate[name]',$o->name,array(
'label'=>'Category Title', 'label'=>'Category Title',
'placeholder'=>'Descriptive Title', 'placeholder'=>'Descriptive Title',
@ -6,7 +9,7 @@
'required', 'required',
'help-block'=>'The title is shown when uses search products by category')); ?> 'help-block'=>'The title is shown when uses search products by category')); ?>
</div> </div>
<div class="span9"> <div class="row">
<?php echo Form::textarea('translate[description_short]',$o->description_short,array( <?php echo Form::textarea('translate[description_short]',$o->description_short,array(
'label'=>'Short Product Description', 'label'=>'Short Product Description',
'placeholder'=>'Short Description', 'placeholder'=>'Short Description',
@ -14,7 +17,7 @@
'required', 'required',
'help-block'=>'Complete description of this category')); ?> 'help-block'=>'Complete description of this category')); ?>
</div> </div>
<div class="span9"> <div class="row">
<?php echo Form::textarea('translate[description_full]',$o->description_full,array( <?php echo Form::textarea('translate[description_full]',$o->description_full,array(
'label'=>'Full Product Description', 'label'=>'Full Product Description',
'placeholder'=>'Full Description', 'placeholder'=>'Full Description',
@ -23,6 +26,7 @@
'editor'=>'wysihtml5', 'editor'=>'wysihtml5',
'help-block'=>'Complete description of this category')); ?> 'help-block'=>'Complete description of this category')); ?>
</div> </div>
</fieldset>
<?php echo Style::factory()->render_all(); ?> <?php echo Style::factory()->render_all(); ?>
<?php echo Script::factory()->render_all(); ?> <?php echo Script::factory()->render_all(); ?>

View File

@ -1,10 +1,10 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Update Product</legend> <legend>Update Product</legend>
<div class="row"> <div class="row">
<div class="tabbable span9"> <div class="tabbable span9">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?> <?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $k; ?>" data-toggle="tab"><?php echo $v; ?></a></li> <li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $k; ?>" data-toggle="tab"><?php echo $v; ?></a></li>
@ -13,54 +13,51 @@
<div class="tab-content"> <div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?> <?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $k; ?>"> <div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $k; ?>">
<?php echo Form::checkbox("price_group[$k][show]",1,$o->is_price_shown($k),array('label'=>'Price Active','class'=>'span2')); ?> <?php echo Form::checkbox("price_group[$k][show]",1,$o->is_price_shown($k),array('label'=>'Price Active','class'=>'span2')); ?>
<?php foreach ($o->availPriceGroups() as $g) : ?> <?php foreach (ORM::factory('Group')->list_pricegroups() as $go) : ?>
<div class="row"> <div class="row">
<div class="span2"><?php echo ORM::factory('Group',$g)->name; ?></div> <div class="span2"><?php echo $go->name; ?></div>
<?php foreach ($o->availPriceOptions() as $po) : ?>
<?php foreach (array_keys($o->price_options()) as $po) : ?>
<div class="span2"> <div class="span2">
<?php echo Form::input("price_group[$k][$g][$po]",$o->price($g,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?> <?php echo Form::input("price_group[$k][{$go->id}][{$o->price_option($po)}]",$o->price($go->id,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?>
</div> </div>
<?php endforeach ?> <!-- /availPriceOptions() --> <?php endforeach ?> <!-- /price_options() -->
</div> </div>
<?php endforeach ?> <!-- /availPriceGroups() -->
<?php endforeach ?> <!-- /list_pricegroups() -->
</div> <!-- /tab-pane --> </div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule --> <?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content --> </div> <!-- /tab-content -->
</div> <!-- /tabbable --> </div> <!-- /tabbable -->
</div> <!-- /row --> </div> <!-- /row -->
<br> <br>
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?></td> <?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?></td>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span3">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?> <?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?> <?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
</fieldset>
<div class="row">
<div id="translate"></div> <div id="translate"></div>
</div> <!-- /row -->
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?> <?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
@ -70,7 +67,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,4 +1,7 @@
<div class="span6"> <fieldset>
<legend><?php echo __(':language description for product category :pid',array(':pid'=>$o->id,':language'=>$o->language->name)); ?></legend>
<div class="row">
<?php echo Form::input('translate[name]',$o->name,array( <?php echo Form::input('translate[name]',$o->name,array(
'label'=>'Category Title', 'label'=>'Category Title',
'placeholder'=>'Descriptive Title', 'placeholder'=>'Descriptive Title',
@ -6,7 +9,7 @@
'required', 'required',
'help-block'=>'The title is shown when uses search products by category')); ?> 'help-block'=>'The title is shown when uses search products by category')); ?>
</div> </div>
<div class="span9"> <div class="row">
<?php echo Form::textarea('translate[description]',$o->description,array( <?php echo Form::textarea('translate[description]',$o->description,array(
'label'=>'Category Description', 'label'=>'Category Description',
'placeholder'=>'Description', 'placeholder'=>'Description',
@ -15,6 +18,7 @@
'editor'=>'wysihtml5', 'editor'=>'wysihtml5',
'help-block'=>'Complete description of this category')); ?> 'help-block'=>'Complete description of this category')); ?>
</div> </div>
</fieldset>
<?php echo Style::factory()->render_all(); ?> <?php echo Style::factory()->render_all(); ?>
<?php echo Script::factory()->render_all(); ?> <?php echo Script::factory()->render_all(); ?>

View File

@ -1,29 +1,26 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Update Category</legend> <legend>Update Category</legend>
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5">
<?php echo Form::select('template',$o->templates(),$o->template,array('label'=>'List Template')); ?> <?php echo Form::select('template',$o->templates(),$o->template,array('label'=>'List Template')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5"> <?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Show Pricing Schedule','required'));?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?> <?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> </fieldset>
<div id="translate"></div> <div id="translate"></div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -31,6 +28,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -9,19 +9,17 @@
</div> <!-- /row --> </div> <!-- /row -->
<hr class="row-divider" /> <hr class="row-divider" />
<div class="row divider service-container"> <div class="row divider service-container">
<div class="grid-3"> <div class="grid-3">&nbsp;</div>
&nbsp;
</div>
<?php endif ?> <?php endif ?>
<div class="grid-3"> <div class="grid-3">
<div class="service-item"> <div class="service-item">
<h3><i class="icon-tint"></i><?php echo $pco->title(); ?></h3> <h3><i class="icon-tint"></i><?php echo $pco->title(); ?></h3>
<?php $x=350;echo strlen($pco->description())<$x ? $pco->description() : substr($pco->description(),0,$x).'...'; ?> <?php $x=350;echo strlen($pco->description())<$x ? $pco->description() : substr($pco->description(),0,$x).'...'; ?>
<p><a href="<?php echo URL::site('product/category/'.$pco->id); ?>" class="">More Details »</a></p> <p><a href="<?php echo URL::site('product/category/'.$pco->id); ?>" class="">More Details »</a></p>
</div> <!-- /service --> </div> <!-- /service -->
</div> </div>
<?php endforeach ?> <?php endforeach ?>
</div> <!-- /row --> </div> <!-- /row -->
</div> <!-- /container --> </div> <!-- /container -->

View File

@ -1,15 +1,11 @@
<div id="page-title"> <div id="page-title">
<h1><?php echo $o->title(); ?></h1> <h1><?php echo $o->title(); ?></h1>
<?php echo $o->description(); ?> <?php echo $o->description(); ?>
</div> <!-- /page-title --> </div> <!-- /page-title -->
<div id="container"> <div id="container">
<div class="row">
<div class="span9"> <div class="span9">
<?php echo $o->description(TRUE); ?> <?php echo $o->description(TRUE); ?>
</div> <!-- /row --> </div> <!-- /row -->
</div> <!-- /row -->
<!-- <div class="row-divider"></div> -->
</div> <!-- /container --> </div> <!-- /container -->

View File

@ -28,9 +28,6 @@ class Controller_Admin_Service extends Controller_Service {
Script::factory() Script::factory()
->type('stdin') ->type('stdin')
->data(' ->data('
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$(document).ready(function() { $(document).ready(function() {
$("select[name=product_id]").change(function() { $("select[name=product_id]").change(function() {
// If we select a blank, then dont continue // If we select a blank, then dont continue
@ -56,11 +53,10 @@ $(document).ready(function() {
$("#date_next_invoice_label").datepicker({ $("#date_next_invoice_label").datepicker({
autoclose : true, autoclose : true,
startDate : now,
format : "dd-M-yyyy", format : "dd-M-yyyy",
todayBtn : true, todayBtn : true,
}).on("hide",function(ev) { }).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({ $("input[name=account_id_label]").typeahead({
@ -127,17 +123,29 @@ $(document).ready(function() {
Script::factory() Script::factory()
->type('stdin') ->type('stdin')
->data(' ->data('
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$(document).ready(function() { $(document).ready(function() {
$("#date_next_invoice_label").datepicker({ $("#date_next_invoice_label").datepicker({
autoclose : true, autoclose : true,
startDate : now,
format : "dd-M-yyyy", format : "dd-M-yyyy",
todayBtn : true, todayBtn : true,
}).on("hide",function(ev) { }).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() { public function action_listdomainservicesbydnshost() {
$svs = ORM::factory('Service')->list_bylistgroup('DOMAIN'); $svs = ORM::factory('Service')->list_bylistgroup('DOMAIN');
Sort::MAsort($svs,'plugin()->service_plugin_host,name()'); Sort::MAsort($svs,'plugin()->host,name()');
$list = array(); $list = array();
foreach ($svs as $so) 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) foreach (array_keys($list) as $sid)
Block::add(array( Block::add(array(
@ -204,8 +212,8 @@ $(document).ready(function() {
array( array(
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')), 'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'service_name()'=>array('label'=>'Details'), 'service_name()'=>array('label'=>'Details'),
'plugin()->domain_registrar->id'=>array('label'=>'SID'), 'plugin()->registrar->id'=>array('label'=>'SID'),
'plugin()->domain_registrar->name'=>array('label'=>'Supplier'), 'plugin()->registrar->name'=>array('label'=>'Supplier'),
'display("date_next_invoice")'=>array('label'=>'Next Invoice'), 'display("date_next_invoice")'=>array('label'=>'Next Invoice'),
), ),
array( array(
@ -218,7 +226,7 @@ $(document).ready(function() {
public function action_listhostservicesbysupplier() { public function action_listhostservicesbysupplier() {
$svs = ORM::factory('Service')->list_bylistgroup('HOST'); $svs = ORM::factory('Service')->list_bylistgroup('HOST');
Sort::MAsort($svs,'plugin()->host_server,name()'); Sort::MAsort($svs,'plugin()->host,name()');
$list = array(); $list = array();
@ -264,26 +272,28 @@ $(document).ready(function() {
// Validate the transactions // Validate the transactions
$bt = NULL; $bt = NULL;
$save = (isset($_REQUEST['go']) && $_REQUEST['go']=1) ? 1 : 0; $pr = TRUE; // Next entry is a pro-rata
$xsid=197;
foreach ($so->transactions()->where('item_type','=',0)->find_all() as $iio) { 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. // @todo This hard coding of 3070 should be removed.
if ($iio->service_id == $xsid AND $iio->invoice_id < 3070) continue; // $xsid=197;
if ($iio->quantity < 0 OR $iio->price_base < 0) // if (($iio->service_id == $xsid AND $iio->invoice_id < 3070) OR in_array($iio->id,array(960))) continue;
continue;
if (in_array($iio->id,array(960))) if (! $iio->invoice->status OR $iio->void)
continue; continue;
if ($iio->invoice_id > 4000 OR $iio->product->prod_plugin_file=="ADSL") if ($iio->quantity < 0 OR $iio->price_base < 0) {
$a = FALSE; $bt = $iio->date_start;
else $pr = TRUE;
$a = TRUE;
continue;
}
if (is_null($bt)) if (is_null($bt))
$bt = $iio->date_start; $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) { switch ($iio->recurring_schedule) {
case 1: case 1:
@ -295,11 +305,12 @@ $(document).ready(function() {
$iio->date_start=$pdata['start_time']; $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] <br/>',$iio->id,Config::date($pdata['end_time']),$pdata['end_time']); $doutput .= sprintf('%s: Set end_time: %s [%s] <br/>',$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;
$bt = ($pr ? $iio->date_stop : $pdata['end_time'])+86400;
// $doutput .= sprintf('%s: BT now: %s (%s) [%s]<br/>',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt); // $doutput .= sprintf('%s: BT now: %s (%s) [%s]<br/>',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt);
break; break;
@ -307,11 +318,13 @@ $(document).ready(function() {
default: default:
$doutput .= sprintf('%s: %s Not handled',$iio->id,$iio->recurring_schedule); $doutput .= sprintf('%s: %s Not handled',$iio->id,$iio->recurring_schedule);
} }
$pr = FALSE;
//$doutput .= '<br/>'; //$doutput .= '<br/>';
if ($save) { if (($x=$this->request->query('go')) AND $x==1)
$iio->save(); $iio->save();
} }
}
if (isset($_REQUEST['go'])) if (isset($_REQUEST['go']))
HTTP::redirect(URL::link('admin','service/view/'.$so->id)); HTTP::redirect(URL::link('admin','service/view/'.$so->id));

View File

@ -25,8 +25,8 @@ class Controller_User_Service extends Controller_Service {
$amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : ''); $amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : '');
$o = array( $o = array(
'u'=>$amo->username_value() ? $amo->username_value() : strtolower($amo->name()), '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_value(), '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'); $this->response->headers('Content-Type','application/json');

View File

@ -29,6 +29,8 @@ class Model_Service extends ORM_OSB {
'account'=>array(), 'account'=>array(),
); );
protected $_save_message = TRUE;
// Validation rules // Validation rules
public function rules() { public function rules() {
$x = Arr::merge(parent::rules(), array( $x = Arr::merge(parent::rules(), array(
@ -167,7 +169,7 @@ class Model_Service extends ORM_OSB {
$iio->find(); $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; return $format ? Config::date($x) : $x;
} }
@ -255,7 +257,7 @@ class Model_Service extends ORM_OSB {
* Return a descriptive name for this service * Return a descriptive name for this service
*/ */
public function service_name() { 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': case 'invoice_detail_items':
return is_null($plugin) ? array() : $plugin->_details($type); return is_null($plugin) ? array() : $plugin->_details($type);
case 'service_view':
return is_null($plugin) ? HTML::nbsp('') : $plugin->render_view();
default: default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type)); 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() { 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 **/ /** LIST FUNCTIONS **/

View File

@ -13,6 +13,10 @@ abstract class Model_Service_Plugin extends ORM_OSB {
// Reset any sorting that may be defined in our parent // Reset any sorting that may be defined in our parent
protected $_sorting = array(); protected $_sorting = array();
protected $_belongs_to = array(
'service'=>array(),
);
/** /**
* When does our service expire * 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 * The table attributes that provide username/password values
*/ */
abstract public function password_value(); abstract public function password();
abstract public function username_value(); abstract public function username();
/**
* 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));
}
}
/** /**
* Provide the button that launches the management of this service, generally from a 3rd party * 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()) if (! $this->service->status OR $this->service->expiring())
return FALSE; return FALSE;
static $k = ''; static $x = '';
// If $k is already set, we've rendered this JS // If $x is already set, we've rendered this JS
if ($k) if (! $x) {
return TRUE; $x = Random::char();
$k = Random::char(); Session::instance()->set('manage_button',$x);
Session::instance()->set('manage_button',$k);
Script::add(array('type'=>'stdin','data'=>' Script::factory()
->type('stdin')
->data('
$(document).ready(function() { $(document).ready(function() {
var x=0; var x=0;
$("button[name=submit]").click(function() { $("button[name=submit]").click(function() {
var t=$(this).val().split(":"); var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; } 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); }); $.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$x.'",t: t[1] },
}).error(function() { alert("There was a problem with the request"); return false; }).success( function(data) {$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); })
function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); }); .error(function() { alert("There was a problem with the request"); return false; })
.success(function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
}); });
});' });'
)); );
}
return TRUE; return TRUE;
} }
@ -109,5 +100,23 @@ function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
public function service_name() { public function service_name() {
return sprintf('%s - %s',$this->service->product->title(),$this->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));
}
}
} }
?> ?>

View File

@ -40,7 +40,7 @@
</div> <!-- /row --> </div> <!-- /row -->
</fieldset> </fieldset>
<div id="plugin"></div> <!-- /row --> <div id="plugin"></div>
<div class="row"> <div class="row">
<div class="offset2"> <div class="offset2">
@ -48,4 +48,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</div> </div> <!-- /span -->

View File

@ -1,22 +1,17 @@
<div class="row"> <div class="span11">
<div class="span9 offset1">
<fieldset> <fieldset>
<legend>Update Service</legend> <legend>Update Service</legend>
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5">
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?> <?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span5 input-append date" id="date_next_invoice_label"> <div class="input-append date" id="date_next_invoice_label">
<?php echo Form::input('date_next_invoice_label',$o->display('date_next_invoice'),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?> <?php echo Form::input('date_next_invoice_label',$o->display('date_next_invoice'),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div> </div>
@ -24,22 +19,17 @@
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?> <?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span3">
<?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price','class'=>'span1')); ?> <?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price','class'=>'span1')); ?>
</div>
</div> <!-- /row --> </div> <!-- /row -->
</fieldset>
<?php if ($plugin_form) { echo $plugin_form; } ?> <?php if ($plugin_form) { echo $plugin_form; } ?>
@ -49,6 +39,4 @@
<button type="button" class="btn">Cancel</button> <button type="button" class="btn">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -1,40 +1,50 @@
<?php if ($so->pending_change()) {?> <?php if ($o->pending_change()) : ?>
Pending change to: <?php echo $so->service_change->list_details(); ?> <div class="span5">
<?php } ?> Pending change to: <?php echo $o->service_change->list_details(); ?>
<br/> </div> <!-- /span -->
<!-- @todo NEEDS TO BE TRANSLATED --> <?php endif ?>
<table class="list-box-left">
<tr class="list-head"> <div class="span6">
<fieldset>
<legend>Service Transaction Details</legend>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead>
<tr>
<th>ID</th> <th>ID</th>
<th>Invoice</th> <th>Invoice</th>
<th>Product</th>
<th>IT</th> <th>IT</th>
<th>RS</th> <th>RS</th>
<th>Start</th> <th class="text-right">Start</th>
<th>Stop</th> <th class="text-right">Stop</th>
<th class="text-right">Quantity</th>
<th class="text-right">Charge</th>
<th>Desc</th> <th>Desc</th>
<th>Quantity</th>
<th>Charge</th>
</tr> </tr>
<?php $lp=NULL; foreach ($so->transactions()->find_all() as $iio) { ?> </thead>
<?php if (! is_null($iio->product_id) AND $lp != $iio->product_id) {
$lp = $iio->product_id; ?> <tbody>
<tr class="list-sub-head"> <?php $lp=NULL; foreach ($o->transactions()->find_all() as $iio) : ?>
<th class="id"><?php echo $iio->product_id; ?></th> <?php if (! is_null($iio->product_id) AND $lp != $iio->product_id) : $lp = $iio->product_id; ?>
<tr>
<th><?php echo $iio->product_id; ?></th>
<th colspan="9"><?php echo $iio->product->title(); ?></th> <th colspan="9"><?php echo $iio->product->title(); ?></th>
</tr> </tr>
<?php } ?> <?php endif ?>
<tr class="list-data">
<td class="id"><?php echo $iio->id; ?></td> <tr>
<td><?php echo $iio->id; ?></td>
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$iio->invoice_id),$iio->invoice_id); ?></td> <td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$iio->invoice_id),$iio->invoice_id); ?></td>
<td><?php echo $iio->display('product_id'); ?></td>
<td><?php echo $iio->display('item_type'); ?></td> <td><?php echo $iio->display('item_type'); ?></td>
<td><?php echo $iio->display('recurring_schedule'); ?></td> <td><?php echo $iio->display('recurring_schedule'); ?></td>
<td><?php echo $iio->display('date_start'); ?></td> <td class="text-right"><?php echo $iio->display('date_start'); ?></td>
<td><?php echo $iio->display('date_stop'); ?></td> <td class="text-right"><?php echo $iio->display('date_stop'); ?></td>
<td class="text-right"><?php echo $iio->display('quantity'); ?></td>
<td class="text-right"><?php echo $iio->display('price_base'); ?></td>
<td><?php echo $iio->display('product_name'); ?></td> <td><?php echo $iio->display('product_name'); ?></td>
<td><?php echo $iio->display('quantity'); ?></td>
<td class="right"><?php echo $iio->display('price_base'); ?></td>
</tr> </tr>
<?php } ?> <?php endforeach ?>
</tbody>
</table> </table>
</fieldset>
</div> <!-- /span -->

View File

@ -1,9 +1,8 @@
<div class="row"> <div class="span5">
<fieldset class="span5"> <fieldset>
<legend>Service Information</legend> <legend>Service Information</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Account</dt> <dt>Account</dt>
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd> <dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd>
@ -16,7 +15,8 @@
<dt>Cost</dt> <dt>Cost</dt>
<dd><?php echo (! is_null($o->price_override) ? sprintf('<strike>%s</strike> ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd> <dd><?php echo (! is_null($o->price_override) ? sprintf('<strike>%s</strike> ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd>
<?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'price_base'))) : ?> <!-- @todo -->
<?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'base'))) : ?>
<dt>Service</dt> <dt>Service</dt>
<dd><?php echo HTML::anchor('product/view/'.$o->product_id,$o->product->title()); ?></dd> <dd><?php echo HTML::anchor('product/view/'.$o->product_id,$o->product->title()); ?></dd>
<?php endif ?> <?php endif ?>
@ -32,33 +32,32 @@
<dt>Current Invoices Due</dt> <dt>Current Invoices Due</dt>
<dd><?php echo $o->due(TRUE); ?></dd> <dd><?php echo $o->due(TRUE); ?></dd>
</div> <!-- /dl-horizontal --> </div> <!-- /dl-horizontal -->
</fieldset> </fieldset>
<?php if ($o->product->feature_summary()) : <?php echo $o->product->feature_summary(); ?>
echo $o->product->feature_summary(); </div> <!-- /span -->
endif ?>
</div> <!-- /row --> <div class="span5">
<?php echo $o->service_view(); ?>
</div> <!-- /span -->
<div class="row">
<?php echo $o->details('service_view'); ?>
</div> <!-- /row -->
<div class="row">
<?php if ($o->service_billing->loaded()) : ?> <?php if ($o->service_billing->loaded()) : ?>
<fieldset class="span5"> <div class="span5">
<fieldset>
<legend>Automatic Payment Details</legend> <legend>Automatic Payment Details</legend>
<dt><?php echo $o->service_billing->checkout->display('name'); ?></dt> <div class="dl-horizontal">
<dd>&nbsp;</dd> <dt>Direct Payment</dt>
<dd><?php echo $o->service_billing->checkout->display('name'); ?></dd>
</div> <!-- /dl-horizontal -->
</fieldset> </fieldset>
</div> <!-- /span -->
<?php endif ?> <?php endif ?>
<?php if ($o->charges()) : ?> <?php if ($o->charges()) : ?>
<fieldset class="span5"> <div class="span5">
<fieldset>
<legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend> <legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend>
<?php echo Table::factory() <?php echo Table::factory()
@ -68,12 +67,24 @@
'description'=>'Description', 'description'=>'Description',
'total(TRUE)'=>'Amount', 'total(TRUE)'=>'Amount',
)); ?> )); ?>
</fieldset> </fieldset>
</div> <!-- /span -->
<?php endif ?> <?php endif ?>
<fieldset class="span5"> <?php if ($o->status) : ?>
<div class="span5">
<fieldset>
<legend>Next Invoice Charges</legend>
<?php echo Invoice::instance()->add_service($o)->render('html','body',array('noid'=>TRUE)); ?>
</fieldset>
</div> <!-- /span -->
<?php endif ?>
<div class="span5">
<fieldset>
<legend>Invoices for this Service</legend> <legend>Invoices for this Service</legend>
<?php echo Table::factory() <?php echo Table::factory()
->data($o->invoice_list()) ->data($o->invoice_list())
->columns(array( ->columns(array(
@ -87,19 +98,13 @@
'id'=>array('url'=>URL::link('user','invoice/view/')), 'id'=>array('url'=>URL::link('user','invoice/view/')),
)); ?> )); ?>
</fieldset> </fieldset>
</div> <!-- /span -->
<?php if ($o->status) : ?>
<fieldset class="span5">
<legend>Next Invoice Charges</legend>
<?php echo Invoice::instance()->add_service($o)->render('html','body',array('noid'=>TRUE)); ?>
</fieldset>
<?php endif ?>
</div> <!-- /row -->
<?php $x=$o->service_memo->find_all(); if ($x->count()) : ?> <?php $x=$o->service_memo->find_all(); if ($x->count()) : ?>
<div class="row"> <div class="span5">
<fieldset class="span5"> <fieldset>
<legend>Service Memos</legend> <legend>Service Memos</legend>
<?php echo Table::factory() <?php echo Table::factory()
->data($x) ->data($x)
->columns(array( ->columns(array(
@ -109,13 +114,14 @@
'memo'=>'Memo', 'memo'=>'Memo',
)); ?> )); ?>
</fieldset> </fieldset>
</div> <!-- /row --> </div> <!-- /span -->
<?php endif ?> <?php endif ?>
<?php $x=$o->email()->find_all(); if ($x->count()) : ?> <?php $x=$o->email()->find_all(); if ($x->count()) : ?>
<div class="row"> <div class="span5">
<fieldset class="span5"> <fieldset>
<legend>Emails about this service</legend> <legend>Emails about this service</legend>
<?php echo Table::factory() <?php echo Table::factory()
->data($x) ->data($x)
->columns(array( ->columns(array(
@ -130,5 +136,5 @@
'resolve("subject")'=>array('trim'=>45), 'resolve("subject")'=>array('trim'=>45),
)); ?> )); ?>
</fieldset> </fieldset>
</div> <!-- /row --> </div> <!-- /span -->
<?php endif ?> <?php endif ?>

View File

@ -13,20 +13,16 @@ class Model_Product_Plugin_Ssl extends Model_Product_Plugin {
protected $_table_name = 'ssl'; protected $_table_name = 'ssl';
// Our required abstract methods // Our required abstract methods
public function render_edit() {}
public function cost($annual=FALSE) { public function cost($annual=FALSE) {
// @todo
$x = 0; $x = 0;
return $annual ? $x*12 : $x; return $annual ? $x*12 : $x;
} }
public function feature_summary() { public function render_edit() {}
// @todo This view should render based on the the results of this::allowance();
return View::factory('product/plugin/ssl/feature_summary')
->set('po',$this);
}
// @todo
public function supplier() { public function supplier() {
return 'internal'; return 'internal';
} }

View File

@ -30,7 +30,10 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
), ),
); );
protected $_save_message = TRUE;
// Required abstract functions // Required abstract functions
public function expire($format=FALSE) { public function expire($format=FALSE) {
return $this->_so->get_valid_to($format); 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'); 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 password() {} // Not used
public function username_value() {} // Not used
public function username() {} // Not used
// Local functions
private $_so = NULL; private $_so = NULL;

View File

@ -1,10 +1,8 @@
<fieldset class="span6"> <fieldset>
<legend>SSL Features</legend> <legend>SSL Features</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Type</dt> <dt>Type</dt>
<dd><?php echo $po->display('extensions'); ?></dd> <dd><?php echo $o->display('extensions'); ?></dd>
</div> <!-- /dl-horizontal --> </div> <!-- /dl-horizontal -->
</fieldset> </fieldset>

View File

@ -1,17 +1,15 @@
<fieldset>
<legend>SSL Certificate Service Details</legend>
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::textarea('plugin[csr]',$o->service->plugin()->csr,array('class'=>'span6','label'=>'CSR','placeholder'=>'CSR','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->csr))); ?> <?php echo Form::textarea('plugin[csr]',$o->service->plugin()->csr,array('class'=>'span6','label'=>'CSR','placeholder'=>'CSR','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->csr))); ?>
</div> </div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::textarea('plugin[pk]',$o->service->plugin()->pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->pk))); ?> <?php echo Form::textarea('plugin[pk]',$o->service->plugin()->pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->pk))); ?>
</div> </div>
</div> <!-- /row -->
<div class="row"> <div class="row">
<div class="span6">
<?php echo Form::textarea('plugin[cert]',$o->service->plugin()->cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->cert))); ?> <?php echo Form::textarea('plugin[cert]',$o->service->plugin()->cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->service->plugin()->cert))); ?>
</div> </div>
</div> <!-- /row --> </fieldset>

View File

@ -1,8 +1,8 @@
<fieldset class="span5"> <div class="span5">
<fieldset>
<legend>Service Details</legend> <legend>Service Details</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>DN</dt> <dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd> <dd><?php echo $o->dn(); ?></dd>
@ -41,8 +41,10 @@
</div> <!-- dl-horizontal --> </div> <!-- dl-horizontal -->
</fieldset> </fieldset>
</div> <!-- /span -->
<fieldset class="span6"> <div class="span6">
<fieldset>
<legend>Certificate</legend> <legend>Certificate</legend>
<pre><?php echo $o->cert; ?></pre> <pre><?php echo $o->cert; ?></pre>
@ -55,3 +57,4 @@
?> ?>
</fieldset> </fieldset>
</div> <!-- /span -->

View File

@ -1,8 +1,8 @@
<div class="row"> <div class="span11">
<div class="span9"> <fieldset>
<legend>SSL CA Certificate Edit/Update</legend>
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Subject</dt> <dt>Subject</dt>
<dd><?php echo $o->subject(); ?></dd> <dd><?php echo $o->subject(); ?></dd>
@ -46,13 +46,11 @@
<dt>Key Algorithm<dt> <dt>Key Algorithm<dt>
<dd><?php echo $o->algorithm(); ?></dd> <dd><?php echo $o->algorithm(); ?></dd>
</div> <!-- /dl-horizontal --> </div> <!-- /dl-horizontal -->
<br/> </fieldset>
<?php echo Form::textarea('sign_pk',$o->sign_pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_pk))); ?> <?php echo Form::textarea('sign_pk',$o->sign_pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_pk))); ?>
<?php echo Form::textarea('sign_cert',$o->sign_cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_cert))); ?> <?php echo Form::textarea('sign_cert',$o->sign_cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_cert))); ?>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?> <?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span --> </div> <!-- /span -->
</div> <!-- /row -->

View File

@ -32,8 +32,7 @@ class Controller_Admin_Task extends Controller_Task {
'task->display("name")'=>'Task', 'task->display("name")'=>'Task',
'result'=>'Result', 'result'=>'Result',
'message'=>'Message', 'message'=>'Message',
)) )));
);
} }
} }
?> ?>

View File

@ -17,41 +17,47 @@ class Task_Task_Clean extends Minion_Task {
foreach ($tl->find_all() as $to) { foreach ($tl->find_all() as $to) {
// Delete Task already running messages. // 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(); $to->delete();
continue; continue;
} }
// Delete Empty Invoices Sent // 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(); $to->delete();
continue; continue;
} }
// Delete Overdue Notes Sent // 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(); $to->delete();
continue; continue;
} }
// Over Notes Sent // 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(); $to->delete();
continue; continue;
} }
// Services Invoiced // 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(); $to->delete();
continue; 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(); $to->delete();
continue; 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(); $to->delete();
continue; continue;
} }
@ -63,7 +69,7 @@ class Task_Task_Clean extends Minion_Task {
OR preg_match('/View_Exception\s+/',$to->message) OR preg_match('/View_Exception\s+/',$to->message)
OR preg_match('/Kohana_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(); $to->delete();
continue; continue;