Updated for new lnApp

This commit is contained in:
Deon George
2014-08-25 14:41:07 +10:00
parent 52e94c6e7d
commit c1b1485c10
44 changed files with 208 additions and 481 deletions

View File

@@ -25,10 +25,10 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
protected $_display_filters = array(
'service_connect_date'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'service_contract_date'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);
@@ -66,14 +66,14 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
* Calculate our contract start and end dates
*/
public function contract_date_start($format=FALSE) {
return $format ? Config::date($this->service_contract_date) : $this->service_contract_date;
return $format ? Site::Date($this->service_contract_date) : $this->service_contract_date;
}
public function contract_date_end($format=FALSE) {
// ADSL Contract Terms are held in the ADSL Plan
$x = strtotime(sprintf('+%s months',$this->service->plugin()->contract_term),$this->service_contract_date);
return $format ? Config::date($x) : $x;
return $format ? Site::Date($x) : $x;
}
/**
@@ -248,7 +248,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
$google = GoogleChart::factory('Legacy')
->type('vertical_bar')
->title(sprintf('DSL traffic usage as at %s',Config::date($data['last'])));
->title(sprintf('DSL traffic usage as at %s',Site::Date($data['last'])));
foreach ($traffic_type as $k => $details)
$google->sdata(array('yl'=>($x=$this->traffic->friendly($k))),array($x=>$details));
@@ -277,7 +277,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
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 'SERVICE_NUMBER': $value = $this->service_number; break;
case 'USAGE_DATE': $value = Config::date($data['last']); break;
case 'USAGE_DATE': $value = Site::Date($data['last']); break;
case 'USER_NAME': $value = $this->service->account->name(); break;
default:
$value = '';

View File

@@ -36,10 +36,10 @@ class Model_Charge extends ORM_OSB implements Invoicable {
array('Currency::display',array(':value')),
),
'date_orig'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_charge'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'processed'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),

View File

@@ -17,10 +17,14 @@ class Model_Checkout_Notify extends ORM_OSB implements Invoicable {
protected $_display_filters = array(
'date_orig'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);
protected $_compress_column = array(
'data',
);
public function invoice_item($item_type) {
return sprintf('Payment Fee: %s',$this->checkout->name);
}

View File

@@ -23,13 +23,13 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
protected $_display_filters = array(
'domain_expire'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'domain_name'=>array(
array('strtoupper',array(':value')),
),
'registrar_lastsync'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);

View File

@@ -24,18 +24,18 @@ class Email_Template {
throw new Kohana_Exception('Email template :template not defined in DB',array(':template'=>$template));
if (is_null($language_id))
$language_id = Config::language();
$language_id = Company::instance()->language();
$this->_etto = $eto->translate
->where_open()
->where('language_id','=',$language_id)
->or_where('language_id','=',Config::language())
->or_where('language_id','=',Company::instance()->language())
->where_close()
->find();
if (! $this->_etto->loaded())
throw new Kohana_Exception('No template (:template) found for user language (:language_id) or default language (:default_lang)',
array(':template'=>$eto->name,':language_id'=>$language_id,':default_lang'=>Config::language()));
array(':template'=>$eto->name,':language_id'=>$language_id,':default_lang'=>Company::instance()->language()));
}
public function __set($key,$value) {

View File

@@ -22,9 +22,13 @@ class Model_Email_Log extends ORM_OSB {
'id'=>'DESC',
);
protected $_compress_column = array(
'data',
);
protected $_display_filters = array(
'date_orig'=>array(
array('Config::datetime',array(':value')),
array('Site::Datetime',array(':value')),
),
);

View File

@@ -88,7 +88,7 @@ class Controller_Reseller_Export extends Controller_Export {
->prepend(array(
'id'=>array('checkbox'=>'id[]'),
))->filters(array(
'exported'=>array(array('Config::date',array(':value'))),
'exported'=>array(array('Site::Date',array(':value'))),
));
$output .= '</div>';

View File

@@ -16,6 +16,10 @@ class Model_Export_DataMap extends ORM_OSB {
'module' => array(),
);
protected $_compress_column = array(
'map_data',
);
public function list_itemsnoexport(Model $o,$emoid,$desc='title()') {
$result = array();

View File

@@ -22,6 +22,10 @@ class Model_Export_Module extends ORM_OSB {
'export_item' => array('far_key'=>'id'),
);
protected $_compress_column = array(
'display',
);
protected $_nullifempty = array(
'display',
);

View File

@@ -31,7 +31,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
array('strtoupper',array(':value')),
),
'host_expire'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);

View File

@@ -28,10 +28,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
protected $_display_filters = array(
'date_orig'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'due_date'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
@@ -46,6 +46,10 @@ class Model_Invoice extends ORM_OSB implements Cartable {
'invoice_item'=>'service_id,item_type,date_start,date_stop',
);
protected $_compress_column = array(
'reminders',
);
private $_render = array();
// Our required Interface Methods

View File

@@ -21,13 +21,13 @@ class Model_Invoice_Item extends ORM_OSB {
protected $_display_filters = array(
'date_orig'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_start'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_stop'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);
@@ -104,7 +104,7 @@ class Model_Invoice_Item extends ORM_OSB {
// Display the period that a transaction applies
public function period() {
return ($this->date_start == $this->date_stop) ? Config::date($this->date_start) : sprintf('%s -> %s',Config::date($this->date_start),Config::date($this->date_stop));
return ($this->date_start == $this->date_stop) ? Site::Date($this->date_start) : sprintf('%s -> %s',Site::Date($this->date_start),Site::Date($this->date_stop));
}
public function save(Validation $validation = NULL) {

View File

@@ -23,8 +23,12 @@ class Model_Invoice_Memo extends ORM_OSB {
*/
protected $_display_filters = array(
'date_orig'=>array(
array('Config::datetime',array(':value')),
array('Site::Datetime',array(':value')),
),
);
protected $_compress_column = array(
'memo',
);
}
?>

