Changed use of active to status

This commit is contained in:
Deon George
2012-08-01 22:43:33 +10:00
parent e4d600b8d0
commit 4220ade8ac
40 changed files with 123 additions and 145 deletions

View File

@@ -26,9 +26,6 @@ class Model_Product extends ORMOSB {
);
protected $_display_filters = array(
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'price_base'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
@@ -36,6 +33,9 @@ class Model_Product extends ORMOSB {
'price_type'=>array(
array('StaticList_PriceType::display',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'taxable'=>array(
array('StaticList_YesNo::display',array(':value')),
),
@@ -173,6 +173,20 @@ class Model_Product extends ORMOSB {
return array('price_base','price_setup');
}
/**
* List the number of services using this product
*/
public function count_services() {
return $this->service->list_count(TRUE);
}
/**
* List the number of invoices using this product
*/
public function count_invoices() {
return $this->invoice->list_count(TRUE);
}
/**
* Return the price for the particle group and price option for the period
*/
@@ -182,20 +196,6 @@ class Model_Product extends ORMOSB {
return isset($x[$grp][$option]) ? $x[$grp][$option] : NULL;
}
/**
* List the number of services using this product
*/
public function services_count() {
return $this->service->where('active','=',1)->find_all()->count();
}
/**
* List the number of invoices using this product
*/
public function invoices_count() {
return $this->invoice->where('status','=',1)->find_all()->count();
}
/**
* Return the products for a given category
* @todo This shouldnt be here.
@@ -203,10 +203,7 @@ class Model_Product extends ORMOSB {
public function list_category($cat,$active=TRUE) {
$results = array();
if ($active)
$cats = $this->where('active','=',TRUE);
else
$cats = $this;
$cats = $active ? $this->_where_active() : $this;
foreach ($cats->find_all() as $po) {
if ($c = unserialize($po->avail_category) AND in_array($cat,$c))