From cbd10347a5b6f20c9e567598f8d76b51d77206f5 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 20 May 2014 21:49:52 +1000 Subject: [PATCH] Fixes from live --- .gitmodules | 6 ++--- application/classes/Model/Account.php | 1 - application/classes/Period.php | 3 --- .../classes/Checkout/Plugin/Paypal.php | 1 - modules/checkout/classes/Model/Checkout.php | 2 +- modules/host/classes/Host/Plugin/Cpanel.php | 2 +- modules/host/classes/Host/Plugin/Plesk.php | 2 +- .../invoice/classes/Task/Invoice/Email.php | 24 ++++++++++--------- .../payment/classes/Payment/Bulk/Ezypay.php | 4 ++-- modules/product/classes/Model/Product.php | 2 ++ .../classes/Controller/Reseller/Service.php | 6 ++--- .../service/classes/Model/Service/Billing.php | 1 + 12 files changed, 26 insertions(+), 28 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8a29b0a8..091b3ff0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "includes/kohana"] path = includes/kohana - url = ssh://10.1.3.20/afs/local/git/lnkohana + url = ssh://link.leenooks.net/afs/local/git/lnkohana [submodule "modules/lnApp"] path = modules/lnApp - url = ssh://10.1.3.20/afs/local/git/lnapp + url = ssh://link.leenooks.net/afs/local/git/lnapp [submodule "modules/highchart"] path = modules/highchart - url = ssh://10.1.3.20/afs/local/git/lnhighchart + url = ssh://link.leenooks.net/afs/local/git/lnhighchart diff --git a/application/classes/Model/Account.php b/application/classes/Model/Account.php index ce81b72c..e6195980 100644 --- a/application/classes/Model/Account.php +++ b/application/classes/Model/Account.php @@ -13,7 +13,6 @@ class Model_Account extends Model_Auth_UserDefault { // Relationships protected $_has_many = array( 'user_tokens'=>array('model'=>'user_token'), - 'service_billing'=>array('far_key'=>'id'), 'email_log'=>array('far_key'=>'id'), 'group'=>array('through'=>'account_group'), 'invoice'=>array('far_key'=>'id'), diff --git a/application/classes/Period.php b/application/classes/Period.php index 142ca8f2..ee199795 100644 --- a/application/classes/Period.php +++ b/application/classes/Period.php @@ -70,9 +70,6 @@ class Period { // Triennial case 6: - if ($strict) - throw new Kohana_Exception('Strict not implemented here'); - $inc_months = 36; break; diff --git a/modules/checkout/classes/Checkout/Plugin/Paypal.php b/modules/checkout/classes/Checkout/Plugin/Paypal.php index b684f777..caceb67d 100644 --- a/modules/checkout/classes/Checkout/Plugin/Paypal.php +++ b/modules/checkout/classes/Checkout/Plugin/Paypal.php @@ -86,7 +86,6 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin { // Verify that the IPN is for us. // @todo This should be in the DB. if ($cno->data['business'] == ($this->test_mode ? $this->email_test : $this->email_prod)) { - switch ($cno->data['payment_status']) { case 'Completed': // Our cart items total. diff --git a/modules/checkout/classes/Model/Checkout.php b/modules/checkout/classes/Model/Checkout.php index d3a3d1f7..20bcb5a3 100644 --- a/modules/checkout/classes/Model/Checkout.php +++ b/modules/checkout/classes/Model/Checkout.php @@ -11,8 +11,8 @@ */ class Model_Checkout extends ORM_OSB { protected $_has_many = array( - 'account'=>array('through'=>'account_billing','foreign_key'=>'checkout_id'), 'payment'=>array(), + 'service'=>array('through'=>'account_billing','foreign_key'=>'checkout_id'), ); protected $_sorting = array('name'=>'ASC'); diff --git a/modules/host/classes/Host/Plugin/Cpanel.php b/modules/host/classes/Host/Plugin/Cpanel.php index f8e84968..2b45966f 100644 --- a/modules/host/classes/Host/Plugin/Cpanel.php +++ b/modules/host/classes/Host/Plugin/Cpanel.php @@ -40,7 +40,7 @@ echo __METHOD__;die(); } public function manage_button(Model_Service_Plugin_Host $spho,$t) { - return $this->render_button($t,$spho->service_id,$spho->username_value(),substr(md5($spho->password_value()),0,8)); + return $this->render_button($t,$spho->service_id,$spho->username(),substr(md5($spho->password()),0,8)); } public function admin_manage_button(Model_Host_Server $hso,$t) { return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8)); diff --git a/modules/host/classes/Host/Plugin/Plesk.php b/modules/host/classes/Host/Plugin/Plesk.php index 0b8b9665..d8116d39 100644 --- a/modules/host/classes/Host/Plugin/Plesk.php +++ b/modules/host/classes/Host/Plugin/Plesk.php @@ -54,7 +54,7 @@ abstract class Host_Plugin_Plesk extends Host_Plugin { } public function manage_button(Model_Service_Plugin_Host $spho,$t) { - return $this->render_button($t,$spho->service_id,$spho->username_value(),substr(md5($spho->password_value()),0,8)); + return $this->render_button($t,$spho->service_id,$spho->username(),substr(md5($spho->password()),0,8)); } public function admin_manage_button(Model_Host_Server $hso,$t) { return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8)); diff --git a/modules/invoice/classes/Task/Invoice/Email.php b/modules/invoice/classes/Task/Invoice/Email.php index e99ed41a..8808900e 100644 --- a/modules/invoice/classes/Task/Invoice/Email.php +++ b/modules/invoice/classes/Task/Invoice/Email.php @@ -38,23 +38,25 @@ class Task_Invoice_Email extends Minion_Task { if (++$max_count > $max) break; - if (Invoice::instance($io)->render('email','all')) { - // Log the emailling - $imo = $io->invoice_memo; - $imo->invoice_id = $io->id; - $imo->type = 'email'; - $imo->memo = 'Invoice Emailed.'; - $imo->save(); + // Log the emailling + $imo = $io->invoice_memo; + $imo->invoice_id = $io->id; + $imo->type = 'email'; - $io->print_status = 1; - $io->set_remind($key,time(),($params['force']=='again' ? TRUE : FALSE)); - $io->save(); + if (Invoice::instance($io)->render('email','all')) { + $imo->memo = 'Invoice Emailed.'; array_push($action,(string)$io); } else { - throw new Kohana_Exception('Unable to send invoice :io',array(':io'=>$io->id)); + $imo->memo = 'Invoice Send Failed.'; } + + $imo->save(); + + $io->print_status = 1; + $io->set_remind($key,time(),($params['force']=='again' ? TRUE : FALSE)); + $io->save(); } return _('Invoiced emailed: ').join('|',$action); diff --git a/modules/payment/classes/Payment/Bulk/Ezypay.php b/modules/payment/classes/Payment/Bulk/Ezypay.php index 215bd9b3..6060b004 100644 --- a/modules/payment/classes/Payment/Bulk/Ezypay.php +++ b/modules/payment/classes/Payment/Bulk/Ezypay.php @@ -61,8 +61,8 @@ class Payment_Bulk_Ezypay { $po->checkout_data = array('transid'=>$array[2].':'.$array[3]); $po->date_payment = strtotime(str_replace('/','-',$array[8])); - $sbo = $po->account->service_billing->where('checkout_data','=',$array[3])->find(); - if (! $sbo->loaded()) + $sbo = ORM::factory('Service_Billing')->where('checkout_data','=',$array[3])->find(); + if (! $sbo->loaded() OR $sbo->service->account_id != $aid) throw HTTP_Exception::factory(501,'No Service Billing Data for :aid (:pd)?',array(':aid'=>$aid,':pd'=>$array[3])); $po->checkout_id = $sbo->checkout_id; diff --git a/modules/product/classes/Model/Product.php b/modules/product/classes/Model/Product.php index 8b916c40..f9f7f7b8 100644 --- a/modules/product/classes/Model/Product.php +++ b/modules/product/classes/Model/Product.php @@ -55,6 +55,8 @@ class Model_Product extends ORM_OSB implements Invoicable { case 0: case 7: return 'Service'; + case 6: + return 'Service Cancellation'; default: return 'Product Charge'; } diff --git a/modules/service/classes/Controller/Reseller/Service.php b/modules/service/classes/Controller/Reseller/Service.php index b4ede82b..3096f9ad 100644 --- a/modules/service/classes/Controller/Reseller/Service.php +++ b/modules/service/classes/Controller/Reseller/Service.php @@ -81,10 +81,8 @@ class Controller_Reseller_Service extends Controller_Service { foreach (ORM::factory('Checkout')->find_all() as $co) { $svs = array(); - foreach ($co->account->where('account.id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $ao) - foreach ($ao->service->list_active() as $so) - if ($so->service_billing->checkout_id == $co->id) - array_push($svs,$so); + foreach ($co->service->where('service.account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $so) + array_push($svs,$so); if ($svs) Block::factory() diff --git a/modules/service/classes/Model/Service/Billing.php b/modules/service/classes/Model/Service/Billing.php index 4376c19a..ac9f8c3e 100644 --- a/modules/service/classes/Model/Service/Billing.php +++ b/modules/service/classes/Model/Service/Billing.php @@ -15,6 +15,7 @@ class Model_Service_Billing extends ORM_OSB { // Relationships protected $_has_one = array( 'checkout'=>array('far_key'=>'checkout_id','foreign_key'=>'id'), + 'service'=>array('far_key'=>'service_id','foreign_key'=>'id'), ); protected $_display_filters = array(