diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php index 7460c909..747a42ae 100644 --- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php @@ -27,6 +27,9 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin { 'service_connect_date'=>array( array('Config::date',array(':value')), ), + 'service_contract_date'=>array( + array('Config::date',array(':value')), + ), ); // Required abstract functions @@ -76,11 +79,11 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin { } public function contract_date_start() { - return Config::date($this->service_connect_date); + return Config::date($this->service_contract_date); } public function contract_date_end() { - return Config::date(strtotime(sprintf('+%s months',$this->contract_term),$this->service_connect_date)); + return Config::date(strtotime(sprintf('+%s months',$this->contract_term),$this->service_contract_date)); } public function hasOffpeak() { diff --git a/modules/adsl/views/service/admin/adsl/update.php b/modules/adsl/views/service/admin/adsl/update.php index b41b588a..5be29853 100644 --- a/modules/adsl/views/service/admin/adsl/update.php +++ b/modules/adsl/views/service/admin/adsl/update.php @@ -21,6 +21,16 @@ + + Service Contract Date + + service_contract_date,array('id'=>'service_contract_date')); ?> + uri(array('file'=>'img/calendar.png')),array('alt'=>_('Calendar'),'style'=>'cursor: pointer;')), + array('title'=>'Click to popup a dialog to select a date graphically','onclick'=>"dateSelector('service_contract_date')")); ?> + + + Service Username service_username); ?> diff --git a/modules/product/classes/Controller/Admin/Product.php b/modules/product/classes/Controller/Admin/Product.php index 1ca43eea..39d49cc9 100644 --- a/modules/product/classes/Controller/Admin/Product.php +++ b/modules/product/classes/Controller/Admin/Product.php @@ -49,7 +49,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin { $prods, 25, array( - 'id'=>array('label'=>'ID','url'=>'product/view/'), + 'id'=>array('label'=>'ID','url'=>'admin/product/view/'), 'name()'=>array('label'=>'Details'), 'status'=>array('label'=>'Active'), 'prod_plugin_file'=>array('label'=>'Plugin Name'), @@ -62,7 +62,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin { array( 'page'=>TRUE, 'type'=>'select', - 'form'=>'product/view', + 'form'=>'admin/product/view', )), )); } diff --git a/modules/service/classes/Controller/Admin/Service.php b/modules/service/classes/Controller/Admin/Service.php index e336c3db..03aecb4d 100644 --- a/modules/service/classes/Controller/Admin/Service.php +++ b/modules/service/classes/Controller/Admin/Service.php @@ -51,7 +51,8 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { $svs = ORM::factory('Service')->list_bylistgroup('ADSL'); $data = $this->consoltraffic($svs,time()); - $google = GoogleChart::factory('ComboChart'); + $google = GoogleChart::factory('ComboChart') + ->stacked(TRUE); foreach ($data['data'] as $key => $values) $google->sdata(array('yl'=>$key),array($key=>$values)); @@ -492,7 +493,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { ->rule('csv','Upload::size',array(':value','10M')); if ($files->check()) - foreach ($files as $file) + foreach ($files->data() as $file) $csv = $this->process($file); } diff --git a/modules/service/classes/Model/Service.php b/modules/service/classes/Model/Service.php index e0be10d5..51e84571 100644 --- a/modules/service/classes/Model/Service.php +++ b/modules/service/classes/Model/Service.php @@ -22,6 +22,7 @@ class Model_Service extends ORM_OSB { protected $_has_many = array( 'invoice_item'=>array('far_key'=>'id'), 'invoice'=>array('through'=>'invoice_item'), + 'service_change'=>array('far_key'=>'id'), ); protected $_belongs_to = array( 'product'=>array(), @@ -75,6 +76,10 @@ class Model_Service extends ORM_OSB { return is_null($plugin=$this->plugin()) ? $this->product->name() : $plugin->name(); } + public function pending_change() { + return count($this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find_all()->as_array()); + } + /** * Display how much is due on this service */ diff --git a/modules/service/classes/Model/Service/Change.php b/modules/service/classes/Model/Service/Change.php new file mode 100644 index 00000000..455c14e4 --- /dev/null +++ b/modules/service/classes/Model/Service/Change.php @@ -0,0 +1,49 @@ +array(), + 'service'=>array(), + ); + + /** + * Filters used to format the display of values into friendlier values + */ + protected $_display_filters = array( + 'date_ordered'=>array( + array('Config::date',array(':value')), + ), + 'date_effective'=>array( + array('Config::date',array(':value')), + ), + ); + + public function list_details() { + if ($this->_db_pending) { + $output = array(); + + foreach ($this->find_all() as $sco) { + array_push($output,sprintf('%s %s',$sco->product->name(),$sco->display('date_effective'))); + } + + } else { + throw new Kohana_Exception('Shouldnt be here!'); + } + + return join('|',$output); + } +} +?> diff --git a/modules/service/views/service/admin/view.php b/modules/service/views/service/admin/view.php index 551314f3..8c49fb65 100644 --- a/modules/service/views/service/admin/view.php +++ b/modules/service/views/service/admin/view.php @@ -1,3 +1,7 @@ +pending_change()) {?> +Pending change to: service_change->list_details(); ?> + +
diff --git a/modules/service/views/service/user/view.php b/modules/service/views/service/user/view.php index 69497d05..64f45cba 100644 --- a/modules/service/views/service/user/view.php +++ b/modules/service/views/service/user/view.php @@ -18,7 +18,7 @@ - + price) OR ($so->price<=$so->product->price($so->price_group,$so->recur_schedule,'price_base'))) { ?>
Costprice(TRUE,TRUE); ?>price(TRUE,TRUE); if ($so->pending_change()) echo ' *'; ?>