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;
}
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.
*

View File

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

View File

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

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) : ''));
}
/**
* 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
*/

View File

@ -67,5 +67,12 @@ class Model_Group extends Model_Auth_Role {
return $result;
}
/**
* Get a list of groups that have their own pricing
*/
public function list_pricegroups() {
return $this->where_active()->where('pricing','=',TRUE)->find_all();
}
}
?>

View File

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

View File

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

View File

@ -1,5 +1,4 @@
<div class="row">
<div class="span10 offset1">
<div class="span11">
<fieldset>
<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::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'input-small','label'=>'Title','required')); ?>
<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">
<?php echo Form::input('first_name',$o->display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?>
</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('currency_id',ORM::factory('Currency')->list_select(),$o->currency_id,array('label'=>'Currency','required')); ?>
</fieldset>
<div class="row">
<div class="offset2">
@ -53,6 +55,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,16 +1,14 @@
<div class="row">
<div class="span8 offset1">
<div class="span11">
<fieldset>
<legend>Reset Password</legend>
<?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)); ?>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,11 +1,11 @@
<div class="row">
<div class="span10 offset1">
<div class="span11">
<fieldset>
<legend>Add Method</legend>
<?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('menu_display','',array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?>
</fieldset>
<div class="row">
<div class="offset2">
@ -13,6 +13,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,19 +1,16 @@
<div class="row">
<div class="span10 offset1">
<div class="span5">
<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')); ?>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
</div> <!-- /span -->
<div class="row">
<div class="span10 offset1">
<div class="span6">
<fieldset>
<legend>Configure Method Security</legend>
<legend>Method Security</legend>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
@ -34,6 +31,7 @@
<?php endforeach ?>
</tbody>
</table>
</fieldset>
<div class="row">
<div class="offset2">
@ -41,7 +39,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,5 +1,4 @@
<div class="row">
<div class="span10 offset1">
<div class="span11">
<fieldset>
<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[faqurl]',$o->site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?>
</fieldset>
<div class="row">
<div class="offset2">
@ -39,6 +39,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,7 +1,9 @@
<div class="row">
<div class="span10 offset1">
<div class="row">
<div class="span11">
<fieldset>
<legend>Application Setup</legend>
<div class="tabbable span9">
<ul class="nav nav-tabs">
<?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>
@ -17,8 +19,9 @@
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
</fieldset>
<div class="row">
<div class="offset2">
@ -26,5 +29,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -149,7 +149,7 @@ class ADSL_Billing_Exetelvisp {
// @todo This could be optimised better.
foreach ($aso->services(TRUE) as $so)
$this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->adsl_supplier_plan->display('base_cost'));
$this->haveService($so->plugin()->service_number,$so->plugin()->admin_plan()->supplier_plan->display('base_cost'));
return $this;
}

View File

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

View File

@ -14,7 +14,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
// Relationships
protected $_has_many = array(
'adsl_supplier_plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'supplier_id','far_key'=>'id'),
'plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'supplier_id','far_key'=>'id'),
'traffic'=>array('model'=>'Service_Plugin_Adsl_Traffic','foreign_key'=>'supplier_id','far_key'=>'id'),
);
@ -50,7 +50,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
* Return a list of plans that this supplier makes available
*/
public function find_plans($active=TRUE) {
return $active ? $this->adsl_supplier_plan->where_active() : $this->adsl_supplier_plan;
return $active ? $this->plan->where_active() : $this->plan;
}
/**
@ -63,8 +63,8 @@ class Model_ADSL_Supplier extends ORM_OSB {
foreach ($this->find_plans(FALSE)->find_all() as $aspo) {
foreach ($aspo->plan->find_all() as $apo) {
foreach ($apo->products(FALSE)->find_all() as $po) {
foreach ($po->services($active)->find_all() as $so) {
foreach ($apo->products(FALSE) as $po) {
foreach ($po->service->list_active() as $so) {
array_push($result,$so);
}
}

View File

@ -19,9 +19,6 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
protected $_belongs_to = array(
'supplier_plan'=>array('model'=>'ADSL_Supplier_Plan','foreign_key'=>'adsl_supplier_plan_id'),
);
protected $_has_many = array(
'product'=>array('far_key'=>'id','foreign_key'=>'prod_plugin_data'),
);
/**
* Filters used to format the display of values into friendlier values
@ -59,14 +56,6 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
'extra_up_offpeak',
);
// Map the table fields
private $_map = array(
'base_up_offpeak'=>'extra_up_offpeak',
'base_down_offpeak'=>'extra_down_offpeak',
'base_up_peak'=>'extra_up_peak',
'base_down_peak'=>'extra_down_peak',
);
// Our required abstract methods
public function cost($annual=FALSE) {
@ -75,25 +64,24 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
return $annual ? $x*12 : $x;
}
public function feature_summary() {
return View::factory(sprintf('product/plugin/%s/feature_summary',$this->plugin()))
->set('o',$this);
}
// @todo Select the ADSL Plan for this product.
public function render_edit() {
return '';
}
public function render_order() {
return View::factory(sprintf('product/plugin/%s/order',$this->plugin()));
}
public function supplier() {
return $this->supplier_plan->supplier_id;
}
/** LOCAL FUNCTIONS **/
// Local functions
// Map the table fields
private $_map = array(
'base_up_offpeak'=>'extra_up_offpeak',
'base_down_offpeak'=>'extra_down_offpeak',
'base_up_peak'=>'extra_up_peak',
'base_down_peak'=>'extra_down_peak',
);
/**
* Calculate the allowance array or traffic used array
@ -204,19 +192,5 @@ class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
return TRUE;
}
/**
* Get all the products using this plan
*/
public function products($active=FALSE) {
$x = ORM::factory('Product')
->where('prod_plugin_file','=','ADSL')
->and_where('prod_plugin_data','=',$this);
if ($active)
$x->where_active();
return $x;
}
}
?>

