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

@ -22,13 +22,13 @@ class Controller_User_Welcome extends Controller_Welcome {
->span(6)
->body(Table::factory()
->data($this->ao->service->list_active())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
Block::factory()
@ -43,15 +43,15 @@ class Controller_User_Welcome extends Controller_Welcome {
->span(6)
->body(Table::factory()
->data($this->ao->invoice->list_due())
->columns(array(
'id'=>'ID',
'due_date'=>'Date Due',
'total(TRUE)'=>'Invoice Total',
'due(TRUE)'=>'Amount Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
->columns(array(
'id'=>'ID',
'due_date'=>'Date Due',
'total(TRUE)'=>'Invoice Total',
'due(TRUE)'=>'Amount Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
Block::factory()
@ -60,14 +60,14 @@ class Controller_User_Welcome extends Controller_Welcome {
->span(6)
->body(Table::factory()
->data($this->ao->service->list_expiring())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
}
}

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,58 +1,58 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Update Account Details</legend>
<div class="span11">
<fieldset>
<legend>Update Account Details</legend>
<?php echo Form::input('date_last',$o->display('date_last'),array('label'=>'Last Updated','disabled')); ?>
<?php echo Form::input('date_last',$o->display('date_last'),array('label'=>'Last Updated','disabled')); ?>
<?php echo Form::input('username',$o->display('username'),array('label'=>'User Name','disabled')); ?>
<?php echo Form::input('username',$o->display('username'),array('label'=>'User Name','disabled')); ?>
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?>
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'input-xxlarge','placeholder'=>'Email Address','type'=>'email','required')); ?>
<?php echo Form::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'input-small','label'=>'Title','required')); ?>
<div class="row">
<div class="span2">
<?php echo Form::input('first_name',$o->display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?>
</div>
<div class="span3">
<?php echo Form::input('last_name',$o->display('last_name'),array('label'=>'','class'=>'input-large','placeholder'=>'Last Name','required')); ?>
</div>
<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>
<?php echo Form::input('company',$o->display('company'),array('label'=>'Company','class'=>'input-xxlarge','placeholder'=>'Company Name')); ?>
<?php echo Form::input('address1',$o->display('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?>
<?php echo Form::input('address2',$o->display('address2'),array('label'=>'','class'=>'input-xxlarge')); ?>
<div class="row">
<div class="span3">
<?php echo Form::input('city',$o->display('city'),array('label'=>'City','placeholder'=>'City','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('state',$o->display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('zip',$o->display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?>
</div>
</div> <!-- /row -->
<?php echo Form::select('country_id',ORM::factory('Country')->list_select(),$o->country_id,array('label'=>'Country','required')); ?>
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(),$o->language_id,array('label'=>'Language','required')); ?>
<?php echo Form::select('currency_id',ORM::factory('Currency')->list_select(),$o->currency_id,array('label'=>'Currency','required')); ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
<div class="span2">
<?php echo Form::input('first_name',$o->display('first_name'),array('label'=>'','class'=>'input-medium','placeholder'=>'First Name','required')); ?>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
<div class="span3">
<?php echo Form::input('last_name',$o->display('last_name'),array('label'=>'','class'=>'input-large','placeholder'=>'Last Name','required')); ?>
</div>
</div>
<?php echo Form::input('company',$o->display('company'),array('label'=>'Company','class'=>'input-xxlarge','placeholder'=>'Company Name')); ?>
<?php echo Form::input('address1',$o->display('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?>
<?php echo Form::input('address2',$o->display('address2'),array('label'=>'','class'=>'input-xxlarge')); ?>
<div class="row">
<div class="span3">
<?php echo Form::input('city',$o->display('city'),array('label'=>'City','placeholder'=>'City','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('state',$o->display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('zip',$o->display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?>
</div>
</div> <!-- /row -->
<?php echo Form::select('country_id',ORM::factory('Country')->list_select(),$o->country_id,array('label'=>'Country','required')); ?>
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(),$o->language_id,array('label'=>'Language','required')); ?>
<?php echo Form::select('currency_id',ORM::factory('Currency')->list_select(),$o->currency_id,array('label'=>'Currency','required')); ?>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

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

View File

@ -1,18 +1,16 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Add Method</legend>
<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')); ?>
<?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">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

@ -1,29 +1,26 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Configure Method </legend>
<div class="span5">
<fieldset>
<legend>Method Details</legend>
<?php echo Form::input('notes',$o->notes,array('label'=>'Description','placeholder'=>'Method Description','class'=>'span8')); ?>
<?php echo Form::input('menu_display',$o->menu_display,array('label'=>'Menu Title','placeholder'=>'Menu Title')); ?>
<?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 -->
</fieldset>
</div> <!-- /span -->
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Configure Method Security</legend>
<div class="span6">
<fieldset>
<legend>Method Security</legend>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
<th>Method</th>
<th>Notes</th>
<th>Group Active</th>
<th>Method Enable</th>
</tr></thead>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
<th>Method</th>
<th>Notes</th>
<th>Group Active</th>
<th>Method Enable</th>
</tr></thead>
<tbody>
<tbody>
<?php foreach (ORM::factory('Group')->find_all() as $go) : ?>
<tr>
<td><?php echo HTML::anchor(URL::link('admin','group/edit/'.$go->id,TRUE),$go->display('name')); ?></td>
@ -32,16 +29,14 @@
<td><?php echo Form::checkbox('groups[]',$go->id,$o->has('group',$go)); ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</tbody>
</table>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

@ -1,44 +1,42 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Application Setup</legend>
<div class="span11">
<fieldset>
<legend>Application Setup</legend>
<?php echo Form::input('site_details[name]',$o->site_details('name'),array('label'=>'Site Name','class'=>'input-xxlarge','placeholder'=>'Site Name','required')); ?>
<?php echo Form::input('site_details[name]',$o->site_details('name'),array('label'=>'Site Name','class'=>'input-xxlarge','placeholder'=>'Site Name','required')); ?>
<?php echo Form::input('site_details[address1]',$o->site_details('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?>
<?php echo Form::input('site_details[address1]',$o->site_details('address1'),array('label'=>'Address','class'=>'input-xxlarge','placeholder'=>'Address','required')); ?>
<?php echo Form::input('site_details[address2]',$o->site_details('address2')); ?>
<?php echo Form::input('site_details[address2]',$o->site_details('address2')); ?>
<div class="row">
<div class="span3">
<?php echo Form::input('site_details[city]',$o->site_details('city'),array('label'=>'City','placeholder'=>'City','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('site_details[state]',$o->site_details('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('site_details[pcode]',$o->site_details('pcode'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?>
</div>
</div> <!-- /row -->
<?php echo Form::select('country_id',ORM::factory('Country')->list_select(),$o->country_id,array('label'=>'Country','required')); ?>
<?php echo Form::input('site_details[phone]',$o->site_details('phone'),array('label'=>'Phone','type'=>'tel','class'=>'input-medium','placeholder'=>'Phone','required')); ?>
<?php echo Form::input('site_details[fax]',$o->site_details('fax'),array('label'=>'Fax','type'=>'tel','class'=>'input-medium','placeholder'=>'Fax','required')); ?>
<?php echo Form::input('site_details[email]',$o->site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?>
<?php echo Form::input('site_details[faqurl]',$o->site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
<div class="row">
<div class="span3">
<?php echo Form::input('site_details[city]',$o->site_details('city'),array('label'=>'City','placeholder'=>'City','required')); ?>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
<div class="span1">
<?php echo Form::input('site_details[state]',$o->site_details('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required')); ?>
</div>
<div class="span1">
<?php echo Form::input('site_details[pcode]',$o->site_details('pcode'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required')); ?>
</div>
</div> <!-- /row -->
<?php echo Form::select('country_id',ORM::factory('Country')->list_select(),$o->country_id,array('label'=>'Country','required')); ?>
<?php echo Form::input('site_details[phone]',$o->site_details('phone'),array('label'=>'Phone','type'=>'tel','class'=>'input-medium','placeholder'=>'Phone','required')); ?>
<?php echo Form::input('site_details[fax]',$o->site_details('fax'),array('label'=>'Fax','type'=>'tel','class'=>'input-medium','placeholder'=>'Fax','required')); ?>
<?php echo Form::input('site_details[email]',$o->site_details('email'),array('label'=>'Email','type'=>'email','class'=>'input-large','placeholder'=>'Email','required')); ?>
<?php echo Form::input('site_details[faqurl]',$o->site_details('faqurl'),array('label'=>'FAQ Url','type'=>'url','class'=>'input-xxlarge','placeholder'=>'FAQ Url')); ?>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

@ -1,30 +1,32 @@
<div class="row">
<div class="span10 offset1">
<div class="row">
<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>
<?php endforeach ?>
</ul>
<div class="span11">
<fieldset>
<legend>Application Setup</legend>
<div class="tab-content">
<?php $c=0;foreach ($o->module_config_id($mid) as $id => $data) : ?>
<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>
<?php endforeach ?>
</ul>
<div class="tab-content">
<?php $c=0;foreach ($o->module_config_id($mid) as $id => $data) : ?>
<div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $c; ?>">
<?php foreach ($data['data'] as $k => $v) : ?>
<?php echo Form::input('module_config['.$id.']['.$k.']',$v,array('label'=>$k,'placeholder'=>$k)); ?>
<?php endforeach ?>
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> <!-- /tabbable -->
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div> <!-- /span -->
</div> <!-- /row -->
</div>
</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,128 +1,146 @@
<div class="row">
<div class="span6">
<div class="span6">
<fieldset>
<legend>ADSL Plan Details</legend>
<div class="row">
<div class="span2">
<?php echo Form::input('base_down_peak',$o->base_down_peak,array('label'=>'Base Down Peak','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_down_peak',$o->extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
<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','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_down_peak',$o->extra_down_peak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?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')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?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">
<?php echo Form::input('contract_term',$o->contract_term,array('label'=>'Contract Term','class'=>'span1')); ?>
</div>
<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')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_down_offpeak',$o->extra_down_offpeak,array('label'=>'Extra','class'=>'span1')); ?>
</div>
<?php echo StaticList_YesNo::form('extra_charged',$o->extra_charged,FALSE,array('label'=>'Extra Charged','class'=>'span1')); ?>
</div>
<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>
<?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">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->
<div class="span5">
<fieldset>
<legend>Supplier Details</legend>
<div class="dl-horizontal">
<dt>Supplier</dt>
<dd><?php echo $o->supplier_plan->supplier->name; ?></dd>
<dt>Allowance</dt>
<dd><?php echo $o->allowance($o->supplier_plan->traffic_data(),TRUE); ?></dd>
<dt>Cost</dt>
<dd><?php echo $o->supplier_plan->display('base_cost'); ?></dd>
<dt>Excess</dt>
<dd><?php echo $o->supplier_plan->cost_extra($o->allowance($o->supplier_plan->traffic_data()),TRUE); ?></dd>
<dt>Speed</dt>
<dd><?php echo $o->supplier_plan->speed; ?></dd>
</div>
</fieldset>
</div> <!-- /span -->
<div class="span5">
<fieldset>
<legend>Test Traffic</legend>
<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('test[base_down_peak]',10000,array('label'=>'Down Peak','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('extra_up_offpeak',$o->extra_up_offpeak,array('label'=>'Extra','class'=>'span1')); ?>
<?php echo Form::input('test[base_down_offpeak]',30000,array('label'=>'Offpeak','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?php echo Form::input('contract_term',$o->contract_term,array('label'=>'Contract Term','class'=>'span1')); ?>
<?php echo Form::input('test[base_up_peak]',20000,array('label'=>'Up Peak','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('test[base_up_offpeak]',40000,array('label'=>'Offpeak','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')); ?>
<?php echo Form::checkbox('test[charge]',1,FALSE,array('label'=>'Charges','class'=>'span1')); ?>
</div>
</div>
</fieldset>
<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>
</div>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->
<div class="span5">
<?php if ($test_result) : ?>
<fieldset>
<legend>Supplier Details</legend>
<div class="dl-horizontal">
<dt>Supplier</dt>
<dd><?php echo $o->supplier_plan->supplier->name; ?></dd>
<legend>Test Traffic Result</legend>
<dt>Allowance</dt>
<dd><?php echo $o->allowance($o->supplier_plan->traffic_data(),TRUE); ?></dd>
<div class="dl-horizontal">
<?php foreach ($test_result as $k=>$v) : ?>
<dt><?php echo $k; ?></dt>
<dd><?php echo $v; ?></dd>
<?php endforeach ?>
<dt>Cost</dt>
<dd><?php echo $o->supplier_plan->display('base_cost'); ?></dd>
<dt>Excess</dt>
<dd><?php echo $o->supplier_plan->cost_extra($o->allowance($o->supplier_plan->traffic_data()),TRUE); ?></dd>
<dt>Speed</dt>
<dd><?php echo $o->supplier_plan->speed; ?></dd>
</div>
</fieldset>
</div> <!-- /span -->
<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')); ?>
</div>
<div class="span2">
<?php echo Form::input('test[base_down_offpeak]',30000,array('label'=>'Offpeak','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?php echo Form::input('test[base_up_peak]',20000,array('label'=>'Up Peak','class'=>'span1')); ?>
</div>
<div class="span2">
<?php echo Form::input('test[base_up_offpeak]',40000,array('label'=>'Offpeak','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span2">
<?php echo Form::checkbox('test[charge]',1,FALSE,array('label'=>'Charges','class'=>'span1')); ?>
</div>
<dt>Has Offpeak?</dt>
<dd><?php echo $o->hasOffpeak(); ?></dd>
</div>
</fieldset>
<?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>
<dd><?php echo $v; ?></dd>
<?php endforeach ?>
<dt>Has Offpeak?</dt>
<dd><?php echo $o->hasOffpeak(); ?></dd>
</div>
</fieldset>
<?php endif ?>
</div> <!-- /span -->
</div> <!-- /row -->
<?php endif ?>
</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,12 +1,10 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<div class="span11">
<fieldset>
<legend>Exetel VISP Billing</legend>
<?php echo Form::hidden('sid',$_POST['sid']); ?>
<?php echo Form::file('csv',array('label'=>'Invoice File','required')); ?>
</fieldset>
<?php echo Form::hidden('sid',$_POST['sid']); ?>
<?php echo Form::file('csv',array('label'=>'Invoice File','required')); ?>
</fieldset>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->

View File

@ -4,72 +4,76 @@
</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) : ?>
<td class="plan-title"><?php echo $po->title(); ?> <small>(<?php echo $po->id; ?>)</small></td>
<?php endforeach ?>
</tr>
<div class="tablewrapper">
<table class="plan plain">
<tr class="plan-header">
<th class="plan-title">Plan Name</th>
<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)); ?>
<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>
</td>
<?php endforeach ?>
</tr>
<?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-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 endforeach ?>
</tr>
<tr class="plan-header">
<th class="plan-price" >Price</th>
<tr class="plan-features">
<th>Speed</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->supplier_plan->display('speed'); ?></td>
<?php endforeach ?>
</tr>
<?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)); ?>
<tr class="plan-features">
<th>Peak Downloads</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_peak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?>
</tr>
<td class="plan-price">
<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>
<?php if ($po->plugin()->base_down_offpeak) : ?>
<tr class="plan-features">
<tr class="plan-features">
<th>Connection</th>
<?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 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 foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_peak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?>
</tr>
<?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 ?>
<?php endif ?>
</tr>
<?php endif ?>
<tr class="plan-features">
<th>Extra Traffic</th>
<?php $c=0; 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>Extra Traffic</th>
<?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) : ?>
<td><?php echo $po->plugin()->display('contract_term'); ?> <span class="normal">mths</span></td>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<th>Contract Term</th>
<?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 -->
</table>
</div> <!-- /tablewrapper -->
</div> <!-- /container -->

View File

@ -4,58 +4,60 @@
</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 if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<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)); ?>
<div class="plan-container">
<div class="plan">
<?php if (is_null($price)) continue; ?>
<div class="plan-header">
<?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<div class="plan-title">
<?php echo $po->title(); ?> <small>(<?php echo $po->id; ?>)</small>
</div> <!-- /plan-title -->
<div class="plan-container">
<div class="plan">
<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>
</div> <!-- /plan-price -->
<div class="plan-header">
</div> <!-- /plan-header -->
<div class="plan-title">
<?php echo $po->title(); ?> <small>(<?php echo $po->id; ?>)</small>
</div> <!-- /plan-title -->
<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><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) : ?>
<div class="plan-price">
<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($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>
</div> <!-- /plan-features -->
<?php endif ?>
<div class="plan-actions">
<!--
<a href="javascript:;" class="btn">Purchase Now</a>
-->
</div> <!-- /plan-actions -->
<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>
</div> <!-- /plan-features -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
<div class="plan-actions">
<!--
<a href="javascript:;" class="btn">Purchase Now</a>
-->
</div> <!-- /plan-actions -->
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</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">
<?php echo Form::input('service_connect_date_label',$o->display('service_connect_date'),array('class'=>'span2','label'=>'Service Connected','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<div 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 -->
<?php echo Form::hidden('plugin[service_connect_date]',$o->service_connect_date,array('id'=>'service_connect_date')); ?>
</div> <!-- /row -->
<div class="row">
<div class="span5 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>
<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 -->
<?php echo Form::hidden('plugin[service_contract_date]',$o->service_contract_date,array('id'=>'service_contract_date')); ?>
</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,80 +1,79 @@
<fieldset class="span5">
<legend>Service Details</legend>
<div class="span6">
<fieldset>
<legend>Service Details</legend>
<div class="dl-horizontal">
<dt>Service Number</dt>
<dd><?php echo $o->display('service_number'); ?></dd>
<dt>Service Address</dt>
<dd><?php echo $o->display('service_address'); ?></dd>
<dt>Connect Date</dt>
<dd><?php echo $o->display('service_connect_date'); ?></dd>
<dt>Contract Term</dt>
<dd><?php echo $o->display('contract_term'); ?></dd>
<dt>Contract End Date</dt>
<dd><?php echo $o->contract_date_end(TRUE); ?></dd>
<dt>Service Username</dt>
<dd><?php echo $o->display('service_username'); ?></dd>
<dt>Service Password</dt>
<dd><?php echo $o->display('service_password'); ?></dd>
<dt>Service IP</dt>
<dd><?php echo $o->ipaddress(); ?></dd>
<?php if ($o->hasOffPeak() AND $o->offpeak_start AND $o->offpeak_end) : ?>
<dt>Offpeak Period</dt>
<dd><?php printf('%s-%s',$o->offpeak_start,$o->offpeak_end); ?></dd>
<?php endif ?>
</div> <!-- dl-horizontal -->
</fieldset>
<fieldset class="span6">
<legend>Traffic Usage</legend>
<div class="dl-horizontal">
<dt>Last Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('last month'),TRUE,TRUE); ?></dd>
<dt>This Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('yesterday'),TRUE,TRUE); ?></dd>
<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>
<dd><?php echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?>
<button type="submit" class="btn btn-mini">Submit</button></dd>
<dt>Service Number</dt>
<dd><?php echo $o->display('service_number'); ?></dd>
<dt>Service Address</dt>
<dd><?php echo $o->display('service_address'); ?></dd>
<dt>Connect Date</dt>
<dd><?php echo $o->display('service_connect_date'); ?></dd>
<dt>Contract Term</dt>
<dd><?php echo $o->display('contract_term'); ?></dd>
<dt>Contract End Date</dt>
<dd><?php echo $o->contract_date_end(TRUE); ?></dd>
<dt>Service Username</dt>
<dd><?php echo $o->display('service_username'); ?></dd>
<dt>Service Password</dt>
<dd><?php echo $o->display('service_password'); ?></dd>
<dt>Service IP</dt>
<dd><?php echo $o->ipaddress(); ?></dd>
<?php if ($o->hasOffPeak() AND $o->offpeak_start AND $o->offpeak_end) : ?>
<dt>Offpeak Period</dt>
<dd><?php printf('%s-%s',$o->offpeak_start,$o->offpeak_end); ?></dd>
<?php endif ?>
</div> <!-- dl-horizontal -->
</form>
</fieldset>
</div> <!-- /span -->
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Graph</a></li>
<li class=""><a href="#tab2" data-toggle="tab">Table</a></li>
</ul>
<div class="span6">
<fieldset>
<legend>Traffic Usage</legend>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php echo $o->traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
<div class="dl-horizontal">
<dt>Last Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('last month'),TRUE,TRUE); ?></dd>
<div class="tab-pane" id="tab2">
<?php echo $o->traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
<dt>This Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('yesterday'),TRUE,TRUE); ?></dd>
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
<dt>Excess Traffic</dt>
<dd>&nbsp;$<?php echo $o->traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?></dd>
</div> <!-- dl-horizontal -->
</fieldset>
<form class="form-inline" method="POST">
<div class="dl-horizontal">
<dt>View Traffic for</dt>
<dd><?php echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?>
<button type="submit" class="btn btn-mini">Submit</button></dd>
</div> <!-- dl-horizontal -->
</form>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Graph</a></li>
<li class=""><a href="#tab2" data-toggle="tab">Table</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php echo $o->traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
<div class="tab-pane" id="tab2">
<?php echo $o->traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</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,31 +1,28 @@
<div class="row">
<div class="span9 offset1">
<div class="span11">
<fieldset>
<legend>Charge Details</legend>
<fieldset>
<legend>Charge Details</legend>
<div class="input-append date" id="date_charge_label">
<?php echo Form::input('date_charge_label',$o->display('date_charge'),array('class'=>'span2','label'=>'Date of Charge','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<div class="input-append date" id="date_charge_label">
<?php echo Form::input('date_charge_label',$o->display('date_charge'),array('class'=>'span2','label'=>'Date of Charge','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('date_charge',$o->date_charge); ?>
<?php echo Form::input('account_id_label',$o->account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead','required')); ?>
<?php echo Form::hidden('account_id',$o->account_id); ?>
<?php echo Form::select('service_id',$o->account_id ? $o->account->service->list_select() : array(),$o->service_id,array('class'=>'span5','label'=>'Service')); ?>
<?php echo StaticList_SweepType::form('sweep_type',is_null($o->sweep_type) ? 6 : $o->sweep_type,FALSE,array('label'=>'Sweep')); ?>
<?php echo StaticList_ItemType::form('type',is_null($o->type) ? 6 : $o->type,FALSE,array('label'=>'Item Type')); ?>
<?php echo Form::hidden('date_charge',$o->date_charge); ?>
<?php echo Form::input('account_id_label',$o->account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead','required')); ?>
<?php echo Form::hidden('account_id',$o->account_id); ?>
<?php echo Form::select('service_id',$o->account_id ? $o->account->service->list_select() : array(),$o->service_id,array('class'=>'span5','label'=>'Service')); ?>
<?php echo StaticList_SweepType::form('sweep_type',is_null($o->sweep_type) ? 6 : $o->sweep_type,FALSE,array('label'=>'Sweep')); ?>
<?php echo StaticList_ItemType::form('type',is_null($o->type) ? 6 : $o->type,FALSE,array('label'=>'Item Type')); ?>
<?php echo Form::input('quantity',$o->quantity,array('class'=>'span1','label'=>'Quantity','placeholder'=>'Quantity')); ?>
<?php echo Form::input('amount',$o->amount,array('class'=>'span1','label'=>'Amount','placeholder'=>'Total',)); ?>
<?php echo StaticList_YesNo::form('taxable',is_null($o->taxable) ? TRUE : $o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
<?php echo Form::input('description',$o->description,array('class'=>'span5','label'=>'Description','placeholder'=>'Any notes about this charge?')); ?>
<?php echo Form::input('quantity',$o->quantity,array('class'=>'span1','label'=>'Quantity','placeholder'=>'Quantity')); ?>
<?php echo Form::input('amount',$o->amount,array('class'=>'span1','label'=>'Amount','placeholder'=>'Total',)); ?>
<?php echo StaticList_YesNo::form('taxable',is_null($o->taxable) ? TRUE : $o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
<?php echo Form::input('description',$o->description,array('class'=>'span5','label'=>'Description','placeholder'=>'Any notes about this charge?')); ?>
<!-- @todo Use JS to dynamically add more lines as required -->
<?php for ($i=0;$i<10;$i++) :
echo Form::input("attributes[$i]",isset($o->attributes[$i]) ? $o->attributes[$i] : "",array('class'=>'span5','label'=>'Attributes'));
endfor ?>
</fieldset>
<!-- @todo Use JS to dynamically add more lines as required -->
<?php for ($i=0;$i<10;$i++) :
echo Form::input("attributes[$i]",isset($o->attributes[$i]) ? $o->attributes[$i] : "",array('class'=>'span5','label'=>'Attributes'));
endfor ?>
</fieldset>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->

View File

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

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,38 +1,30 @@
<div class="row">
<div class="span9 offset1">
<div class="row">
<div class="span3">
<?php echo Form::input('name',$o->name,array('label'=>'Name','class'=>'span3')); ?>
</div>
</div> <!-- /row -->
<div class="span11">
<fieldset>
<legend>Update Template</legend>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
</div>
<?php echo Form::input('name',$o->name,array('label'=>'Name','class'=>'span3')); ?>
</div>
<div class="row">
<div class="span8">
<?php echo Form::textarea('notes',$o->notes,array('label'=>'Notes','class'=>'span8')); ?>
</div>
</div> <!-- /row -->
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Email Template Active','class'=>'span1')); ?>
</div>
<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 -->
<?php echo Form::textarea('notes',$o->notes,array('label'=>'Notes','class'=>'span8')); ?>
</div>
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
<div id="translate"></div>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</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,32 +1,34 @@
<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>
<tr>
<td><?php echo $elo->resolve('message_html'); ?></td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td><strong>To:</strong></td>
<td><?php printf('%s (%s)',$elo->account->name(),$elo->display('email')); ?></td>
</tr>
</div> <!-- /span -->
</div> <!-- /row -->
<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>
<tr>
<td><?php echo $elo->resolve('message_html'); ?></td>
</tr>
</table>
</td>
</tr>
</table>
</div> <!-- /span -->

View File

@ -1,21 +1,19 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Add Export Data Map</legend>
<div class="span11">
<fieldset>
<legend>Add Export Data Map</legend>
<?php echo Form::select('item_id',$o->list_itemsnoexport($module,$emo->id),NULL,array('label'=>'Product')); ?>
<?php echo Form::input('map_data[account]','Internet:ADSL Supply',array('label'=>'Accounting Code','placeholder'=>'Account Code')); ?>
<?php echo Form::input('map_data[item]','ADSL:ADSL2',array('label'=>'Inventory Code','placeholder'=>'Inventory Code')); ?>
<?php echo Form::select('item_id',$o->list_itemsnoexport($module,$emo->id),NULL,array('label'=>'Product')); ?>
<?php echo Form::input('map_data[account]','Internet:ADSL Supply',array('label'=>'Accounting Code','placeholder'=>'Account Code')); ?>
<?php echo Form::input('map_data[item]','ADSL:ADSL2',array('label'=>'Inventory Code','placeholder'=>'Inventory Code')); ?>
<?php echo Form::hidden('export_module_id',$emo->id); ?>
<?php echo Form::hidden('module_id',$module->mid()); ?>
<?php echo Form::hidden('export_module_id',$emo->id); ?>
<?php echo Form::hidden('module_id',$module->mid()); ?>
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span10 -->
</div> <!-- /row -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

@ -1,20 +1,18 @@
<div class="row">
<div class="span10 offset1">
<fieldset>
<legend>Export Module Update</legend>
<div class="span11">
<fieldset>
<legend>Export Module Update</legend>
<p>Available <?php echo $o->module->table_name(); ?> Columns to display</p>
<p>Available <?php echo $o->module->table_name(); ?> Columns to display</p>
<?php echo Table::factory()
->data($o->module->module()->table_columns())
->jssort(FALSE)
->columns(array(
'column_name'=>'Name',
))
->select(URL::link('reseller','export/export'),$o->id,array('export_module_id'=>$o->id))
->prepend(array(
'column_name'=>array('input'=>array('key'=>'display[__VALUE__]','values'=>$o->display)),
)); ?>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Table::factory()
->data($o->module->module()->table_columns())
->jssort(FALSE)
->columns(array(
'column_name'=>'Name',
))
->select(URL::link('reseller','export/export'),$o->id,array('export_module_id'=>$o->id))
->prepend(array(
'column_name'=>array('input'=>array('key'=>'display[__VALUE__]','values'=>$o->display)),
)); ?>
</fieldset>
</div> <!-- /span -->

View File

@ -91,19 +91,19 @@ class GoogleChart_Legacy extends GoogleChart {
/** CHART FIELDS **/
private function chd() {
$result = array();
private function chd() {
$result = array();
$maxes = $this->maxes();
// Perform our encoding
foreach ($this->_axis as $l => $axis)
array_push($result,$this->encode($this->_data[$l],$maxes[$axis]));
// Perform our encoding
foreach ($this->_axis as $l => $axis)
array_push($result,$this->encode($this->_data[$l],$maxes[$axis]));
$prefix = (count($maxes) > 1) ? sprintf('%s:',$this->axiscount('yl')) : ':';
$prefix = (count($maxes) > 1) ? sprintf('%s:',$this->axiscount('yl')) : ':';
// If encoding is text, we need to separate the series with a |
return ($this->_encodetype == 't') ? $prefix.implode('|',$result) : $prefix.implode(',',$result);
}
// If encoding is text, we need to separate the series with a |
return ($this->_encodetype == 't') ? $prefix.implode('|',$result) : $prefix.implode(',',$result);
}
private function chm() {
$result = array();

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,49 +4,49 @@
</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 if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<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)); ?>
<div class="plan-container">
<div class="plan">
<?php if (is_null($price)) continue; ?>
<div class="plan-header">
<?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<div class="plan-title">
<?php echo $po->title(); ?>
</div> <!-- /plan-title -->
<div class="plan-container">
<div class="plan">
<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>
</div> <!-- /plan-price -->
<div class="plan-header">
</div> <!-- /plan-header -->
<div class="plan-title">
<?php echo $po->title(); ?>
</div> <!-- /plan-title -->
<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>
</ul>
</div> <!-- /plan-features -->
<div class="plan-price">
<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 class="plan-actions">
<a href="<?php echo URL::site('product/view/'.$po->id); ?>" class="btn">More Information</a>
</div> <!-- /plan-actions -->
</div> <!-- /plan-header -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
<div class="plan-features">
<ul>
<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 -->
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
<div class="plan-actions">
<a href="<?php echo URL::site('product/view/'.$po->id); ?>" class="btn">More Information</a>
</div> <!-- /plan-actions -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</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,43 +1,43 @@
<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>
<td style="text-align: right; font-weight: bold">
<?php echo Company::instance()->name(); ?><br/>
<?php echo Company::instance()->taxid(); ?><br/>
<br/>
<?php echo Company::instance()->address(); ?><br/>
<br/>
<?php echo Company::instance()->contacts(); ?>
</td>
</tr>
</table>
</div> <!-- /row -->
</div> <!-- /span -->
<div class="span5">
<table>
<tr>
<td style="vertical-align: top"><?php echo HTML::image('http://www.gth.bgo.co/logo-blue'); ?></td>
<td style="text-align: right; font-weight: bold">
<?php echo Company::instance()->name(); ?><br/>
<?php echo Company::instance()->taxid(); ?><br/>
<br/>
<?php echo Company::instance()->address(); ?><br/>
<br/>
<?php echo Company::instance()->contacts(); ?>
</td>
</tr>
</table>
</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 class="span5">
<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> <!-- /span -->
</div>
@ -46,67 +46,60 @@
<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">
<h5>Reminder Details</h5>
<div class="span5">
<div class="row">
<div class="dl-horizontal pull-right">
<!-- Sub Total -->
<dt>Sub Total</dt>
<dd><?php echo $o->subtotal(TRUE); ?></dd>
<!-- END Invoice Sub Total -->
<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> <!-- /span -->
<!-- Invoice Credits -->
<?php if ($o->total_credits()) : ?>
<dt>Credits</dt>
<dd><?php echo $o->total_credits(TRUE); ?></dd>
<?php endif ?>
<!-- END Invoice Credits -->
<div class="span5">
<div class="dl-horizontal pull-right">
<!-- Sub Total -->
<dt>Sub Total</dt>
<dd><?php echo $o->subtotal(TRUE); ?></dd>
<!-- END Invoice Sub Total -->
<!-- Invoice Discounts Total -->
<?php if ($o->total_discounts()) : ?>
<dt>Discounts</dt>
<dd><?php echo $o->total_discounts(TRUE); ?></dd>
<?php endif ?>
<!-- END Invoice Discounts Total -->
<!-- Invoice Credits -->
<?php if ($o->total_credits()) : ?>
<dt>Credits</dt>
<dd><?php echo $o->total_credits(TRUE); ?></dd>
<?php endif ?>
<!-- END Invoice Credits -->
<!-- Invoice Taxes Total -->
<dt>Taxes Included:</dt>
<?php foreach ($o->tax_summary() as $tid => $amount) :
$m = ORM::factory('Tax',$tid); ?>
<dd><?php printf('%s (%s)',Currency::display($amount),$m->description); ?><dd>
<?php endforeach ?>
<!-- END Invoice Taxes Total -->
<!-- Invoice Discounts Total -->
<?php if ($o->total_discounts()) : ?>
<dt>Discounts</dt>
<dd><?php echo $o->total_discounts(TRUE); ?></dd>
<?php endif ?>
<!-- END Invoice Discounts Total -->
<!-- Invoice Total -->
<dt>Total Invoice:</dt>
<dd><?php echo $o->total(TRUE); ?></dd>
<!-- END Invoice Total -->
<!-- Invoice Taxes Total -->
<dt>Taxes Included:</dt>
<?php foreach ($o->tax_summary() as $tid => $amount) :
$m = ORM::factory('Tax',$tid); ?>
<dd><?php printf('%s (%s)',Currency::display($amount),$m->description); ?><dd>
<?php endforeach ?>
<!-- END Invoice Taxes Total -->
<!-- Account Total Due -->
<dt>Account Due:</dt>
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
<!-- END Account Total Due -->
<!-- Invoice Total -->
<dt>Total Invoice:</dt>
<dd><?php echo $o->total(TRUE); ?></dd>
<!-- END Invoice Total -->
</div>
</div> <!-- /row -->
</div> <!-- /span -->
<!-- Account Total Due -->
<dt>Account Due:</dt>
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
<!-- END Account Total Due -->
</div>
</div> <!-- /span -->
</div>

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

View File

@ -11,7 +11,7 @@
* @license http://dev.osbill.net/license.html
*/
abstract class Auth extends Kohana_Auth {
public static function instance($type=NULL) {
public static function instance($type=NULL) {
if (is_null($type) OR (! $type instanceof Model_Oauth))
return parent::instance();

View File

@ -37,9 +37,9 @@ class Auth_Facebook extends Auth_ORM_External {
// Create new Facebook object
$this->ao = new Facebook(array(
'appId' => $oo->app_id,
'secret' => $oo->secret,
'cookie' => $this->config->cookie,
'appId' => $oo->app_id,
'secret' => $oo->secret,
'cookie' => $this->config->cookie,
'session_type' => $this->config->session_type,
));

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,23 +1,21 @@
<div class="row">
<div class="span9 offset1">
<div class="span11">
<fieldset>
<legend>Payment Details</legend>
<fieldset>
<legend>Payment Details</legend>
<div class="input-append date" id="date_payment_label">
<?php echo Form::input('date_payment_label',$o->display('date_payment'),array('class'=>'span2','label'=>'Date Paid','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<div class="input-append date" id="date_payment_label">
<?php echo Form::input('date_payment_label',$o->display('date_payment'),array('class'=>'span2','label'=>'Date Paid','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
<?php echo Form::select('checkout_id',ORM::factory('Checkout')->list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?>
<?php echo Form::input('total_amt',$o->total_amt,array('class'=>'span2','label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?>
<?php echo Form::input('fees_amt',$o->fees_amt,array('class'=>'span2','label'=>'Fees','placeholder'=>'Fees')); ?>
<?php echo Form::input('account_id_label',$o->account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?>
<?php echo Form::hidden('account_id',$o->account_id); ?>
<?php echo Form::input('notes',$o->notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
</fieldset>
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
<?php echo Form::select('checkout_id',ORM::factory('Checkout')->list_select(),$o->checkout_id,array('label'=>'Payment Method','required')); ?>
<?php echo Form::input('total_amt',$o->total_amt,array('class'=>'span2','label'=>'Amount','placeholder'=>'Total','help-block'=>sprintf('Credits: %s, Balance: %s',$o->credit(),$o->total()))); ?>
<?php echo Form::input('fees_amt',$o->fees_amt,array('class'=>'span2','label'=>'Fees','placeholder'=>'Fees')); ?>
<?php echo Form::input('account_id_label',$o->account->name(),array('class'=>'span5','label'=>'Account','placeholder'=>'Account','data-provide'=>'typeahead')); ?>
<?php echo Form::hidden('account_id',$o->account_id); ?>
<?php echo Form::input('notes',$o->notes,array('class'=>'span5','label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
</fieldset>
<div class="span8" id="items"</div>
<td><div id='items'></div></td>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->

View File

@ -1,13 +1,11 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Ezypay Payment</legend>
<div class="span11">
<fieldset>
<legend>Ezypay Payment</legend>
<?php echo Form::hidden('payer',$_POST['payer']); ?>
<?php echo Form::file('transaction',array('label'=>'Transaction File','required','help-block'=>'AddItems')); ?>
<?php echo Form::file('payment',array('label'=>'Payment File','required','help-block'=>'BillDetails')); ?>
</fieldset>
<?php echo Form::hidden('payer',$_POST['payer']); ?>
<?php echo Form::file('transaction',array('label'=>'Transaction File','required','help-block'=>'AddItems')); ?>
<?php echo Form::file('payment',array('label'=>'Payment File','required','help-block'=>'BillDetails')); ?>
</fieldset>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->

View File

@ -1,18 +1,16 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Bulk Payment Details</legend>
</fieldset>
<div class="span11">
<fieldset>
<legend>Bulk Payment Details</legend>
</fieldset>
<div class="dl-horizontal">
<dt>Total</dt>
<dd><?php echo $total; ?></dd>
<div class="dl-horizontal">
<dt>Total</dt>
<dd><?php echo $total; ?></dd>
<dt>Fees</dt>
<dd><?php echo $fee; ?></dd>
<dt>Fees</dt>
<dd><?php echo $fee; ?></dd>
<dt>Payments</dt>
<dd><?php echo $table; ?></dd>
</div> <!-- /dl-horizontal -->
</div> <!-- /span -->
</div> <!-- /row -->
<dt>Payments</dt>
<dd><?php echo $table; ?></dd>
</div> <!-- /dl-horizontal -->
</div> <!-- /span -->

View File

@ -1,16 +1,17 @@
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Invoice</th>
<th>Date Issue</th>
<th>Date Due</th>
<th class="text-right">Total</th>
<th class="text-right">Payments</th>
<th class="text-right">Due</th>
<th class="text-right">Alloc</th>
</tr>
</thead>
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Invoice</th>
<th>Date Issue</th>
<th>Date Due</th>
<th class="text-right">Total</th>
<th class="text-right">Payments</th>
<th class="text-right">Due</th>
<th class="text-right">Alloc</th>
</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>
@ -22,10 +23,10 @@
<td class="text-right"><?php echo Form::input('payment_item['.$pio->invoice_id.']',$pio->display('alloc_amt'),array('class'=>'span1','nocg'=>TRUE,'tabindex'=>++$c)); ?></td>
</tr>
<?php endforeach ?>
<tr>
<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,76 +1,70 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Update Product</legend>
<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) : ?>
<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>
<?php endforeach ?>
</ul>
<?php endforeach ?>
</ul>
<div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<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) : ?>
<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 Form::input("price_group[$k][$g][$po]",$o->price($g,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?>
<?php foreach (ORM::factory('Group')->list_pricegroups() as $go) : ?>
<div class="row">
<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][{$go->id}][{$o->price_option($po)}]",$o->price($go->id,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?>
</div>
<?php endforeach ?> <!-- /price_options() -->
</div>
<?php endforeach ?> <!-- /availPriceOptions() -->
</div>
<?php endforeach ?> <!-- /availPriceGroups() -->
<?php endforeach ?> <!-- /list_pricegroups() -->
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<br>
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div>
</div>
</div> <!-- /tabbable -->
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?></td>
</div>
</div> <!-- /row -->
<br>
<div class="row">
<div class="span3">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div>
<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 -->
<div class="row">
<?php echo StaticList_RecurSchedule::form('price_recurr_default',$o->price_recurr_default,FALSE,array('label'=>'Default Period','class'=>'span2')); ?></td>
</div> <!-- /row -->
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?>
</div> <!-- /row -->
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
<div class="row">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div> <!-- /row -->
</fieldset>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
<div id="translate"></div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</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,36 +1,31 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Update Category</legend>
<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">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</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">
<?php echo Form::select('template',$o->templates(),$o->template,array('label'=>'List Template')); ?>
</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 -->
<div class="row">
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Show Pricing Schedule','required'));?>
</div> <!-- /row -->
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<div class="row">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div> <!-- /row -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
</fieldset>
<div id="translate"></div>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</div> <!-- /span -->

View File

@ -5,23 +5,21 @@
</div>
<?php $c=0;foreach ($o->subcategories->find_all() as $pco) : ?>
<?php if (! ($c++%3) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row divider service-container">
<?php if (! ($c++%3) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row divider service-container">
<div class="grid-3">&nbsp;</div>
<?php endif ?>
<div class="grid-3">
&nbsp;
<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 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(); ?>
<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 class="span9">
<?php echo $o->description(TRUE); ?>
</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,22 +305,25 @@ $(document).ready(function() {
$iio->date_start=$pdata['start_time'];
}
if ($iio->date_stop != $pdata['end_time']) {
if (! $pr AND $iio->date_stop != $pdata['end_time']) {
$doutput .= sprintf('%s: Set end_time: %s [%s] <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']))

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() {
var x=0;
$("button[name=submit]").click(function() {
var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; }
$.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) {
$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); });
}).error(function() { alert("There was a problem with the request"); return false; }).success(
function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
});
});'
));
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
var x=0;
$("button[name=submit]").click(function() {
var t=$(this).val().split(":");
if (x++) { alert("Session expired, please refresh the page!"); return false; }
$.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$x.'",t: t[1] },
function(data) {$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); })
.error(function() { alert("There was a problem with the request"); return false; })
.success(function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
});
});'
);
}
return TRUE;
}
@ -109,5 +100,23 @@ function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
public function service_name() {
return sprintf('%s - %s',$this->service->product->title(),$this->name());
}
/**
* Get specific service details for use in other modules
* For Example: Invoice
*
* @todo Make the rendered items configurable
* @todo Change this method name, now that it is public
*/
public function _details($type) {
switch ($type) {
// Nothing to add for invoices
case 'invoice_detail_items':
return array();
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
}
?>

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,54 +1,42 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Update Service</legend>
<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">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</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">
<?php echo StaticList_RecurSchedule::form('recur_schedule',$o->recur_schedule,FALSE,array('label'=>'Billing Period','required'));?>
</div> <!-- /row -->
<div class="row">
<div class="span5 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>
<?php echo Form::hidden('date_next_invoice',$o->date_next_invoice); ?>
</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 -->
<?php if ($plugin_form) { echo $plugin_form; } ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
<div class="row">
<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>
</fieldset>
</div> <!-- /span -->
</div> <!-- /row -->
<?php echo Form::hidden('date_next_invoice',$o->date_next_invoice); ?>
</div> <!-- /row -->
<div class="row">
<?php echo StaticList_YesNo::form('taxable',$o->taxable,FALSE,array('label'=>'Taxable','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo StaticList_YesNo::form('suspend_billing',$o->suspend_billing,FALSE,array('label'=>'Suspend Billing','class'=>'span1')); ?>
</div> <!-- /row -->
<div class="row">
<?php echo Form::input('price_override',$o->price_override,array('label'=>'Override Price','class'=>'span1')); ?>
</div> <!-- /row -->
</fieldset>
<?php if ($plugin_form) { echo $plugin_form; } ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</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">
<th>ID</th>
<th>Invoice</th>
<th>Product</th>
<th>IT</th>
<th>RS</th>
<th>Start</th>
<th>Stop</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>
<th colspan="9"><?php echo $iio->product->title(); ?></th>
</tr>
<?php } ?>
<tr class="list-data">
<td class="id"><?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><?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 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>IT</th>
<th>RS</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>
</tr>
</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 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('item_type'); ?></td>
<td><?php echo $iio->display('recurring_schedule'); ?></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>
</tr>
<?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,103 +32,109 @@
<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 -->
<?php if ($o->service_billing->loaded()) : ?>
<div class="span5">
<fieldset>
<legend>Automatic Payment Details</legend>
<div class="row">
<?php if ($o->service_billing->loaded()) : ?>
<fieldset class="span5">
<legend>Automatic Payment Details</legend>
<div class="dl-horizontal">
<dt>Direct Payment</dt>
<dd><?php echo $o->service_billing->checkout->display('name'); ?></dd>
</div> <!-- /dl-horizontal -->
</fieldset>
</div> <!-- /span -->
<?php endif ?>
<dt><?php echo $o->service_billing->checkout->display('name'); ?></dt>
<dd>&nbsp;</dd>
<?php if ($o->charges()) : ?>
<div class="span5">
<fieldset>
<legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend>
</fieldset>
<?php endif ?>
<?php echo Table::factory()
->data($o->charge_list(TRUE))
->columns(array(
'date_orig'=>'Date',
'description'=>'Description',
'total(TRUE)'=>'Amount',
)); ?>
</fieldset>
</div> <!-- /span -->
<?php endif ?>
<?php if ($o->charges()) : ?>
<fieldset class="span5">
<legend>Service Charges to Bill: <?php echo $o->charges(TRUE,TRUE); ?></legend>
<?php if ($o->status) : ?>
<div class="span5">
<fieldset>
<legend>Next Invoice Charges</legend>
<?php echo Table::factory()
->data($o->charge_list(TRUE))
->columns(array(
'date_orig'=>'Date',
'description'=>'Description',
'total(TRUE)'=>'Amount',
)); ?>
<?php echo Invoice::instance()->add_service($o)->render('html','body',array('noid'=>TRUE)); ?>
</fieldset>
</div> <!-- /span -->
<?php endif ?>
</fieldset>
<?php endif ?>
<fieldset class="span5">
<div class="span5">
<fieldset>
<legend>Invoices for this Service</legend>
<?php echo Table::factory()
->data($o->invoice_list())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'due_date'=>'Due',
'total(TRUE)'=>'Amount',
'total(TRUE)'=>'Amount',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
)); ?>
</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">
<legend>Service Memos</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->name()'=>'Account',
'memo'=>'Memo',
)); ?>
</fieldset>
</div> <!-- /row -->
<div class="span5">
<fieldset>
<legend>Service Memos</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->name()'=>'Account',
'memo'=>'Memo',
)); ?>
</fieldset>
</div> <!-- /span -->
<?php endif ?>
<?php $x=$o->email()->find_all(); if ($x->count()) : ?>
<div class="row">
<fieldset class="span5">
<legend>Emails about this service</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>45),
)); ?>
</fieldset>
</div> <!-- /row -->
<div class="span5">
<fieldset>
<legend>Emails about this service</legend>
<?php echo Table::factory()
->data($x)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>45),
)); ?>
</fieldset>
</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,57 +1,60 @@
<fieldset class="span5">
<legend>Service Details</legend>
<div class="span5">
<fieldset>
<legend>Service Details</legend>
<div class="dl-horizontal">
<div class="dl-horizontal">
<dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd>
<dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd>
<dt>Serial Number</dt>
<dd><?php echo $o->serial(); ?></dd>
<dt>Serial Number</dt>
<dd><?php echo $o->serial(); ?></dd>
<dt>Subject Key Id</dt>
<dd><?php echo $o->ski(); ?></dd>
<dt>Subject Key Id</dt>
<dd><?php echo $o->ski(); ?></dd>
<dt>Issuer</dt>
<dd>
<?php if ($o->validCA() AND $o->authorised($o->ca)) : ?>
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->ca->id,$o->issuer()); ?>
<?php else : ?>
<?php echo $o->issuer(); ?>
<?php endif ?>
</dd>
<dt>Issuer</dt>
<dd>
<?php if ($o->validCA() AND $o->authorised($o->ca)) : ?>
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->ca->id,$o->issuer()); ?>
<?php else : ?>
<?php echo $o->issuer(); ?>
<?php endif ?>
</dd>
<dt>Issuer Serial</dt>
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
<dt>Issuer Serial</dt>
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
<dt>Valid From</dt>
<dd><?php echo $o->valid_from(TRUE); ?></dd>
<dt>Valid From</dt>
<dd><?php echo $o->valid_from(TRUE); ?></dd>
<dt>Valid To</dt>
<dd><?php echo $o->valid_to(TRUE); ?></dd>
<dt>Valid To</dt>
<dd><?php echo $o->valid_to(TRUE); ?></dd>
<dt>Hash</dt>
<dd><?php echo $o->hash(); ?></dd>
<dt>Hash</dt>
<dd><?php echo $o->hash(); ?></dd>
<dt>Version</dt>
<dd><?php echo $o->version(); ?></dd>
<dt>Version</dt>
<dd><?php echo $o->version(); ?></dd>
<dt>Algorithm</dt>
<dd><?php echo $o->algorithm(); ?></dd>
<dt>Algorithm</dt>
<dd><?php echo $o->algorithm(); ?></dd>
</div> <!-- dl-horizontal -->
</fieldset>
</div> <!-- /span -->
</div> <!-- dl-horizontal -->
</fieldset>
<div class="span6">
<fieldset>
<legend>Certificate</legend>
<pre><?php echo $o->cert; ?></pre>
<fieldset class="span6">
<legend>Certificate</legend>
<pre><?php echo $o->cert; ?></pre>
<?php
echo $o->download_button();
if ($ao=Auth::instance()->get_user() AND ($ao->isAdmin() OR $ao->isReseller()) AND $o->service->status AND ($o->valid_to()-(Kohana::$config->load('ssl.min_renew_days')*86400) <= time()) AND $o->service->paid_to() > time()) :
echo Form::open(URL::link('reseller','ssl/renew/'.$o->service->id));
echo Form::button('submit','Renew',array('class'=>'btn btn-primary'));
endif
?>
<?php
echo $o->download_button();
if ($ao=Auth::instance()->get_user() AND ($ao->isAdmin() OR $ao->isReseller()) AND $o->service->status AND ($o->valid_to()-(Kohana::$config->load('ssl.min_renew_days')*86400) <= time()) AND $o->service->paid_to() > time()) :
echo Form::open(URL::link('reseller','ssl/renew/'.$o->service->id));
echo Form::button('submit','Renew',array('class'=>'btn btn-primary'));
endif
?>
</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::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 -->
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->

View File

@ -14,7 +14,7 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault {
* By default show a menu of available categories
*/
public function action_index() {
HTTP::redirect('staticpage_category/list');
HTTP::redirect('staticpage_category/list');
}
public function action_list() {

View File

@ -24,7 +24,7 @@ class Controller_Admin_Task extends Controller_Task {
->title(_('Task Log'))
->title_icon('icon-th-list')
->body(Table::factory()
->page_items(50)
->page_items(50)
->data(ORM::factory('Task_Log')->find_all())
->columns(array(
'id'=>'ID',
@ -32,8 +32,7 @@ class Controller_Admin_Task extends Controller_Task {
'task->display("name")'=>'Task',
'result'=>'Result',
'message'=>'Message',
))
);
)));
}
}
?>

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;