From 8bd409d86f936cb9e3c3cbcaeeb023fdf9922119 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 22 Sep 2016 10:19:19 +1000 Subject: [PATCH] Some fixes as a result of prior commit changing status to active --- .../classes/Model/Service/Plugin/Adsl.php | 2 +- .../classes/Model/Service/Plugin/Domain.php | 2 +- .../classes/Model/Service/Plugin/Host.php | 2 +- modules/invoice/classes/Invoice.php | 4 ++- .../invoice/classes/Model/Invoice/Item.php | 2 +- .../classes/Controller/Admin/Payment.php | 1 + .../Controller/Admin/Product/Category.php | 34 +++++++++++++++++++ .../ssl/classes/Model/Service/Plugin/Ssl.php | 2 +- 8 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 modules/product/classes/Controller/Admin/Product/Category.php diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php index 2b9f9759..5b86a17d 100644 --- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php @@ -455,7 +455,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin { ->join('service') ->on('service.id','=',$this->_table_name.'.service_id') ->where('service.account_id','IN',$ao->RTM->customers($ao->RTM)) - ->and_where('service.status','=',1) + ->and_where('service.active','=',1) ->where_open() ->and_where($this->_table_name.'.service_number','like','%'.$term.'%') ->or_where($this->_table_name.'.service_address','like','%'.$term.'%') diff --git a/modules/domain/classes/Model/Service/Plugin/Domain.php b/modules/domain/classes/Model/Service/Plugin/Domain.php index f5f82801..6351c2af 100644 --- a/modules/domain/classes/Model/Service/Plugin/Domain.php +++ b/modules/domain/classes/Model/Service/Plugin/Domain.php @@ -89,7 +89,7 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin { ->join('service') ->on('service.id','=',$this->_table_name.'.service_id') ->where('service.account_id','IN',$ao->RTM->customers($ao->RTM)) - ->and_where('service.status','=',1) + ->and_where('service.active','=',1) ->and_where($this->_table_name.'.domain_name','like','%'.$term.'%'); return parent::list_autocomplete($term,$index,$value,$label,$limit,$options); diff --git a/modules/host/classes/Model/Service/Plugin/Host.php b/modules/host/classes/Model/Service/Plugin/Host.php index c49344f9..9865ed91 100644 --- a/modules/host/classes/Model/Service/Plugin/Host.php +++ b/modules/host/classes/Model/Service/Plugin/Host.php @@ -90,7 +90,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin { ->join('service') ->on('service.id','=',$this->_table_name.'.service_id') ->where('service.account_id','IN',$ao->RTM->customers($ao->RTM)) - ->and_where('service.status','=',1) + ->and_where('service.active','=',1) ->and_where($this->_table_name.'.domain_name','like','%'.$term.'%'); return parent::list_autocomplete($term,$index,$value,$label,$limit,$options); diff --git a/modules/invoice/classes/Invoice.php b/modules/invoice/classes/Invoice.php index a753be05..e489e0b7 100644 --- a/modules/invoice/classes/Invoice.php +++ b/modules/invoice/classes/Invoice.php @@ -65,6 +65,7 @@ class Invoice { $iio->recurring_schedule = $so->recur_schedule; $iio->date_start = $pdata['start_time']; $iio->date_stop = $pdata['end_time']; + $iio->active = TRUE; // Service Billing $iio->item_type = 0; @@ -88,6 +89,7 @@ class Invoice { $iio->date_start = $co->date_orig; $iio->date_stop = $co->date_orig; $iio->item_type = $co->type; + $iio->active = TRUE; $this->_io->add_sub_item($iio); } @@ -139,7 +141,7 @@ class Invoice { switch ($section) { case 'all': $token = ORM::factory('Module_Method_Token') - ->method(array('invoice','user_download')) + ->method(array('invoice','user:download')) ->account($this->_io->account) ->expire(time()+86400*21) ->uses(3) diff --git a/modules/invoice/classes/Model/Invoice/Item.php b/modules/invoice/classes/Model/Invoice/Item.php index fc70f6e6..e5a7537f 100644 --- a/modules/invoice/classes/Model/Invoice/Item.php +++ b/modules/invoice/classes/Model/Invoice/Item.php @@ -253,7 +253,7 @@ class Model_Invoice_Item extends ORM { // This total of this item before discounts and taxes public function subtotal($format=FALSE) { - $result = Currency::round($this->price_base*$this->quantity); + $result = $this->price_base*$this->quantity; return $format ? Currency::display($result) : $result; } diff --git a/modules/payment/classes/Controller/Admin/Payment.php b/modules/payment/classes/Controller/Admin/Payment.php index 5ed96955..eed40a4f 100644 --- a/modules/payment/classes/Controller/Admin/Payment.php +++ b/modules/payment/classes/Controller/Admin/Payment.php @@ -107,6 +107,7 @@ class Controller_Admin_Payment extends Controller_Payment { $pio->invoice_id = $k; $pio = $po->add_item($pio); + $v = str_replace(',','',$v); $pio->alloc_amt = is_numeric($v) ? $v : 0; } diff --git a/modules/product/classes/Controller/Admin/Product/Category.php b/modules/product/classes/Controller/Admin/Product/Category.php new file mode 100644 index 00000000..2729b49f --- /dev/null +++ b/modules/product/classes/Controller/Admin/Product/Category.php @@ -0,0 +1,34 @@ +FALSE, + ); + + /** + * Show a list of products + */ + public function action_list() { + $this->meta->title = 'A|Product Category List'; + + $o = ORM::factory('Product_Category')->find_all()->as_array(); + Sort::MASort($o,array('name()')); + + Block::factory() + ->title('Product Categories') + ->title_icon('fa fa-list') + ->body(View::factory('product/category/list')->set('o',$o)); + } +} +?> diff --git a/modules/ssl/classes/Model/Service/Plugin/Ssl.php b/modules/ssl/classes/Model/Service/Plugin/Ssl.php index 514e8a3b..428f2584 100644 --- a/modules/ssl/classes/Model/Service/Plugin/Ssl.php +++ b/modules/ssl/classes/Model/Service/Plugin/Ssl.php @@ -125,7 +125,7 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin { } public function download_button() { - if (! $this->pk OR ! $this->service->status OR ! preg_match('/client/',$this->service->product->plugin()->extensions) OR $this->valid_to() < time()) + if (! $this->pk OR ! $this->service->active OR ! preg_match('/client/',$this->service->product->plugin()->extensions) OR $this->valid_to() < time()) return ''; $output = Form::open(URL::link('user','ssl/download'),array('class'=>'form-inline'));