diff --git a/.htaccess b/.htaccess index c8dada9c..fd84b8dc 100644 --- a/.htaccess +++ b/.htaccess @@ -13,6 +13,8 @@ RewriteBase / # Protect application and system files from being viewed RewriteRule ^(?:application|modules|includes/kohana)\b.* index.php/$0 [L] +RewriteRule ^nbn$ /product/category/21 [R,L] + # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d diff --git a/application/classes/Controller/Direct.php b/application/classes/Controller/Direct.php new file mode 100644 index 00000000..5a54eada --- /dev/null +++ b/application/classes/Controller/Direct.php @@ -0,0 +1,23 @@ +action_adsl(); + } + + public function action_adsl() { + $this->template->content = ''; + } +} +?> diff --git a/application/classes/Controller/Reseller/Welcome.php b/application/classes/Controller/Reseller/Welcome.php index 713929ef..d6081683 100644 --- a/application/classes/Controller/Reseller/Welcome.php +++ b/application/classes/Controller/Reseller/Welcome.php @@ -37,11 +37,13 @@ class Controller_Reseller_Welcome extends Controller_Welcome { ->span(6) ->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_due($t))); +/* Block::factory() ->title('Un-applied payments') ->title_icon('fa fa-money') ->span(6) ->body(View::factory('payment/list')->set('o',ORM::factory('Payment')->where_authorised()->list_unapplied())); +*/ } /** diff --git a/application/config/config.php b/application/config/config.php index 8dc487a8..c48d7d42 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -11,7 +11,7 @@ */ return array( - 'appname' => 'OS Billing', // Our application name, as shown in the title bar of pages + 'appname' => 'Graytech Billing', // Our application name, as shown in the title bar of pages 'email_from' => array('noreply@graytech.net.au'=>'Graytech Hosting'), 'method_security' => TRUE, // Enables Method Security. Setting to false means any method can be run without authentication 'session_change_trigger'=>array( // Updates to tables to make when our session ID is changed diff --git a/application/config/database.php b/application/config/database.php index 30faa4b1..89f675b3 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -28,10 +28,10 @@ return array * Ports and sockets may be appended to the hostname. */ 'hostname' => 'localhost', - 'username' => 'username', - 'password' => 'password', + 'username' => 'gh-webbill', + 'password' => 'ws0593', 'persistent' => FALSE, - 'database' => 'database', + 'database' => 'webghosb', ), 'table_prefix' => 'ab_', 'charset' => 'utf8', @@ -50,9 +50,9 @@ return array * string password database password * boolean persistent use persistent connections? */ - 'dsn' => 'mysql:host=localhost;dbname=database', - 'username' => 'username', - 'password' => 'password', + 'dsn' => 'mysql:host=localhost;dbname=webghosb', + 'username' => 'gh-webbill', + 'password' => 'ws0593', 'persistent' => FALSE, ), /** @@ -67,9 +67,9 @@ return array 'default' => array( 'type' => 'MySQLi', 'connection' => array( - 'hostname' => 'localhost', - 'username' => 'username', - 'password' => 'password', + 'hostname' => 'database', + 'username' => 'web', + 'password' => 'uva%Cn8B', 'persistent' => FALSE, 'database' => 'database', 'ssl' => NULL, diff --git a/application/config/debug.php b/application/config/debug.php index e486a0de..30411359 100644 --- a/application/config/debug.php +++ b/application/config/debug.php @@ -12,13 +12,14 @@ return array ( + 'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE 'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item 'disabled_noaccess_redirect'=>FALSE, // Disable redirect when noaccess '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', + 'deon@graytech.net.au'=>'Deon George', ), 'invoice'=>0, // Number of invoices to generate in a pass 'show_errors'=>FALSE, // Show errors instead of logging in the DB. diff --git a/application/config/url.php b/application/config/url.php index 487dad39..cde31fc8 100644 --- a/application/config/url.php +++ b/application/config/url.php @@ -12,6 +12,8 @@ return array( 'trusted_hosts' => array( + '.*\.graytech\.net\.au', + 'graytech\.net\.au', ), ); ?> diff --git a/application/media/site/1/theme/focusbusiness/img/footer-logo.png b/application/media/site/1/theme/focusbusiness/img/footer-logo.png new file mode 100644 index 00000000..08a1ad9e Binary files /dev/null and b/application/media/site/1/theme/focusbusiness/img/footer-logo.png differ diff --git a/application/media/site/1/theme/focusbusiness/img/title.png b/application/media/site/1/theme/focusbusiness/img/title.png new file mode 100644 index 00000000..7dabc2a6 Binary files /dev/null and b/application/media/site/1/theme/focusbusiness/img/title.png differ diff --git a/application/media/site/1/theme/yaml/img/logo-small.png b/application/media/site/1/theme/yaml/img/logo-small.png new file mode 100644 index 00000000..08a1ad9e Binary files /dev/null and b/application/media/site/1/theme/yaml/img/logo-small.png differ diff --git a/application/views/site/1/theme/focusbusiness/pages/welcome.php b/application/views/site/1/theme/focusbusiness/pages/welcome.php new file mode 100644 index 00000000..f637a04c --- /dev/null +++ b/application/views/site/1/theme/focusbusiness/pages/welcome.php @@ -0,0 +1,81 @@ + +
+
+
+

