Fixes from live

This commit is contained in:
Deon George 2014-05-20 21:49:52 +10:00
parent a329cc3179
commit cbd10347a5
12 changed files with 26 additions and 28 deletions

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "includes/kohana"] [submodule "includes/kohana"]
path = 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"] [submodule "modules/lnApp"]
path = 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"] [submodule "modules/highchart"]
path = modules/highchart path = modules/highchart
url = ssh://10.1.3.20/afs/local/git/lnhighchart url = ssh://link.leenooks.net/afs/local/git/lnhighchart

View File

@ -13,7 +13,6 @@ class Model_Account extends Model_Auth_UserDefault {
// Relationships // Relationships
protected $_has_many = array( protected $_has_many = array(
'user_tokens'=>array('model'=>'user_token'), 'user_tokens'=>array('model'=>'user_token'),
'service_billing'=>array('far_key'=>'id'),
'email_log'=>array('far_key'=>'id'), 'email_log'=>array('far_key'=>'id'),
'group'=>array('through'=>'account_group'), 'group'=>array('through'=>'account_group'),
'invoice'=>array('far_key'=>'id'), 'invoice'=>array('far_key'=>'id'),

View File

@ -70,9 +70,6 @@ class Period {
// Triennial // Triennial
case 6: case 6:
if ($strict)
throw new Kohana_Exception('Strict not implemented here');
$inc_months = 36; $inc_months = 36;
break; break;

View File

@ -86,7 +86,6 @@ abstract class Checkout_Plugin_Paypal extends Checkout_Plugin {
// Verify that the IPN is for us. // Verify that the IPN is for us.
// @todo This should be in the DB. // @todo This should be in the DB.
if ($cno->data['business'] == ($this->test_mode ? $this->email_test : $this->email_prod)) { if ($cno->data['business'] == ($this->test_mode ? $this->email_test : $this->email_prod)) {
switch ($cno->data['payment_status']) { switch ($cno->data['payment_status']) {
case 'Completed': case 'Completed':
// Our cart items total. // Our cart items total.

View File

@ -11,8 +11,8 @@
*/ */
class Model_Checkout extends ORM_OSB { class Model_Checkout extends ORM_OSB {
protected $_has_many = array( protected $_has_many = array(
'account'=>array('through'=>'account_billing','foreign_key'=>'checkout_id'),
'payment'=>array(), 'payment'=>array(),
'service'=>array('through'=>'account_billing','foreign_key'=>'checkout_id'),
); );
protected $_sorting = array('name'=>'ASC'); protected $_sorting = array('name'=>'ASC');

View File

@ -40,7 +40,7 @@ echo __METHOD__;die();
} }
public function manage_button(Model_Service_Plugin_Host $spho,$t) { 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) { 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)); return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8));

View File

@ -54,7 +54,7 @@ abstract class Host_Plugin_Plesk extends Host_Plugin {
} }
public function manage_button(Model_Service_Plugin_Host $spho,$t) { 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) { 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)); return $this->render_button($t,$hso->id,substr(md5($hso->manage_username),0,8),substr(md5($hso->manage_password),0,8));

View File

@ -38,23 +38,25 @@ class Task_Invoice_Email extends Minion_Task {
if (++$max_count > $max) if (++$max_count > $max)
break; break;
if (Invoice::instance($io)->render('email','all')) {
// Log the emailling // Log the emailling
$imo = $io->invoice_memo; $imo = $io->invoice_memo;
$imo->invoice_id = $io->id; $imo->invoice_id = $io->id;
$imo->type = 'email'; $imo->type = 'email';
if (Invoice::instance($io)->render('email','all')) {
$imo->memo = 'Invoice Emailed.'; $imo->memo = 'Invoice Emailed.';
array_push($action,(string)$io);
} else {
$imo->memo = 'Invoice Send Failed.';
}
$imo->save(); $imo->save();
$io->print_status = 1; $io->print_status = 1;
$io->set_remind($key,time(),($params['force']=='again' ? TRUE : FALSE)); $io->set_remind($key,time(),($params['force']=='again' ? TRUE : FALSE));
$io->save(); $io->save();
array_push($action,(string)$io);
} else {
throw new Kohana_Exception('Unable to send invoice :io',array(':io'=>$io->id));
}
} }
return _('Invoiced emailed: ').join('|',$action); return _('Invoiced emailed: ').join('|',$action);

View File

@ -61,8 +61,8 @@ class Payment_Bulk_Ezypay {
$po->checkout_data = array('transid'=>$array[2].':'.$array[3]); $po->checkout_data = array('transid'=>$array[2].':'.$array[3]);
$po->date_payment = strtotime(str_replace('/','-',$array[8])); $po->date_payment = strtotime(str_replace('/','-',$array[8]));
$sbo = $po->account->service_billing->where('checkout_data','=',$array[3])->find(); $sbo = ORM::factory('Service_Billing')->where('checkout_data','=',$array[3])->find();
if (! $sbo->loaded()) 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])); throw HTTP_Exception::factory(501,'No Service Billing Data for :aid (:pd)?',array(':aid'=>$aid,':pd'=>$array[3]));
$po->checkout_id = $sbo->checkout_id; $po->checkout_id = $sbo->checkout_id;

View File

@ -55,6 +55,8 @@ class Model_Product extends ORM_OSB implements Invoicable {
case 0: case 0:
case 7: case 7:
return 'Service'; return 'Service';
case 6:
return 'Service Cancellation';
default: default:
return 'Product Charge'; return 'Product Charge';
} }

View File

@ -81,9 +81,7 @@ class Controller_Reseller_Service extends Controller_Service {
foreach (ORM::factory('Checkout')->find_all() as $co) { foreach (ORM::factory('Checkout')->find_all() as $co) {
$svs = array(); $svs = array();
foreach ($co->account->where('account.id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $ao) foreach ($co->service->where('service.account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $so)
foreach ($ao->service->list_active() as $so)
if ($so->service_billing->checkout_id == $co->id)
array_push($svs,$so); array_push($svs,$so);
if ($svs) if ($svs)

View File

@ -15,6 +15,7 @@ class Model_Service_Billing extends ORM_OSB {
// Relationships // Relationships
protected $_has_one = array( protected $_has_one = array(
'checkout'=>array('far_key'=>'checkout_id','foreign_key'=>'id'), 'checkout'=>array('far_key'=>'checkout_id','foreign_key'=>'id'),
'service'=>array('far_key'=>'service_id','foreign_key'=>'id'),
); );
protected $_display_filters = array( protected $_display_filters = array(