Misc fixes from live site
This commit is contained in:
parent
3499776ddc
commit
f3d2c1fe8d
@ -170,7 +170,7 @@ class Config extends Kohana_Config {
|
|||||||
|
|
||||||
public static function theme() {
|
public static function theme() {
|
||||||
// If we are using user admin pages (and login), we'll choose the admin theme.
|
// If we are using user admin pages (and login), we'll choose the admin theme.
|
||||||
return URL::admin_url() ? 'theme/'.Kohana::$config->load('config')->theme_admin : 'theme/'.Kohana::$config->load('config')->theme;
|
return 'theme/'.(URL::admin_url() ? Kohana::$config->load('config')->theme_admin : Kohana::$config->load('config')->theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function time($date) {
|
public static function time($date) {
|
||||||
|
@ -22,8 +22,8 @@ class Controller_User_Search extends Controller_Search {
|
|||||||
|
|
||||||
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
|
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
|
||||||
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'url','id',array('ACC %s: %s'=>array('id','name(TRUE)')),array(),array('urlprefix'=>'r/account/view/')));
|
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'url','id',array('ACC %s: %s'=>array('id','name(TRUE)')),array(),array('urlprefix'=>'r/account/view/')));
|
||||||
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'url','id',array('INV %s: %s'=>array('id','account->name(TRUE)')),array(),array('urlprefix'=>'u/invoice/view/')));
|
|
||||||
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'url','id',array('SVC %s: %s'=>array('id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'url','id',array('SVC %s: %s'=>array('id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
||||||
|
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'url','id',array('INV %s: %s'=>array('id','account->name(TRUE)')),array(),array('urlprefix'=>'u/invoice/view/')));
|
||||||
|
|
||||||
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o)
|
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o)
|
||||||
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* This class overrides Kohana's Cookie
|
* This class overrides Kohana's Cookie
|
||||||
*
|
*
|
||||||
* @package OSB
|
* @package OSB/Modifications
|
||||||
* @category Helpers
|
* @category Helpers
|
||||||
* @author Deon George
|
* @author Deon George
|
||||||
* @copyright (c) 2009-2013 Open Source Billing
|
* @copyright (c) 2009-2013 Open Source Billing
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
*/
|
*/
|
||||||
class Currency {
|
class Currency {
|
||||||
public static function display($amount) {
|
public static function display($amount) {
|
||||||
|
if (! is_numeric($amount))
|
||||||
|
$amount = 0;
|
||||||
|
|
||||||
return Num::format($amount,Company::instance()->decimals(),TRUE);
|
return Num::format($amount,Company::instance()->decimals(),TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
application/classes/Database.php
Normal file
18
application/classes/Database.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class extends the core Kohana class by adding some core application
|
||||||
|
* specific functions, and configuration.
|
||||||
|
*
|
||||||
|
* @package OSB
|
||||||
|
* @category Modifications
|
||||||
|
* @author Deon George
|
||||||
|
* @copyright (c) 2009-2013 Open Source Billing
|
||||||
|
* @license http://dev.osbill.net/license.html
|
||||||
|
*/
|
||||||
|
abstract class Database extends Kohana_Database {
|
||||||
|
public function caching() {
|
||||||
|
return isset($this->_config['caching']) ? $this->_config['caching'] : FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -37,11 +37,9 @@ abstract class Kohana extends Kohana_Core {
|
|||||||
$prefixes = array('');
|
$prefixes = array('');
|
||||||
|
|
||||||
// Our search order.
|
// Our search order.
|
||||||
if (! preg_match('/^theme\//',$file)) {
|
|
||||||
array_unshift($prefixes,Config::theme().'/');
|
array_unshift($prefixes,Config::theme().'/');
|
||||||
array_unshift($prefixes,sprintf('site/%s/',Config::siteid()));
|
array_unshift($prefixes,sprintf('site/%s/',Config::siteid()));
|
||||||
array_unshift($prefixes,sprintf('site/%s/%s/',Config::siteid(),Config::theme()));
|
array_unshift($prefixes,sprintf('site/%s/%s/',Config::siteid(),Config::theme()));
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($prefixes as $p)
|
foreach ($prefixes as $p)
|
||||||
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
|
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
|
||||||
|
@ -21,7 +21,7 @@ class Kohana_Exception extends Kohana_Kohana_Exception {
|
|||||||
try {
|
try {
|
||||||
$eo = ORM::factory('Log_Error');
|
$eo = ORM::factory('Log_Error');
|
||||||
$eo->message = Kohana_Exception::text($e);
|
$eo->message = Kohana_Exception::text($e);
|
||||||
$eo->account_id = Auth::instance()->get_user()->id;
|
$eo->account_id = (PHP_SAPI === 'cli' OR ! Auth::instance()->logged_in()) ? NULL : Auth::instance()->get_user()->id;
|
||||||
|
|
||||||
if (Request::current()) {
|
if (Request::current()) {
|
||||||
$eo->module = (Request::current()->directory() ? Request::current()->directory().'_' : '').Request::current()->controller();
|
$eo->module = (Request::current()->directory() ? Request::current()->directory().'_' : '').Request::current()->controller();
|
||||||
|
@ -65,6 +65,13 @@ abstract class ORM extends Kohana_ORM {
|
|||||||
return $this->where('status','=',TRUE);
|
return $this->where('status','=',TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides Kohana cache so that it can be globally disabled.
|
||||||
|
*/
|
||||||
|
public function cached($lifetime=NULL) {
|
||||||
|
return $this->_db->caching() ? parent::cached($lifetime) : $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function clear() {
|
public function clear() {
|
||||||
$this->_formated = FALSE;
|
$this->_formated = FALSE;
|
||||||
$this->_object_formated = array();
|
$this->_object_formated = array();
|
||||||
|
@ -28,6 +28,7 @@ return array(
|
|||||||
'payment_item'=>60,
|
'payment_item'=>60,
|
||||||
'module'=>86400,
|
'module'=>86400,
|
||||||
'module_method'=>86400,
|
'module_method'=>86400,
|
||||||
|
'record_id'=>0,
|
||||||
'setup'=>86400,
|
'setup'=>86400,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -112,7 +112,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
/**
|
/**
|
||||||
* Calculate the total traffic used in a month
|
* Calculate the total traffic used in a month
|
||||||
*/
|
*/
|
||||||
private function get_traffic_data_month($period=NULL,$cache=NULL) {
|
private function get_traffic_data_month($period=NULL,$cache=0) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($this->get_traffic_data_daily($period,TRUE,$cache) as $tdata)
|
foreach ($this->get_traffic_data_daily($period,TRUE,$cache) as $tdata)
|
||||||
@ -128,11 +128,9 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
/**
|
/**
|
||||||
* Return an array of the data used in a month by day
|
* Return an array of the data used in a month by day
|
||||||
*/
|
*/
|
||||||
public function get_traffic_data_daily($period=NULL,$bydate=FALSE,$cache=NULL) {
|
public function get_traffic_data_daily($period=NULL,$bydate=FALSE,$cache=0) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
// @temp - caching is broken?
|
|
||||||
$cache=0;
|
|
||||||
if (is_null($period))
|
if (is_null($period))
|
||||||
$period = strtotime('yesterday');
|
$period = strtotime('yesterday');
|
||||||
|
|
||||||
@ -187,7 +185,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function traffic_month($month,$string=TRUE,$cache=NULL) {
|
public function traffic_month($month,$string=TRUE,$cache=0) {
|
||||||
return $string ? implode('/',$this->get_traffic_data_month($month,$cache)) :
|
return $string ? implode('/',$this->get_traffic_data_month($month,$cache)) :
|
||||||
$this->get_traffic_data_month($month,$cache);
|
$this->get_traffic_data_month($month,$cache);
|
||||||
}
|
}
|
||||||
@ -354,7 +352,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
case 'invoice_detail_items':
|
case 'invoice_detail_items':
|
||||||
return array(
|
return array(
|
||||||
_('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
|
_('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
|
||||||
_('Contract Until')=>$this->contract_date_end(),
|
_('Contract Until')=>$this->contract_date_end(TRUE),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<tr class="<?php echo $i ? 'odd' : 'even'; ?>">
|
<tr class="<?php echo $i ? 'odd' : 'even'; ?>">
|
||||||
<td><?php echo $service->plugin()->display('service_number'); ?></td>
|
<td><?php echo $service->plugin()->display('service_number'); ?></td>
|
||||||
<td><?php echo $plan->adsl_supplier_plan->name().($planoverride ? '*' : ''); ?></td>
|
<td><?php echo $plan->adsl_supplier_plan->name().($planoverride ? '*' : ''); ?></td>
|
||||||
<td><?php echo $service->plugin()->contract_date_start(); ?></td>
|
<td><?php echo $service->plugin()->contract_date_start(TRUE); ?></td>
|
||||||
<td><?php echo $service->plugin()->contract_date_end(); ?></td>
|
<td><?php echo $service->plugin()->contract_date_end(TRUE); ?></td>
|
||||||
<td><?php echo Currency::display($plan->adsl_supplier_plan->base_cost); ?></td>
|
<td><?php echo Currency::display($plan->adsl_supplier_plan->base_cost); ?></td>
|
||||||
<td><?php echo Currency::display($plan->adsl_supplier_plan->base_cost+$plan->adsl_supplier_plan->tax()); ?></td>
|
<td><?php echo Currency::display($plan->adsl_supplier_plan->base_cost+$plan->adsl_supplier_plan->tax()); ?></td>
|
||||||
<td><input type="checkbox" <?php echo $checked; ?> onchange="paid(this);"/></td>
|
<td><input type="checkbox" <?php echo $checked; ?> onchange="paid(this);"/></td>
|
||||||
|
@ -37,6 +37,7 @@ class Controller_Reseller_Export extends Controller_Export {
|
|||||||
$output .= Form::open(URL::link('reseller','export/list'));
|
$output .= Form::open(URL::link('reseller','export/list'));
|
||||||
$output .= Form::select('eid',ORM::factory('Export')->list_select());
|
$output .= Form::select('eid',ORM::factory('Export')->list_select());
|
||||||
$output .= Form::button('submit','Submit',array('class'=>'btn btn-primary'));
|
$output .= Form::button('submit','Submit',array('class'=>'btn btn-primary'));
|
||||||
|
$output .= Form::hidden('days',$this->request->param('id'));
|
||||||
$output .= Form::close();
|
$output .= Form::close();
|
||||||
|
|
||||||
Block::factory()
|
Block::factory()
|
||||||
@ -74,7 +75,7 @@ class Controller_Reseller_Export extends Controller_Export {
|
|||||||
$output .= sprintf('<div class="tab-pane %s" id="tab%s">',$c++ ? '' : 'active',$emo->id);
|
$output .= sprintf('<div class="tab-pane %s" id="tab%s">',$c++ ? '' : 'active',$emo->id);
|
||||||
|
|
||||||
$output .= Table::factory()
|
$output .= Table::factory()
|
||||||
->data($emo->list_export())
|
->data($emo->list_export($this->request->post('days')))
|
||||||
->jssort($emo->id)
|
->jssort($emo->id)
|
||||||
->columns(Arr::merge(array(
|
->columns(Arr::merge(array(
|
||||||
'id'=>'ID',
|
'id'=>'ID',
|
||||||
|
@ -26,7 +26,10 @@ class Model_Export_Module extends ORM_OSB {
|
|||||||
'display',
|
'display',
|
||||||
);
|
);
|
||||||
|
|
||||||
public function list_export() {
|
public function list_export($days=NULL) {
|
||||||
|
if (! is_numeric($days))
|
||||||
|
$days = 90;
|
||||||
|
|
||||||
$o = $this->module->module();
|
$o = $this->module->module();
|
||||||
|
|
||||||
return $o
|
return $o
|
||||||
@ -35,7 +38,7 @@ class Model_Export_Module extends ORM_OSB {
|
|||||||
->on($this->export_item->table_name().'.site_id','=',$o->table_name().'.site_id') // @todo This should be automatic
|
->on($this->export_item->table_name().'.site_id','=',$o->table_name().'.site_id') // @todo This should be automatic
|
||||||
->on($this->export_item->table_name().'.item_id','=',$o->table_name().'.id')
|
->on($this->export_item->table_name().'.item_id','=',$o->table_name().'.id')
|
||||||
->on('export_module_id','=',$this->id)
|
->on('export_module_id','=',$this->id)
|
||||||
->where($o->table_name().'.date_orig','>=',time()-86400*90)
|
->where($o->table_name().'.date_orig','>=',time()-86400*$days)
|
||||||
->find_all();
|
->find_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,19 +419,8 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
* Check the reminder value
|
* Check the reminder value
|
||||||
*/
|
*/
|
||||||
public function remind($key) {
|
public function remind($key) {
|
||||||
if (! $this->loaded())
|
if (isset($this->reminders[$key]))
|
||||||
return NULL;
|
return (is_array($this->reminders[$key])) ? end($this->reminders[$key]) : $this->reminders[$key];
|
||||||
|
|
||||||
if (! trim($this->reminders))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (! preg_match('/^a:/',$this->reminders))
|
|
||||||
throw new Kohana_Exception('Reminder is not an array? (:reminder)',array(':remind',$this->reminders));
|
|
||||||
|
|
||||||
$remind = unserialize($this->reminders);
|
|
||||||
|
|
||||||
if (isset($remind[$key]))
|
|
||||||
return (is_array($remind[$key])) ? end($remind[$key]) : $remind[$key];
|
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -475,33 +464,21 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function set_remind($key,$value,$add=FALSE) {
|
public function set_remind($key,$value,$add=FALSE) {
|
||||||
if (! $this->loaded())
|
|
||||||
throw new Kohana_Exception('Cant call :method when a record not loaded.',array(':method',__METHOD__));
|
|
||||||
|
|
||||||
if (! trim($this->reminders)) {
|
|
||||||
$remind = array();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (! preg_match('/^a:/',$this->reminders))
|
|
||||||
throw new Kohana_Exception('Reminder is not an array? (:reminder)',array(':remind',$this->reminders));
|
|
||||||
|
|
||||||
$remind = unserialize($this->reminders);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If our value is null, we'll remove it.
|
// If our value is null, we'll remove it.
|
||||||
if (is_null($value) AND isset($remind[$key]))
|
if (is_null($value) AND isset($this->reminders[$key]))
|
||||||
unset($remind[$key]);
|
unset($this->reminders[$key]);
|
||||||
elseif ($add) {
|
|
||||||
if (! is_array($a=$remind[$key]))
|
|
||||||
$remind[$key] = array($a);
|
|
||||||
|
|
||||||
$remind[$key][] = $value;
|
elseif ($add) {
|
||||||
|
if (! is_array($a=$this->reminders[$key]))
|
||||||
|
$this->reminders[$key] = array($a);
|
||||||
|
|
||||||
|
$this->reminders[$key][] = $value;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
$remind[$key] = $value;
|
$this->reminders[$key] = $value;
|
||||||
|
|
||||||
$this->reminders = serialize($remind);
|
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
return $this->saved();
|
return $this->saved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
<?php if ($iio->service_id) : ?>
|
<?php if ($iio->service_id) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th colspan="2"><?php echo HTML::anchor(URL::link('user','service/view/'.$iio->service_id),$iio->service->id()).' '.$iio->service->service_name(); ?></th>
|
<!-- @todo product->title() should be changed to show the service_name() for the invoice product item -->
|
||||||
|
<th colspan="2"><?php echo HTML::anchor(URL::link('user','service/view/'.$iio->service_id),$iio->service->id()).' '.$iio->product->title(); ?></th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th><div class="text-right"><?php echo $o->service_items_total($iio,TRUE); ?></div></th>
|
<th><div class="text-right"><?php echo $o->service_items_total($iio,TRUE); ?></div></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -125,7 +125,7 @@ $(document).ready(function() {
|
|||||||
format : "dd-mm-yyyy",
|
format : "dd-mm-yyyy",
|
||||||
todayBtn : true,
|
todayBtn : true,
|
||||||
}).on("hide",function(ev) {
|
}).on("hide",function(ev) {
|
||||||
$("input[name=date_payment]").val(ev.date.valueOf());
|
$("input[name=date_payment]").val(ev.date.valueOf()/1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input[name=account_id_label]").typeahead({
|
$("input[name=account_id_label]").typeahead({
|
||||||
|
@ -28,13 +28,14 @@ class Controller_Reseller_Payment extends Controller_Payment {
|
|||||||
'id'=>'ID',
|
'id'=>'ID',
|
||||||
'date_payment'=>'Date',
|
'date_payment'=>'Date',
|
||||||
'checkout->display("name")'=>'Method',
|
'checkout->display("name")'=>'Method',
|
||||||
|
'total(TRUE)'=>'Total',
|
||||||
'balance(TRUE)'=>'Balance',
|
'balance(TRUE)'=>'Balance',
|
||||||
'invoicelist()'=>'Invoices',
|
'invoicelist()'=>'Invoices',
|
||||||
'account->accnum()'=>'Cust ID',
|
'account->accnum()'=>'Cust ID',
|
||||||
'account->name()'=>'Customer',
|
'account->name()'=>'Customer',
|
||||||
))
|
))
|
||||||
->prepend(array(
|
->prepend(array(
|
||||||
//'id'=>array('url'=>URL::link('reseller','payment/view/')), //@todo To Implement
|
//'id'=>array('url'=>URL::link('reseller','payment/edit/')), //@todo To Implement
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ class Model_Product extends ORM_OSB {
|
|||||||
if ($x = array_diff_key($_POST,$this->_object) AND ! empty($_POST['language_id']) AND ! empty($_POST['product_translate']) AND is_array($_POST['product_translate'])) {
|
if ($x = array_diff_key($_POST,$this->_object) AND ! empty($_POST['language_id']) AND ! empty($_POST['product_translate']) AND is_array($_POST['product_translate'])) {
|
||||||
$pto = $this->product_translate->where('language_id','=',$_POST['language_id'])->find();
|
$pto = $this->product_translate->where('language_id','=',$_POST['language_id'])->find();
|
||||||
|
|
||||||
// For a new entry, we need to set the product_cat_id
|
// For a new entry, we need to set the product_id
|
||||||
if (! $pto->loaded()) {
|
if (! $pto->loaded()) {
|
||||||
$pto->product_cat_id = $this->id;
|
$pto->product_id = $this->id;
|
||||||
$pto->language_id = $_POST['language_id'];
|
$pto->language_id = $_POST['language_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
* @license http://dev.osbill.net/license.html
|
* @license http://dev.osbill.net/license.html
|
||||||
*/
|
*/
|
||||||
class Model_Product_Translate extends ORM_OSB {
|
class Model_Product_Translate extends ORM_OSB {
|
||||||
|
protected $_created_column = FALSE;
|
||||||
protected $_updated_column = FALSE;
|
protected $_updated_column = FALSE;
|
||||||
|
|
||||||
protected $_belongs_to = array(
|
protected $_belongs_to = array(
|
||||||
|
@ -113,7 +113,7 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
|||||||
$output = Form::open(URL::link('user','ssl/download'),array('class'=>'form-inline'));
|
$output = Form::open(URL::link('user','ssl/download'),array('class'=>'form-inline'));
|
||||||
$output .= Form::hidden('sid',$this->service->id);
|
$output .= Form::hidden('sid',$this->service->id);
|
||||||
$output .= '<div class="input-append">';
|
$output .= '<div class="input-append">';
|
||||||
$output .= Form::password('passwd','',array('label'=>_('Choose a password'),'placeholder'=>'Password','required','nocg'=>TRUE,'pattern'=>'.{6,}','title'=>'Minimum 6 chars'));
|
$output .= Form::password('passwd','',array('placeholder'=>_('Choose a password'),'required','nocg'=>TRUE,'pattern'=>'.{6,}','title'=>'Minimum 6 chars'));
|
||||||
$output .= Form::button('download','Download',array('class'=>'btn btn-default','nocg'=>TRUE));
|
$output .= Form::button('download','Download',array('class'=>'btn btn-default','nocg'=>TRUE));
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
$output .= Form::close();
|
$output .= Form::close();
|
||||||
|
@ -18,7 +18,7 @@ class Task_Task_Run extends Minion_Task {
|
|||||||
if (! $to->status)
|
if (! $to->status)
|
||||||
throw new Minion_Exception_InvalidTask('Task :task (:name) NOT active',array(':task'=>$params['id'],':name'=>$to->name));
|
throw new Minion_Exception_InvalidTask('Task :task (:name) NOT active',array(':task'=>$params['id'],':name'=>$to->name));
|
||||||
|
|
||||||
Kohana::$config->load('debug')->task_sim ? printf("Would Run task: (%s) %s\n",$to->id,$to->name) : $this->_run($to,$params['force']);
|
Kohana::$config->load('debug')->task_sim ? printf("Would Run task: (%s) %s\n",$to->id,$to->name) : $this->_run($to,$params['force'],$params['verbose']);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
throw new Minion_Exception_InvalidTask('Unknown task :task',array(':task'=>$params['id']));
|
throw new Minion_Exception_InvalidTask('Unknown task :task',array(':task'=>$params['id']));
|
||||||
@ -32,7 +32,10 @@ class Task_Task_Run extends Minion_Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _run(Model_Task $to,$force=FALSE) {
|
private function _run(Model_Task $to,$force=FALSE,$verbose=FALSE) {
|
||||||
|
if ($verbose)
|
||||||
|
printf("Running Task: %s\n",$to->id);
|
||||||
|
|
||||||
$r = rand(0,9999);
|
$r = rand(0,9999);
|
||||||
$tlo = ORM::factory('Task_Log');
|
$tlo = ORM::factory('Task_Log');
|
||||||
$tlo->task_id = $to->id;
|
$tlo->task_id = $to->id;
|
||||||
@ -95,6 +98,9 @@ class Task_Task_Run extends Minion_Task {
|
|||||||
$to->save();
|
$to->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($verbose)
|
||||||
|
printf("Message: %s\n",$tlo->message);
|
||||||
|
|
||||||
if ($to->log)
|
if ($to->log)
|
||||||
$tlo->save();
|
$tlo->save();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user