View File

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

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.
$update = array();
foreach ($this->so->services() as $so) {
foreach ($this->aso->services() as $so) {
if ($so->service_adsl->service_stats_collect AND $so->service_adsl->service_stats_lastupdate < $date) {
$lastperiod = '';
for ($servicedate=date('Y-m-d',strtotime($this->so->stats_lastupdate.'+1 day'));
for ($servicedate=date('Y-m-d',strtotime($this->aso->stats_lastupdate.'+1 day'));
$servicedate <= $this->today;
$servicedate=date('Y-m-d',strtotime('+1 day',strtotime($servicedate)))) {
@ -67,7 +67,7 @@ class Service_Traffic_ADSL_iiNetADSL extends Service_Traffic_ADSL {
if ($debug AND file_exists($debug_file))
$data = file_get_contents($debug_file);
else
$data = Remote::get($this->so->stats_url,$this->curlopts+array(CURLOPT_POSTFIELDS=>$postfields));
$data = Remote::get($this->aso->stats_url,$this->curlopts+array(CURLOPT_POSTFIELDS=>$postfields));
// @todo There exists a possibility to skip a month, if we get a bad fetch on a previous month.
if ($data)

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="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 class="span2">
<?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="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 class="span2">
<?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="span2">
<?php echo Form::input('base_up_peak',$o->base_up_peak,array('label'=>'Base Up Peak','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')); ?>
<?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_offpeak',$o->extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
</div>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<div class="row">
<div class="span2">
<?php echo Form::input('contract_term',$o->contract_term,array('label'=>'Contract Term','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?php echo StaticList_YesNo::form('extra_charged',$o->extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?>
</div>
</div>
<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')); ?>
</div>
<?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')); ?>
</div>
</fieldset>
<div class="row">
<div class="offset2">
@ -60,11 +76,12 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->
</div> <!-- /span -->
<div class="span5">
<div class="span5">
<fieldset>
<legend>Supplier Details</legend>
<div class="dl-horizontal">
<dt>Supplier</dt>
<dd><?php echo $o->supplier_plan->supplier->name; ?></dd>
@ -82,11 +99,12 @@
<dd><?php echo $o->supplier_plan->speed; ?></dd>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /span -->
<div class="span5">
<div class="span5">
<fieldset>
<legend>Test Traffic</legend>
<div class="row">
<div class="span2">
<?php echo Form::input('test[base_down_peak]',10000,array('label'=>'Down Peak','class'=>'span1')); ?>
@ -113,6 +131,7 @@
<?php if ($test_result) : ?>
<fieldset>
<legend>Test Traffic Result</legend>
<div class="dl-horizontal">
<?php foreach ($test_result as $k=>$v) : ?>
<dt><?php echo $k; ?></dt>
@ -124,5 +143,4 @@
</div>
</fieldset>
<?php endif ?>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

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

View File

@ -14,14 +14,14 @@
<?php foreach ($aso->services(TRUE) as $so) : ?>
<?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 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_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->excess($service_number)); ?></td>

View File

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

View File

@ -4,44 +4,49 @@
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="tablewrapper">
<table class="plan plain">
<tr class="plan-header">
<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>
<?php endforeach ?>
</tr>
<tr class="plan-header">
<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">
<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>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<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 ?>
</tr>
<tr class="plan-features">
<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>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<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>
<?php endforeach ?>
</tr>
@ -49,27 +54,26 @@
<?php if ($po->plugin()->base_down_offpeak) : ?>
<tr class="plan-features">
<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>
<?php endforeach ?>
</tr>
<?php endif ?>
<tr class="plan-features">
<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>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<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>
<?php endforeach ?>
</tr>
</table>
</div> <!-- /tablewrapper -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

@ -4,11 +4,14 @@
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4">
<div class="row">
<?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) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
@ -25,20 +28,21 @@
</div> <!-- /plan-title -->
<div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,1,'price_base',TRUE)); ?>
<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>
</div> <!-- /plan-price -->
</div> <!-- /plan-header -->
<div class="plan-features">
<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()->base_down_peak/1000; ?></strong>GB Peak Downloads</li>
<?php if ($po->plugin()->base_down_offpeak) : ?>
<li><strong><?php echo $po->plugin()->base_down_offpeak/1000; ?></strong>GB OffPeak Downloads</li>
<?php endif ?>
<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>
</ul>
@ -56,6 +60,4 @@
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

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

View File

@ -1,45 +1,39 @@
<div class="row">
<div class="span6">
<fieldset>
<legend>ADSL Service Details</legend>
<div class="row">
<?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="span6">
<div class="row">
<?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="span5 input-append date" id="service_connect_date_label">
<div class="row">
<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')); ?>
</div>
<?php echo Form::hidden('plugin[service_connect_date]',$o->service_connect_date,array('id'=>'service_connect_date')); ?>
</div> <!-- /row -->
</div> <!-- /row -->
<div class="row">
<div class="span5 input-append date" id="service_contract_date_label">
<div class="row">
<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')); ?>
</div>
<?php echo Form::hidden('plugin[service_contract_date]',$o->service_contract_date,array('id'=>'service_contract_date')); ?>
</div> <!-- /row -->
</div> <!-- /row -->
<div class="row">
<div class="span6">
<div class="row">
<?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="span6">
<div class="row">
<?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="span6">
<div class="row">
<?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>
<?php endforeach ?>
</tr></thead>
<tbody>
<?php foreach ($td as $i => $details) : ?>
<tr>

View File

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

View File

@ -69,12 +69,9 @@ class Controller_Reseller_Charge extends Controller_Charge {
->type('stdin')
->data('
$(document).ready(function() {
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$("#date_charge_label").datepicker({
autoclose : true,
endDate : now,
endDate : new Date(),
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {

View File

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

View File

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

View File

@ -47,7 +47,7 @@ $(document).ready(function() {
if ($o->registrar_ns)
return is_array($o->registrar_ns) ? implode(',',$o->registrar_ns) : '&gt;Invalid&lt;';
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
*/
class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// This model doesnt have a database table
public function __construct() {
}
// Our required abstract methods
public function cost($annual=FALSE) {
// @todo
$x = 0;
@ -22,8 +19,6 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
return $annual ? $x*12 : $x;
}
public function feature_summary() {}
public function render_edit() {}
// @todo
@ -31,7 +26,16 @@ class Model_Product_Plugin_Domain extends Model_Product_Plugin {
return 'internal';
}
/** LOCAL FUNCTIONS **/
// Overload functions
// This model doesnt have a database table
public function __construct() {
}
// Not used
public function render_view() {}
// Local functions
// @todo This is not used, but should be.
public function order_features() {

View File

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

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'),
array('target'=>'pd','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
);
$output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::input('page.next',sprintf('/newdnr/action/dns/getDNSDetails.jsp?domain.name=%s',$d),array('type'=>'hidden'));
$output .= Form::close();
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));

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'),
array('target'=>'tpp','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
);
$output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_user_field,$spdo->username(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
$output .= Form::input($this->login_pass_field,substr(md5($spdo->password()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
$output .= Form::close();
$output .= Form::button('submit',_('Manage'),array('class'=>'btn btn-default','value'=>sprintf('%s:%s',$spdo->service_id,$t)));

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>
<?php endif ?>
<?php if ($x=$o->manage_dns_button()) : ?>
<?php if ($x=$o->manage_button_dns()) : ?>
<dt>DNS</dt>
<dd><?php echo $x; ?></dd>
<?php endif ?>

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -1,5 +1,4 @@
<div class="row">
<div class="span10 offset1">
<div class="span11">
<fieldset>
<legend>Export Module Update</legend>
@ -16,5 +15,4 @@
'column_name'=>array('input'=>array('key'=>'display[__VALUE__]','values'=>$o->display)),
)); ?>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

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

View File

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

View File

@ -4,11 +4,14 @@
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4">
<div class="row">
<?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) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
@ -25,15 +28,14 @@
</div> <!-- /plan-title -->
<div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,4,'price_base',TRUE)); ?>
<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>
<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>
</div> <!-- /plan-price -->
</div> <!-- /plan-header -->
<div class="plan-features">
<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>
</div> <!-- /plan-features -->
@ -47,6 +49,4 @@
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

@ -10,6 +10,17 @@
* @license http://dev.osbill.net/license.html
*/
class Task_Invoice_Remindoverdue1 extends Minion_Task {
// @todo This should be moved to somewhere else
private $_css = '
<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) {
$action = array();
@ -44,7 +55,7 @@ class Task_Invoice_Remindoverdue1 extends Minion_Task {
'INV_NUM'=>$io->refnum(),
'INV_URL'=>URL::site(URL::link('user','invoice/view/'.$io->id),'http'),
'LATE_FEE'=>'5.50', // @todo This should come from a config file.
'PAYMENTS_TABLE'=>$io->account->payment->list_recent_table(),
'PAYMENTS_TABLE'=>$this->_css.$io->account->payment->list_recent_table(),
'SITE_NAME'=>Company::instance()->name(),
);

View File

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

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

View File

@ -121,12 +121,9 @@ class Controller_Admin_Payment extends Controller_Payment {
->type('stdin')
->data('
$(document).ready(function() {
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$("#date_payment_label").datepicker({
autoclose : true,
endDate : now,
endDate : new Date(),
format : "dd-mm-yyyy",
todayBtn : true,
}).on("hide",function(ev) {

View File

@ -214,6 +214,22 @@ class Model_Payment extends ORM_OSB {
/** LIST FUNCTIONS **/
/**
* Show recent payments for this account
*/
public function list_recent_table() {
return Table::factory()
->data($this->limit(10)->find_all())
->columns(array(
'id'=>'ID',
'date_payment'=>'Date',
'checkout->display("name")'=>'Method',
'total_amt'=>'Total',
'balance(TRUE)'=>'Balance',
'invoicelist()'=>'Invoices'
));
}
public function list_unapplied() {
$pid = array();
@ -232,32 +248,5 @@ class Model_Payment extends ORM_OSB {
return $this->where('id','IN',$pid)->order_by('account_id')->find_all();
}
public function list_recent_table() {
// @todo This should be in a config file.
$css = '<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="span9 offset1">
<div class="span11">
<fieldset>
<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?')); ?>
</fieldset>
<td><div id='items'></div></td>
<div class="span8" id="items"</div>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<table class="table table-striped table-condensed table-hover">
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Invoice</th>
@ -11,6 +11,7 @@
</tr>
</thead>
<tbody>
<?php $c=0;foreach ($o->items('ALLOC') as $pio) : ?>
<tr>
<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"><?php echo Form::input('invoice_item[excess]',$o->balance(TRUE),array('class'=>'span1','nocg'=>TRUE,'disabled'=>'disabled')); ?></td>
</tr>
</table>
</tbody>
</table>

View File

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

View File

@ -48,12 +48,11 @@ class Model_Product extends ORM_OSB {
protected $_save_message = TRUE;
/**
* Which categories is this product available in
*/
public function categories() {
return $this->avail_category;
}
// Our database index for pricing values
private $_price_options = array(
'base'=>'price_base',
'setup'=>'price_setup',
);
public function cost($annual=FALSE) {
return $this->plugin() ? $this->plugin()->cost($annual) : 0;
@ -72,7 +71,7 @@ class Model_Product extends ORM_OSB {
* This will render the product feature summary information
*/
public function feature_summary() {
return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary();
return (is_null($x=$this->plugin())) ? HTML::nbsp('') : $x->render_view();
}
/**
@ -116,6 +115,54 @@ class Model_Product extends ORM_OSB {
return (is_null($x = $this->plugin())) ? NULL : $x->render_edit();
}
/**
* Return the price for the particular group and price option for the period
*/
public function price($grp,$period,$price_option,$taxed=FALSE) {
if (is_null($option=$this->price_option($price_option)) OR is_null($x=$this->keyget('price_group',$period)))
return NULL;
if (isset($x[$grp][$option]))
return $taxed ? Tax::add($x[$grp][$option]) : $x[$grp][$option];
else
return NULL;
}
/**
* For the specific user, get the best price
*
* @todo change this to be the overall contract price, if there is a contract
*/
public function price_best($period,$taxed=FALSE) {
$result = NULL;
$x = NULL;
foreach (Auth::instance()->get_groups() as $go) {
$price = $this->price($go->id,$period,'base',$taxed);
if ($go->pricing AND ! is_null($price) AND (is_null($result) OR $x > $price)) {
$result = $go;
$x = $price;
}
}
return is_null($result) ? ORM::factory('Group',0) : $result;
}
/**
* Get the database index for a price option
*/
public function price_option($option) {
return isset($this->_price_options[$option]) ? $this->_price_options[$option] : NULL;
}
/**
* Return the available pricing options
*/
public function price_options() {
return $this->_price_options;
}
public function save(Validation $validation=NULL) {
parent::save($validation);
@ -135,13 +182,6 @@ class Model_Product extends ORM_OSB {
return $this;
}
/**
* List the services that are linked to this product
*/
public function services($active=FALSE) {
return $active ? $this->service->where_active() : $this->service;
}
public function supplier() {
return $this->plugin() ? $this->plugin()->supplier() : 'other';
}
@ -158,84 +198,5 @@ class Model_Product extends ORM_OSB {
return $x->loaded() ? $x->display('name') : 'No Title';
}
public function list_type($type) {
return $this->where('prod_plugin_file','=',$type)->find_all();
}
/**
* Return the best price to the uesr based on the users group's memberships
* @todo This needs to be tested with more than one price group enabled
*/
public function get_price_array() {
// Figure out our eligable groups
// @todo Need to work out our default groups elsewhere, not in product
// All users are members of the all user group "0"
$groups = array(0);
if (Auth::instance()->logged_in())
foreach (Auth::instance()->get_user()->group->find_all() as $go)
array_push($groups,$go->id);
// Work out the best price for the user
$price = array();
if (is_array($this->price_group))
foreach ($this->price_group as $bill_freq => $pg) {
if (isset($pg['show']) AND $pg['show'])
foreach ($groups as $gid) {
if (! empty($pg[$gid])) {
if (empty($price[$bill_freq]['price_base'])
OR ($pg[$gid]['price_base'] AND $price[$bill_freq]['price_base'] > $pg[$gid]['price_base'])) {
$price[$bill_freq]['price_setup'] = $pg[$gid]['price_setup'];
$price[$bill_freq]['price_base'] = $pg[$gid]['price_base'];
}
}
}
}
// @todo Ugly hack
return $price ? $price : array('0'=>array('price_base'=>0,'price_setup'=>0));
}
/**
* Return the configured price groups for this product
*/
public function availPriceGroups() {
// @todo This needs to be worked out dynamically
return array(0,1);
}
/**
* Return the available pricing options
*/
public function availPriceOptions() {
// @todo This needs to be worked out dynamically
return array('price_base','price_setup');
}
/**
* List the number of services using this product
*/
public function count_services() {
return $this->service->list_count(TRUE);
}
/**
* List the number of invoices using this product
*/
public function count_invoices() {
return $this->invoice->list_count(TRUE);
}
/**
* Return the price for the particle group and price option for the period
*/
public function price($grp,$period,$option,$taxed=FALSE) {
$x = $this->keyget('price_group',$period);
if (isset($x[$grp][$option]))
return $taxed ? Tax::add($x[$grp][$option]) : $x[$grp][$option];
else
return NULL;
}
}
?>

View File

@ -46,7 +46,7 @@ class Model_Product_Category extends ORM_OSB {
$result = array();
foreach (ORM::factory('Product')->where_active()->find_all() as $po)
if (in_array($this->id,$po->categories()))
if (in_array($this->id,$po->avail_category))
array_push($result,$po);
return $result;

View File

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

View File

@ -18,12 +18,6 @@ abstract class Model_Product_Plugin extends ORM_OSB {
*/
abstract public function cost($annual=FALSE);
/**
* The feature summary should be implemented in plugins.
* It is displayed on the product overview page, as a summary of the products features.
*/
abstract public function feature_summary();
/**
* Return the name of the plugin
*/
@ -31,12 +25,38 @@ abstract class Model_Product_Plugin extends ORM_OSB {
return strtolower(preg_replace('/(.*)_([a-zA-Z]+)$/',"$2",get_class($this)));
}
/**
* Get all the products using this plugin
*/
public function products($active=FALSE) {
$x = ORM::factory('Product')
->where('prod_plugin_file','=',$this->plugin())
->and_where('prod_plugin_data','=',$this);
if ($active)
$x->where_active();
return $x->find_all();
}
/**
* Form info for admins to update with plugin data
*/
abstract public function render_edit();
abstract public function render_order();
/**
* Form used during service ordering
*/
public function render_order() {
return View::factory(sprintf('product/plugin/%s/order',$this->plugin()));
}
/**
* View the details of the product
*/
public function render_view() {
return View::factory(sprintf('product/plugin/%s/view',$this->plugin()))->set('o',$this);
}
abstract public function supplier();
}

View File

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

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

View File

@ -1,10 +1,10 @@
<div class="row">
<div class="span9 offset1">
<div class="span11">
<fieldset>
<legend>Update Product</legend>
<div class="row">
<div class="tabbable span9">
<ul class="nav nav-tabs">
<?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>
@ -13,54 +13,51 @@
<div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<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 foreach ($o->availPriceGroups() as $g) : ?>
<?php foreach (ORM::factory('Group')->list_pricegroups() as $go) : ?>
<div class="row">
<div class="span2"><?php echo ORM::factory('Group',$g)->name; ?></div>
<?php foreach ($o->availPriceOptions() as $po) : ?>
<div class="span2"><?php echo $go->name; ?></div>
<?php foreach (array_keys($o->price_options()) as $po) : ?>
<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>
<?php endforeach ?> <!-- /availPriceOptions() -->
<?php endforeach ?> <!-- /price_options() -->
</div>
<?php endforeach ?> <!-- /availPriceGroups() -->
<?php endforeach ?> <!-- /list_pricegroups() -->
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<br>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div>
</div>
<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>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</div> <!-- /row -->
</fieldset>
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
@ -70,7 +67,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

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

View File

@ -1,29 +1,26 @@
<div class="row">
<div class="span9 offset1">
<div class="span11">
<fieldset>
<legend>Update Category</legend>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo Form::select('template',$o->templates(),$o->template,array('label'=>'List Template')); ?>
</div>
</div> <!-- /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')); ?>
</div>
</div> <!-- /row -->
<div class="row">
</fieldset>
<div id="translate"></div>
</div> <!-- /row -->
<div class="row">
<div class="offset2">
@ -31,6 +28,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -9,19 +9,17 @@
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row divider service-container">
<div class="grid-3">
&nbsp;
</div>
<div class="grid-3">&nbsp;</div>
<?php endif ?>
<div class="grid-3">
<div class="service-item">
<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).'...'; ?>
<p><a href="<?php echo URL::site('product/category/'.$pco->id); ?>" class="">More Details »</a></p>
</div> <!-- /service -->
</div>
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /container -->

View File

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

View File

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

View File

@ -29,6 +29,8 @@ class Model_Service extends ORM_OSB {
'account'=>array(),
);
protected $_save_message = TRUE;
// Validation rules
public function rules() {
$x = Arr::merge(parent::rules(), array(
@ -167,7 +169,7 @@ class Model_Service extends ORM_OSB {
$iio->find();
$x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : $iio->date_stop;
$x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : ($iio->total() < 0 ? $iio->date_start-86400 : $iio->date_stop);
return $format ? Config::date($x) : $x;
}
@ -255,7 +257,7 @@ class Model_Service extends ORM_OSB {
* Return a descriptive name for this service
*/
public function service_name() {
return is_null($plugin=$this->plugin()) ? $this->name() : $plugin->service_name();
return is_null($x=$this->plugin()) ? $this->name() : $x->service_name();
}
/**
@ -286,16 +288,17 @@ class Model_Service extends ORM_OSB {
case 'invoice_detail_items':
return is_null($plugin) ? array() : $plugin->_details($type);
case 'service_view':
return is_null($plugin) ? HTML::nbsp('') : $plugin->render_view();
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
public function service_view() {
return ! is_object($x=$this->plugin()) ? HTML::nbsp('') : $x->render_view();
}
public function transactions() {
return $this->invoice_item->order_by('date_start')->order_by('date_stop');
return $this->invoice_item->order_by('date_start','ASC')->order_by('product_id','ASC')->order_by('date_stop','ASC');
}
/** LIST FUNCTIONS **/

View File

@ -13,6 +13,10 @@ abstract class Model_Service_Plugin extends ORM_OSB {
// Reset any sorting that may be defined in our parent
protected $_sorting = array();
protected $_belongs_to = array(
'service'=>array(),
);
/**
* When does our service expire
*/
@ -26,56 +30,43 @@ abstract class Model_Service_Plugin extends ORM_OSB {
/**
* The table attributes that provide username/password values
*/
abstract public function password_value();
abstract public function username_value();
/**
* Get specific service details for use in other modules
* For Example: Invoice
*
* @todo Make the rendered items configurable
* @todo Change this method name, now that it is public
*/
public function _details($type) {
switch ($type) {
// Nothing to add for invoices
case 'invoice_detail_items':
return array();
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
abstract public function password();
abstract public function username();
/**
* Provide the button that launches the management of this service, generally from a 3rd party
*/
public function manage_button() {
protected function manage() {
// Dont show the manage button for expired or inactive services
if (! $this->service->status OR $this->service->expiring())
return FALSE;
static $k = '';
static $x = '';
// If $k is already set, we've rendered this JS
if ($k)
return TRUE;
// If $x is already set, we've rendered this JS
if (! $x) {
$x = Random::char();
$k = Random::char();
Session::instance()->set('manage_button',$k);
Session::instance()->set('manage_button',$x);
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
var x=0;
$("button[name=submit]").click(function() {
var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; }
$.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); });
}).error(function() { alert("There was a problem with the request"); return false; }).success(
function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
$.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$x.'",t: t[1] },
function(data) {$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); })
.error(function() { alert("There was a problem with the request"); return false; })
.success(function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
});
});'
));
});'
);
}
return TRUE;
}
@ -109,5 +100,23 @@ function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
public function service_name() {
return sprintf('%s - %s',$this->service->product->title(),$this->name());
}
/**
* Get specific service details for use in other modules
* For Example: Invoice
*
* @todo Make the rendered items configurable
* @todo Change this method name, now that it is public
*/
public function _details($type) {
switch ($type) {
// Nothing to add for invoices
case 'invoice_detail_items':
return array();
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
}
?>

View File

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

View File

@ -1,22 +1,17 @@
<div class="row">
<div class="span9 offset1">
<div class="span11">
<fieldset>
<legend>Update Service</legend>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?>
</div>
</div> <!-- /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')); ?>
</div>
@ -24,22 +19,17 @@
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
</fieldset>
<?php if ($plugin_form) { echo $plugin_form; } ?>
@ -49,6 +39,4 @@
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

@ -1,40 +1,50 @@
<?php if ($so->pending_change()) {?>
Pending change to: <?php echo $so->service_change->list_details(); ?>
<?php } ?>
<br/>
<!-- @todo NEEDS TO BE TRANSLATED -->
<table class="list-box-left">
<tr class="list-head">
<?php if ($o->pending_change()) : ?>
<div class="span5">
Pending change to: <?php echo $o->service_change->list_details(); ?>
</div> <!-- /span -->
<?php endif ?>
<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>Invoice</th>
<th>Product</th>
<th>IT</th>
<th>RS</th>
<th>Start</th>
<th>Stop</th>
<th class="text-right">Start</th>
<th class="text-right">Stop</th>
<th class="text-right">Quantity</th>
<th class="text-right">Charge</th>
<th>Desc</th>
<th>Quantity</th>
<th>Charge</th>
</tr>
<?php $lp=NULL; foreach ($so->transactions()->find_all() as $iio) { ?>
<?php if (! is_null($iio->product_id) AND $lp != $iio->product_id) {
$lp = $iio->product_id; ?>
<tr class="list-sub-head">
<th class="id"><?php echo $iio->product_id; ?></th>
</thead>
<tbody>
<?php $lp=NULL; foreach ($o->transactions()->find_all() as $iio) : ?>
<?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>
</tr>
<?php } ?>
<tr class="list-data">
<td class="id"><?php echo $iio->id; ?></td>
<?php endif ?>
<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 $iio->display('product_id'); ?></td>
<td><?php echo $iio->display('item_type'); ?></td>
<td><?php echo $iio->display('recurring_schedule'); ?></td>
<td><?php echo $iio->display('date_start'); ?></td>
<td><?php echo $iio->display('date_stop'); ?></td>
<td class="text-right"><?php echo $iio->display('date_start'); ?></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('quantity'); ?></td>
<td class="right"><?php echo $iio->display('price_base'); ?></td>
</tr>
<?php } ?>
</table>
<?php endforeach ?>
</tbody>
</table>
</fieldset>
</div> <!-- /span -->

View File

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

View File

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

View File

@ -30,7 +30,10 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
),
);
protected $_save_message = TRUE;
// Required abstract functions
public function expire($format=FALSE) {
return $this->_so->get_valid_to($format);
}
@ -39,8 +42,11 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr');
}
public function password_value() {} // Not used
public function username_value() {} // Not used
public function password() {} // Not used
public function username() {} // Not used
// Local functions
private $_so = NULL;

View File

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

View File

@ -1,17 +1,15 @@
<div class="row">
<div class="span6">
<fieldset>
<legend>SSL Certificate Service Details</legend>
<div class="row">
<?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> <!-- /row -->
<div class="row">
<div class="span6">
<div class="row">
<?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> <!-- /row -->
<div class="row">
<div class="span6">
<div class="row">
<?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> <!-- /row -->
</fieldset>

View File

@ -1,8 +1,8 @@
<fieldset class="span5">
<div class="span5">
<fieldset>
<legend>Service Details</legend>
<div class="dl-horizontal">
<dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd>
@ -40,9 +40,11 @@
<dd><?php echo $o->algorithm(); ?></dd>
</div> <!-- dl-horizontal -->
</fieldset>
</fieldset>
</div> <!-- /span -->
<fieldset class="span6">
<div class="span6">
<fieldset>
<legend>Certificate</legend>
<pre><?php echo $o->cert; ?></pre>
@ -54,4 +56,5 @@
endif
?>
</fieldset>
</fieldset>
</div> <!-- /span -->

View File

@ -1,8 +1,8 @@
<div class="row">
<div class="span9">
<div class="span11">
<fieldset>
<legend>SSL CA Certificate Edit/Update</legend>
<div class="dl-horizontal">
<dt>Subject</dt>
<dd><?php echo $o->subject(); ?></dd>
@ -46,13 +46,11 @@
<dt>Key Algorithm<dt>
<dd><?php echo $o->algorithm(); ?></dd>
</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_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')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
</div> <!-- /span -->

View File

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

View File

@ -17,41 +17,47 @@ class Task_Task_Clean extends Minion_Task {
foreach ($tl->find_all() as $to) {
// Delete Task already running messages.
if (preg_match('/^Task\ [0-9]+\ is already running$/',$to->message) AND $to->date_orig < time()+$delay) {
if (preg_match('/^Task\ [0-9]+\ is already running$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
// Delete Empty Invoices Sent
if (preg_match('/^Invoices Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) {
if (preg_match('/^Invoices Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
// Delete Overdue Notes Sent
if (preg_match('/^OverDue Notice #[0-9] Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) {
if (preg_match('/^OverDue Notice #[0-9] Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
// Over Notes Sent
if (preg_match('/^(Overdue|Due) Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()+$delay) {
if (preg_match('/^(Overdue|Due) Reminders Sent:\s+$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
// Services Invoiced
if (preg_match('/^Services Invoiced:\s+$/',$to->message) AND $to->date_orig < time()+$delay) {
if (preg_match('/^Services Invoiced:\s+$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
if (in_array($to->task_id,array(2,4,13)) AND $to->date_orig < time()+$delay) {
// Alerts Sent
if (preg_match('/^0 alerts sent \(\)$/',$to->message) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
if (in_array($to->task_id,array(3)) AND $to->date_orig < time()+86400*60) {
if (in_array($to->task_id,array(4,13)) AND $to->date_orig < time()-$delay) {
$to->delete();
continue;
}
if (in_array($to->task_id,array(3)) AND $to->date_orig < time()-86400*60) {
$to->delete();
continue;
}
@ -63,7 +69,7 @@ class Task_Task_Clean extends Minion_Task {
OR preg_match('/View_Exception\s+/',$to->message)
OR preg_match('/Kohana_Exception\s+/',$to->message))
AND $to->date_orig < time()+$delay) {
AND $to->date_orig < time()-$delay) {
$to->delete();
continue;