Internal overhaul

This commit is contained in:
Deon George
2013-11-28 17:41:34 +11:00
parent 0ed5e5163d
commit f8a5b153cf
91 changed files with 1570 additions and 1619 deletions

View File

@@ -29,6 +29,8 @@ class Model_Service extends ORM_OSB {
'account'=>array(),
);
protected $_save_message = TRUE;
// Validation rules
public function rules() {
$x = Arr::merge(parent::rules(), array(
@@ -167,7 +169,7 @@ class Model_Service extends ORM_OSB {
$iio->find();
$x = (! $iio->loaded() AND $this->date_next_invoice) ? $this->date_next_invoice-86400 : $iio->date_stop;
$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;
}
@@ -255,7 +257,7 @@ class Model_Service extends ORM_OSB {
* Return a descriptive name for this service
*/
public function service_name() {
return is_null($plugin=$this->plugin()) ? $this->name() : $plugin->service_name();
return is_null($x=$this->plugin()) ? $this->name() : $x->service_name();
}
/**
@@ -286,16 +288,17 @@ class Model_Service extends ORM_OSB {
case 'invoice_detail_items':
return is_null($plugin) ? array() : $plugin->_details($type);
case 'service_view':
return is_null($plugin) ? HTML::nbsp('') : $plugin->render_view();
default:
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
}
}
public function service_view() {
return ! is_object($x=$this->plugin()) ? HTML::nbsp('') : $x->render_view();
}
public function transactions() {
return $this->invoice_item->order_by('date_start')->order_by('date_stop');
return $this->invoice_item->order_by('date_start','ASC')->order_by('product_id','ASC')->order_by('date_stop','ASC');
}
/** LIST FUNCTIONS **/