Graytech Hosting is an Australian based Internet Solutions provider.

+
+
+ +
+ +
+
+

// Our Services

+
+ +
+
+

Website Hosting

+

Graytech Hosting can host your website on our enterprise servers for the fraction of a cost of many providers.

+

Your website will be hosted on Australian based servers, providing the best access experience for your audience.

+

See Our Plans »

+
+
+ +
+
+

Domain Names

+

Register your .AU, .COM, .NET (or something else) domain with Graytech Hosting.

+

We'll take away the complications of getting you visible on the Internet with an available Internet Name that suits your requirements.

+

Register a Domain Name »

+
+
+ + +
+ +
+ +
+
+

// Our Story

+
+ +
+
+

About Us

+

Graytech Hosting was established in 2003 providing Virtual Private Networks over the Internet to customers with distributed offices.

+

Today our portfolio includes many customers all over Australia, using our Hosting and Email Products.

+
+
+ +
+
+

Why Choose Us

+
+

Competive Pricing

+

We constantly revise our supplier list providing the most competitive pricing. While we make improvements in the background, you still continue to receive the same great service and with competitive pricing.

+
+ +
+

Support Local Bendigo Customers

+

We are based in Bendigo Victoria, so we support many local Bendigo Customers and Business get online.

+
+ +
+

We partner with Graytech Computers

+

We partner with Graytech Computers to provide you with your End-to-End Computing and Internet requirements.