View File

@@ -10,6 +10,10 @@
* @license http://dev.osbill.net/license.html
*/
class Model_Account_Oauth extends ORM_OSB {
protected $_compress_column = array(
'oauth_data',
);
// Relationships
protected $_has_one = array(
'account' => array('foreign_key'=>'id'),

View File

@@ -26,10 +26,10 @@ class Model_Payment extends ORM_OSB {
protected $_display_filters = array(
'date_orig'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_payment'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'fees_amt'=>array(
array('Currency::display',array(':value')),
@@ -241,7 +241,7 @@ class Model_Payment extends ORM_OSB {
$sql .= ' GROUP BY A.id';
$sql .= ' HAVING round(A.total_amt-ALLOC,2) <> 0';
foreach ($db->query(Database::SELECT,__($sql,array(':prefix_'=>$db->table_prefix(),':site_id'=>Config::siteid()))) as $values)
foreach ($db->query(Database::SELECT,__($sql,array(':prefix_'=>$db->table_prefix(),':site_id'=>Site::ID()))) as $values)
array_push($pid,$values['id']);
return $this->where('id','IN',$pid)->order_by('account_id')->find_all();

View File

@@ -37,6 +37,13 @@ class Model_Product extends ORM_OSB implements Invoicable {
protected $_form = array('id'=>'id','value'=>'description()');
protected $_compress_column = array(
'avail_category',
'group_avail',
'price_group',
'prod_plugin_data',
);
protected $_nullifempty = array(
'price_group',
);
@@ -207,7 +214,7 @@ class Model_Product extends ORM_OSB implements Invoicable {
}
private function translate() {
return $this->translate->where('language_id','=',Config::language())->find();
return $this->translate->where('language_id','=',Company::instance()->language())->find();
}
/**

View File

@@ -106,7 +106,7 @@ class Model_Product_Category extends ORM_OSB {
private function translate() {
return $this->translate->where('language_id','=',Config::language())->find();
return $this->translate->where('language_id','=',Company::instance()->language())->find();
}
}
?>

View File

@@ -18,6 +18,10 @@ class Model_Product_Category_Translate extends ORM_OSB {
'language'=>array('foreign_key'=>'id'),
);
protected $_compress_column = array(
'description',
);
protected $_save_message = TRUE;
}
?>

View File

@@ -21,6 +21,10 @@ class Model_Product_Translate extends ORM_OSB {
'language'=>array('foreign_key'=>'id'),
);
protected $_compress_column = array(
'description_full',
);
protected $_save_message = TRUE;
}
?>

View File

@@ -267,18 +267,18 @@ $(document).ready(function() {
case 4:
case 5:
if ($iio->date_start != $pdata['start_time']) {
$doutput .= sprintf('%s: Set start_time: %s [%s]<br/>',$iio->id,Config::date($pdata['start_time']),$pdata['start_time']);
$doutput .= sprintf('%s: Set start_time: %s [%s]<br/>',$iio->id,Site::Date($pdata['start_time']),$pdata['start_time']);
$iio->date_start=$pdata['start_time'];
}
if (! $pr AND $iio->date_stop != $pdata['end_time']) {
$doutput .= sprintf('%s: Set end_time: %s [%s] <br/>',$iio->id,Config::date($pdata['end_time']),$pdata['end_time']);
$doutput .= sprintf('%s: Set end_time: %s [%s] <br/>',$iio->id,Site::Date($pdata['end_time']),$pdata['end_time']);
$iio->date_stop = $pdata['end_time'];
}
$bt = ($pr ? $iio->date_stop : $pdata['end_time'])+86400;
// $doutput .= sprintf('%s: BT now: %s (%s) [%s]<br/>',$iio->id,Config::date($bt),Config::date($pdata['end_time']),$bt);
// $doutput .= sprintf('%s: BT now: %s (%s) [%s]<br/>',$iio->id,Site::Date($bt),Site::Date($pdata['end_time']),$bt);
break;
default:

View File

@@ -47,16 +47,16 @@ class Model_Service extends ORM_OSB {
*/
protected $_display_filters = array(
'date_start'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_end'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_last_invoice'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_next_invoice'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'external_billing'=>array(
array('StaticList_YesNo::get',array(':value',TRUE)),
@@ -136,7 +136,7 @@ class Model_Service extends ORM_OSB {
// If $expire is NULL, we'll use the next invoice date
$expire = is_null($expire) ? $this->paid_to() : $expire;
return $format ? Config::date($expire) : $expire;
return $format ? Site::Date($expire) : $expire;
}
/**
@@ -183,7 +183,7 @@ class Model_Service extends ORM_OSB {
$x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : ($iio->total() < 0 ? $iio->date_start-86400 : $iio->date_stop);
return $format ? Config::date($x) : $x;
return $format ? Site::Date($x) : $x;
}
private function last_invoice_item() {
@@ -217,7 +217,7 @@ class Model_Service extends ORM_OSB {
break;
}
return $format ? ($x ? Config::date($metric) : '&nbsp;') : ($x ? $metric : NULL);
return $format ? ($x ? Site::Date($metric) : '&nbsp;') : ($x ? $metric : NULL);
}
/**

View File

@@ -23,10 +23,10 @@ class Model_Service_Change extends ORM_OSB {
*/
protected $_display_filters = array(
'date_ordered'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
'date_effective'=>array(
array('Config::date',array(':value')),
array('Site::Date',array(':value')),
),
);

View File

@@ -18,12 +18,16 @@ class Model_Service_Memo extends ORM_OSB {
'account'=>array('foreign_key'=>'id'),
);
protected $_compress_column = array(
'memo',
);
/**
* Filters used to format the display of values into friendlier values
*/
protected $_display_filters = array(
'date_orig'=>array(
array('Config::datetime',array(':value')),
array('Site::Datetime',array(':value')),
),
);
}

View File

@@ -17,7 +17,7 @@
<div class="row">
<div class="input-append date" id="date_next_invoice_label">
<?php echo Form::input('date_next_invoice_label',Config::date(time()),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
<?php echo Form::input('date_next_invoice_label',Site::Date(time()),array('class'=>'span2','label'=>'Date Next Invoice','add-on'=>'<i class="icon-calendar"></i>','disabled')); ?>
</div>
<?php echo Form::hidden('date_next_invoice',time()); ?>

View File

@@ -188,13 +188,13 @@ class SSL {
public function get_valid_to($format=FALSE) {
$k = $this->_details('validTo_time_t');
return $format ? Config::date($k) : $k;
return $format ? Site::Date($k) : $k;
}
public function get_valid_from($format=FALSE) {
$k = $this->_details('validFrom_time_t');
return $format ? Config::date($k) : $k;
return $format ? Site::Date($k) : $k;
}
public function get_version() {

View File

@@ -12,7 +12,7 @@
class Model_Task extends ORM_OSB {
protected $_display_filters = array(
'date_run'=>array(
array('Config::datetime',array(':value')),
array('Site::Datetime',array(':value')),
),
);
@@ -26,7 +26,7 @@ class Model_Task extends ORM_OSB {
public function next_run($format=FALSE) {
$x = $this->_cron()->next($this->date_run);
return $format ? Config::datetime($x) : $x;
return $format ? Site::Datetime($x) : $x;
}
}
?>

View File

@@ -18,9 +18,13 @@ class Model_Task_Log extends ORM_OSB {
'task'=>array(),
);
protected $_compress_column = array(
'message',
);
protected $_display_filters = array(
'date_orig'=>array(
array('Config::datetime',array(':value')),
array('Site::Datetime',array(':value')),
),
);
}