diff --git a/module/program/control.php b/module/program/control.php index f947a34e8d..7db35edf8a 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -707,29 +707,7 @@ class program extends control if($this->config->systemMode == 'light' and $orderBy == 'program_asc') $orderBy = 'order_asc'; $queryID = strtolower($browseType) == 'bysearch' ? $param : 0; $products = strtolower($browseType) == 'bysearch' ? $this->product->getListBySearch($queryID) : $this->product->getList(); - - /* Filter the program by browse type. */ - foreach($products as $index => $product) - { - $programID = $product->program; - /* The product associated with the program. */ - if(!empty($programID)) - { - $program = $this->program->getByID($programID); - if(!empty($program) && in_array($browseType, array('all', 'unclosed', 'wait', 'doing', 'suspended', 'closed'))) - { - if($browseType == 'unclosed' && $program->status == 'closed') - unset($products[$index]); - elseif($browseType != 'unclosed' && $browseType != 'all' && $program->status != $browseType) - unset($products[$index]); - } - } - else - { - /* The product without program only can be viewed when browse type is all and not closed. */ - if($browseType != 'all' and $browseType != 'unclosed') unset($products[$index]); - } - } + $products = $this->programZen->getProductsByBrowseType($browseType, $products); /* Filter the program by browse type. */ $productStats = $this->product->getStats(array_keys($products), $orderBy, $pager); /* The product stats list with program data and product data. */ $productStructure = $this->product->statisticProgram($productStats);