+
+
+
+
+
diff --git a/application/views/theme/baseadmin/page.php b/application/views/theme/baseadmin/page.php deleted file mode 100644 index 0d4f4da3..00000000 --- a/application/views/theme/baseadmin/page.php +++ /dev/null @@ -1,127 +0,0 @@ - - - - <?php echo Site::Appname(); ?> - - - - - - - - - - - - = Kohana::TESTING OR Request::current()->secure()) { - echo HTML::style('media/theme/bootstrap/css/bootstrap.min.css'); - echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css'); - echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css'); - } else { - echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css')); - echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css')); - echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css')); - } - - echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800')); - echo HTML::style('media/css/ui-lightness/jquery-ui-1.10.0.custom.min.css'); - echo HTML::style('media/theme/baseadmin/css/base-admin-2.css'); - echo HTML::style('media/theme/baseadmin/css/base-admin-2-responsive.css'); - echo HTML::style('media/theme/baseadmin/css/custom.css'); - echo Style::factory()->render_all(); - ?> - - - - - - - - - -
-
-
-
- render_all(); ?> -
-
-
-
- -
-
-
- -
-
-
- - = Kohana::TESTING OR Request::current()->secure()) { - echo HTML::script('media/js/jquery/jquery-1.9.1.min.js'); - echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js'); - echo HTML::script('media/js/lodash/lodash-1.2.1.min.js'); - } else { - echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js')); - echo HTML::script(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js')); - echo HTML::script(Site::Protocol('cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js')); - } - - echo HTML::script('media/theme/baseadmin/js/backtotop.js'); - echo HTML::script('media/js/search.js'); - echo HTML::script('media/js/custom.js'); - echo Script::factory()->render_all(); - ?> - - diff --git a/forms/OCR-DDR-Online-V3.1.pdf b/forms/OCR-DDR-Online-V3.1.pdf new file mode 100644 index 00000000..115a0a36 Binary files /dev/null and b/forms/OCR-DDR-Online-V3.1.pdf differ diff --git a/forms/index.html b/forms/index.html new file mode 100644 index 00000000..a0896d3b --- /dev/null +++ b/forms/index.html @@ -0,0 +1 @@ +The direct debit form is here. diff --git a/modules/adsl/classes/Controller/Admin/Adsl.php b/modules/adsl/classes/Controller/Admin/Adsl.php index 04c523cc..b85065d2 100644 --- a/modules/adsl/classes/Controller/Admin/Adsl.php +++ b/modules/adsl/classes/Controller/Admin/Adsl.php @@ -16,6 +16,7 @@ class Controller_Admin_Adsl extends Controller_Adsl { 'list'=>TRUE, 'stat'=>TRUE, 'traffic'=>TRUE, + 'product'=>TRUE, ); public function action_index() { @@ -110,6 +111,121 @@ class Controller_Admin_Adsl extends Controller_Adsl { ); } + public function action_product() { + $lo = ORM::factory('Language',['name'=>'English']); + $aso = ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('ADSL'); + $output = ''; + + // Process our active services + $products = array(); + + foreach ($aso as $o) { +// $output .= sprintf('Got Service [%s]
',$o->id); + if (! array_key_exists($o->product_id,$products)) { + $products[$o->product_id] = $o->product; + } + } +// $output .= sprintf('Products [%s]
',join('|',array_keys($products))); + + // Find our products without services. + $po = ORM::factory('Product')->where('prod_plugin_file','=','ADSL')->and_where('id','NOT IN',array_keys($products))->where_active()->find_all(); + foreach ($po as $o) { + if (! array_key_exists($o->id,$products)) { + $products[$o->id] = $o; + } + } +// $output .= sprintf('Now Products [%s]
',join('|',array_keys($products))); + + // Get a list of our ADSL plans that support these products + $supplierplans = $plans = array(); + foreach ($products as $id => $po) { + if (! array_key_exists($po->prod_plugin_data,$plans)) { + $plans[$po->prod_plugin_data] = ORM::factory('ADSL_Plan',$po->prod_plugin_data); + } + +//if ($po->id == 87) $output .= Debug::vars($po); +//if ($po->id == 87) $output .= '
'; +//if ($po->id == 87) $output .= Debug::vars($plans[$po->prod_plugin_data]); +//if ($po->id == 87) $output .= '
'; + if (! array_key_exists($plans[$po->prod_plugin_data]->adsl_supplier_plan_id,$supplierplans)) { + $supplierplans[$plans[$po->prod_plugin_data]->adsl_supplier_plan_id] = $plans[$po->prod_plugin_data]->supplier_plan; +//if ($po->id == 87) $output .= Debug::vars($plans[$po->prod_plugin_data]->supplier_plan); + } + } + + // Get a list of our supplier ADSL plans that are active + $aspo = ORM::factory('ADSL_Supplier_Plan')->where('id','NOT IN',array_keys($supplierplans))->where_active()->find_all(); + foreach ($aspo as $o) { + if (! array_key_exists($o->id,$supplierplans)) { + $supplierplans[$o->id] = $o; + } + } + + + $output .= ''; + + $output .= sprintf('','NAME','COST','ACTIVE'); + + // List our Supplier Plans + foreach ($supplierplans as $spo) { + $output .= ''; + $output .= sprintf('',$spo->id,$spo->name()); + $output .= sprintf('',$spo->display('base_cost')); + $output .= sprintf('',$spo->display('active')); + $output .= ''; + + // List our plans that use this supplier plans. + foreach ($plans as $po) { + if ($po->adsl_supplier_plan_id != $spo->id) continue; + + $output .= ''; + $output .= ''; + $output .= ''; + $output .= sprintf('',$po->id); + $output .= ''; + $output .= ''; + $output .= ''; + + // List our products that use these plan + foreach ($products as $pro) { + if ($pro->prod_plugin_data != $po->id) continue; + + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= sprintf('',$pro->name($lo)); + } catch (Exception $e) { + $output .= sprintf('%s','Unavailable'); + } + + $output .= sprintf('',$pro->price(0,1,'base',true)); + $output .= sprintf('',$pro->display('active')); + $output .= ''; + + // List our services using these products + foreach ($aso as $so) { + if ($so->product_id != $pro->id) continue; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= sprintf('',$so->id,$so->id,$so->name($lo)); + $output .= sprintf('',$so->price()); + $output .= sprintf('',$so->display('active')); + $output .= ''; + } + } + } + } + $output .= '
%s%s%s
%s: %s%s%s
  %s  
   %s: ',$pro->id,$pro->id); + try { + $output .= sprintf('%s%s%s
    %s: %s%s%s
'; + + $this->template->content = $output; + } + /** * Usage statistics for the previous moth */ diff --git a/modules/adsl/classes/Model/Service/Plugin/Adsl.php b/modules/adsl/classes/Model/Service/Plugin/Adsl.php index 5b86a17d..5c3acdf3 100644 --- a/modules/adsl/classes/Model/Service/Plugin/Adsl.php +++ b/modules/adsl/classes/Model/Service/Plugin/Adsl.php @@ -275,17 +275,17 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin { 'table'=>'style="border: 1px solid #bebcb7; padding: 5px 5px; background: none repeat scroll 0% 0% #f8f7f5; font-size: 70%;"', )); break; - case 'OFFPEAK_ALLOWANCE': $value = isset($data['allow']['base_down_offpeak']) ? $data['allow']['base_down_offpeak'].' MB' : '-'; break; - case 'OFFPEAK_USAGE': $value = isset($data['used']['base_down_offpeak']) ? $data['used']['base_down_offpeak'].' MB' : '-'; break; + case 'OFFPEAK_ALLOWANCE': $value = isset($data['allow']['base_down_offpeak']) ? $data['allow']['base_down_offpeak'] : '-'; break; + case 'OFFPEAK_USAGE': $value = isset($data['used']['base_down_offpeak']) ? $data['used']['base_down_offpeak'] : '-'; break; - case 'PEAK_ALLOWANCE': $value = isset($data['allow']['base_down_peak']) ? $data['allow']['base_down_peak'].' MB' : '-'; break; - case 'PEAK_USAGE': $value = isset($data['used']['base_down_peak']) ? $data['used']['base_down_peak'].' MB' : '-'; break; + case 'PEAK_ALLOWANCE': $value = isset($data['allow']['base_down_peak']) ? $data['allow']['base_down_peak'] : '-'; break; + case 'PEAK_USAGE': $value = isset($data['used']['base_down_peak']) ? $data['used']['base_down_peak'] : '-'; break; - case 'OFFPEAK_AVERAGE': $value = isset($data['used']['base_down_offpeak']) ? round($data['used']['base_down_offpeak']/$data['day'],2).' MB' : '-'; break; - case 'OFFPEAK_AVERAGE_REMAIN': $value = ((isset($data['used']['base_down_offpeak']) AND ($data['allow']['base_down_offpeak'] > $data['used']['base_down_offpeak']) AND $daysleft) ? round(($data['allow']['base_down_offpeak']-$data['used']['base_down_offpeak'])/$daysleft,2).' MB' : '-'); break; + case 'OFFPEAK_AVERAGE': $value = isset($data['used']['base_down_offpeak']) ? round($data['used']['base_down_offpeak']/$data['day'],2) : '-'; break; + case 'OFFPEAK_AVERAGE_REMAIN': $value = ((isset($data['used']['base_down_offpeak']) AND ($data['allow']['base_down_offpeak'] > $data['used']['base_down_offpeak']) AND $daysleft) ? round(($data['allow']['base_down_offpeak']-$data['used']['base_down_offpeak'])/$daysleft,2) : '-'); break; - case 'PEAK_AVERAGE': $value = isset($data['used']['base_down_peak']) ? round($data['used']['base_down_peak']/$data['day'],2).' MB' : '-'; break; - case 'PEAK_AVERAGE_REMAIN': $value = ((isset($data['used']['base_down_peak']) AND ($data['allow']['base_down_peak'] > $data['used']['base_down_peak']) AND $daysleft) ? round(($data['allow']['base_down_peak']-$data['used']['base_down_peak'])/$daysleft,2).' MB' : '-'); break; + case 'PEAK_AVERAGE': $value = isset($data['used']['base_down_peak']) ? round($data['used']['base_down_peak']/$data['day'],2) : '-'; break; + case 'PEAK_AVERAGE_REMAIN': $value = ((isset($data['used']['base_down_peak']) AND ($data['allow']['base_down_peak'] > $data['used']['base_down_peak']) AND $daysleft) ? round(($data['allow']['base_down_peak']-$data['used']['base_down_peak'])/$daysleft,2) : '-'); break; case 'SERVICE_NUMBER': $value = $this->service_number; break; case 'USAGE_DATE': $value = Site::Date($data['last']); break; diff --git a/modules/adsl/classes/Service/Traffic/Adsl/Exetelvisp.php b/modules/adsl/classes/Service/Traffic/Adsl/Exetelvisp.php index 32fff43c..9a9a5fa1 100644 --- a/modules/adsl/classes/Service/Traffic/Adsl/Exetelvisp.php +++ b/modules/adsl/classes/Service/Traffic/Adsl/Exetelvisp.php @@ -49,14 +49,14 @@ class Service_Traffic_Adsl_Exetelvisp extends Service_Traffic_Adsl { $valuesarray = explode(',',$details); - // Extel VISP stores data in MB's*100. + // Extel VISP stores data in MB's. $attrs = array(); $attrs['service'] = $valuesarray[0]; $attrs['date'] = $valuesarray[1]; - $attrs['up_peak'] = $valuesarray[2]/100; - $attrs['down_peak'] = $valuesarray[3]/100; - $attrs['up_offpeak'] = $valuesarray[4]/100; - $attrs['down_offpeak'] = $valuesarray[5]/100; + $attrs['up_peak'] = $valuesarray[2]; + $attrs['down_peak'] = $valuesarray[3]; + $attrs['up_offpeak'] = $valuesarray[4]; + $attrs['down_offpeak'] = $valuesarray[5]; array_push($result,$attrs); } diff --git a/modules/checkout/classes/Checkout/Plugin/Paypal.php b/modules/checkout/classes/Checkout/Plugin/Paypal.php index 92d0fa88..5899730f 100644 --- a/modules/checkout/classes/Checkout/Plugin/Paypal.php +++ b/modules/checkout/classes/Checkout/Plugin/Paypal.php @@ -13,7 +13,7 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin { protected $url_prod = 'www.paypal.com'; protected $url_test = 'www.sandbox.paypal.com'; private $ipn_test = '173.0.82.126'; - protected $email_prod = ''; // @todo This should be in the DB + protected $email_prod = 'deon@graytech.net.au'; // @todo This should be in the DB protected $email_test = ''; // @todo This should be in the DB protected $test_mode = FALSE; diff --git a/modules/checkout/classes/Controller/Admin/Checkout.php b/modules/checkout/classes/Controller/Admin/Checkout.php index 07091aad..e9caf5b2 100644 --- a/modules/checkout/classes/Controller/Admin/Checkout.php +++ b/modules/checkout/classes/Controller/Admin/Checkout.php @@ -11,6 +11,31 @@ */ class Controller_Admin_Checkout extends Controller_Checkout { protected $secure_actions = array( + 'manual'=>FALSE, ); + + public function action_manual() { + $this->auto_render = FALSE; + + $cno = ORM::factory('Checkout_Notify',$this->request->param('id')); + + if (! $cno->loaded()) + throw HTTP_Exception::factory(404,'Not found?'); + + // Process our Notify + try { + $this->response->body($cno->process()); + + } catch (Exception $e) { + Kohana_Exception::log($e); + + echo Debug::vars($e); + die(); + } + + $this->response->headers('Content-Type','text/plain'); + $this->response->headers('Content-Length',(string)$this->response->content_length()); + $this->response->headers('Last-Modified',time()); + } } ?> diff --git a/modules/invoice/classes/Invoice.php b/modules/invoice/classes/Invoice.php index e489e0b7..74963627 100644 --- a/modules/invoice/classes/Invoice.php +++ b/modules/invoice/classes/Invoice.php @@ -172,6 +172,8 @@ class Invoice { break; case 'html': +// @todo What happened to rounding, look at service 410. Why is cost correct and invoice generation not? Maybe fixed - need to validate. +//echo Debug::vars(['m'=>__METHOD__,'i'=>$this->_io->dump()]); switch ($section) { case 'body': if (! $this->_io->active) diff --git a/modules/invoice/classes/Model/Invoice.php b/modules/invoice/classes/Model/Invoice.php index 6c856311..1d61919c 100644 --- a/modules/invoice/classes/Model/Invoice.php +++ b/modules/invoice/classes/Model/Invoice.php @@ -296,7 +296,8 @@ class Model_Invoice extends ORM implements Cartable { } else { $key = preg_replace("/^$prefix/",'',$key); - return isset($this->reminders[$key]) ? ($format ? Config::date($this->reminders[$key]) : $this->reminders[$key]) : NULL; + // Fix for inv 5061 + return (isset($this->reminders[$key]) AND ! is_array($this->reminders[$key])) ? ($format ? Site::Date($this->reminders[$key]) : $this->reminders[$key]) : NULL; } } diff --git a/modules/invoice/classes/Model/Invoice/Item.php b/modules/invoice/classes/Model/Invoice/Item.php index e5a7537f..b07b4228 100644 --- a/modules/invoice/classes/Model/Invoice/Item.php +++ b/modules/invoice/classes/Model/Invoice/Item.php @@ -58,6 +58,7 @@ class Model_Invoice_Item extends ORM { 7=>'Extra Product/Service Charge', // * Service Billing in advance, Must have corresponding SERVICE_ID 8=>'Product Addition', // * Additional Product Customisation, Must have corresponding SERVICE_ID 120=>'Credit/Debit Transfer', // * SERVICE_ID is NULL, MODULE_ID is NULL, MODULE_REF is NULL : INVOICE_ID is NOT NULL + 123=>'Shipping', 124=>'Late Payment Fee', // * SERVICE_ID is NULL, MODULE_ID = CHECKOUT MODULE, 125=>'Payment Fee', // * SERVICE_ID is NULL, MODULE_ID = CHECKOUT MODULE, MODULE_REF = CHECKOUT NAME 126=>'Other', // * MODEL_ID should be a module @@ -125,20 +126,33 @@ class Model_Invoice_Item extends ORM { private function isValid() { switch ($this->item_type) { case 0: +// When a charge is charging normal service fees, this fails. +if (is_object($this->module_id)) +$this->module_id = $this->module_id->id; +try{ // @todo Validate if module_id = charge and module_ref corresponds with the line item - if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this>module_ref)) OR $this->product_name OR is_null($this->recurring_schedule)) + if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this->module_ref)) OR $this->product_name OR is_null($this->recurring_schedule)) return FALSE; +} catch (Exception $e) { +echo Debug::vars($this->dump()); +} break; case 1: +return TRUE; if (! $this->product_id OR $this->module_id OR $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule)) return FALSE; break; // These items come from the charge module, so we should have a charge module_id and ref case 2: - if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this>module_ref)) OR $this->product_name OR ! is_null($this->recurring_schedule)) +try{ + if (! $this->service_id OR ! $this->product_id OR ($this->module_id->id AND $this->module_id->id != 32 AND ! is_null($this->module_ref)) OR $this->product_name OR ! is_null($this->recurring_schedule)) return FALSE; +} catch (Exception $e) { +echo Debug::vars($this->dump()); +die(); +} break; - case 3: + case 5: case 4: case 7: if (! $this->service_id OR ! $this->product_id OR ! $this->module_id OR ! $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule)) @@ -194,6 +208,8 @@ class Model_Invoice_Item extends ORM { switch ($this->item_type) { case 0: return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),$this->period()); + case 1: + return StaticList_ItemType::get($this->item_type); case 2: return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),$this->_module() ? $this->_module()->display('date_charge') : $this->period()); case 3: @@ -203,6 +219,8 @@ class Model_Invoice_Item extends ORM { case 5: case 7: return $this->_module()->namesub($variable); + case 123: + return StaticList_ItemType::get($this->item_type); default: return sprintf('Unknown [%s-%s]',$this->item_type,$this->id); } diff --git a/modules/invoice/classes/Task/Devel/Invoice/Fixtax.php b/modules/invoice/classes/Task/Devel/Invoice/Fixtax.php new file mode 100644 index 00000000..90ded963 --- /dev/null +++ b/modules/invoice/classes/Task/Devel/Invoice/Fixtax.php @@ -0,0 +1,29 @@ +find_all() as $io) + if ($io->due() < 0) + foreach ($io->subitems() as $iio) + if ($iio->tax->find_all()->count() === 0) { + $iio->subitem_add($io->account->country,FALSE); + $iio->save(); + + array_push($c,$iio); + } + + return sprintf('%s items updated (%s)',count($c),join('|',$c)); + } +} +?> diff --git a/modules/invoice/classes/Task/Devel/Invoice/List.php b/modules/invoice/classes/Task/Devel/Invoice/List.php new file mode 100644 index 00000000..5275952e --- /dev/null +++ b/modules/invoice/classes/Task/Devel/Invoice/List.php @@ -0,0 +1,65 @@ +where('id','>',4331)->and_where('id','<',5320)->order_by('id','ASC')->find_all() as $io) { + if ($io->due() == 0) + continue; + +/* + elseif ($io->due() < 0) { + foreach ($io->subitems() as $iio) { + switch ($iio->price_base) { + case 40.909: + $iio->price_base=40.92; + break; + + case 98.045: + case 98.05: + $iio->price_base=98.055; + break; + + case 103.045: + $iio->price_base=103.055; + break; + + case 204.545: + $iio->price_base=204.56; + break; + case 209.545: + $iio->price_base=209.56; + break; + + default: + print_r($iio->dump()); + + } + + $iio->save(); + } + + printf("%4s %6.2f\n",$io->id,$io->due()); + if ($c++>2) + break; + + } elseif ($io->due() < 1) { + printf("%4s %6.2f\n",$io->id,$io->due()); + } +*/ + printf("%4s %6.2f\n",$io->id,$io->due()); + + } + } +} +?> diff --git a/modules/payment/classes/Controller/Admin/Payment.php b/modules/payment/classes/Controller/Admin/Payment.php index eed40a4f..eca948ca 100644 --- a/modules/payment/classes/Controller/Admin/Payment.php +++ b/modules/payment/classes/Controller/Admin/Payment.php @@ -100,6 +100,7 @@ class Controller_Admin_Payment extends Controller_Payment { if ($this->request->post()) { $po->values($this->request->post()); + $po->total_amt = (float)$po->total_amt; // Update our invoice payment items if (is_array($this->request->post('payment_item')) AND count($this->request->post('payment_item'))) foreach ($this->request->post('payment_item') as $k=>$v) { diff --git a/modules/ssl/classes/Model/SSL/CA.php b/modules/ssl/classes/Model/SSL/CA.php index daf3de5e..58ee987a 100644 --- a/modules/ssl/classes/Model/SSL/CA.php +++ b/modules/ssl/classes/Model/SSL/CA.php @@ -107,10 +107,11 @@ class Model_SSL_CA extends ORM { $result = NULL; // If we are a root cert, we are valid - if (is_null($this->parent_ssl_ca_id) AND $this->isRoot()) + if ((($this->parent_ssl_ca_id == $this->id) OR is_null($this->parent_ssl_ca_id)) AND $this->isRoot()) return StaticList_YesNo::get(TRUE,$format); +//echo Debug::vars([__METHOD__,'psci'=>$this->parent_ssl_ca_id,'myid'=>$this->id,'root'=>$this->isRoot()]); - return StaticList_YesNo::get($this->aki_keyid() == $this->parent->ski(),$format); + return StaticList_YesNo::get(($this->aki_keyid() == $this->parent->ski() AND $this->parent_ssl_ca_id != $this->id),$format); } // If we change the SSL certificate, we need to reload our SSL object diff --git a/modules/ssl/classes/Model/Service/Plugin/Ssl.php b/modules/ssl/classes/Model/Service/Plugin/Ssl.php index 428f2584..a8760821 100644 --- a/modules/ssl/classes/Model/Service/Plugin/Ssl.php +++ b/modules/ssl/classes/Model/Service/Plugin/Ssl.php @@ -116,9 +116,11 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin { // Get the first parent CA certificate $po = $this->ca; - while ($po AND $po->loaded()) { +//echo Debug::vars([__METHOD__,'this'=>$this,'po'=>$po,'vp'=>$po->validParent()]);die(); +$c = 0; + while ($po AND $po->loaded() AND $c++ < 5) { array_push($result,$po); - $po = ($po->validParent()) ? $po->parent : NULL; + $po = ($po->validParent() AND $po->id != $po->parent_ssl_ca_id) ? $po->parent : NULL; } return $result;