|
@@ -422,33 +422,32 @@ class Project extends Base_Controller {
|
|
|
$join[] = ['table'=>'company as C','cond'=>'L.manu = C.id','type'=>'inner'];
|
|
|
$group = 'L.manu,L.projectid';
|
|
|
$order = 'convert(C.name using gbk) asc';
|
|
|
- $fields = 'C.name as company,P.projectname,P.id';
|
|
|
+ $fields = 'C.name as company,P.projectname,P.id,C.id as cId';
|
|
|
}elseif ($type == 2) {
|
|
|
$join[] = ['table'=>'company as C','cond'=>'L.supplier = C.id','type'=>'inner'];
|
|
|
$group = 'L.supplier,L.projectid';
|
|
|
$order = 'convert(C.name using gbk) asc';
|
|
|
- $fields = 'C.name as company,P.projectname,P.id';
|
|
|
+ $fields = 'C.name as company,P.projectname,P.id,C.id as cId';
|
|
|
}elseif ($type == 3) {
|
|
|
$join[] = ['table'=>'company as C','cond'=>'L.po = C.id','type'=>'inner'];
|
|
|
$group = 'L.po,L.projectid';
|
|
|
$order = 'convert(C.name using gbk) asc';
|
|
|
- $fields = 'C.name as company,P.projectname,P.id';
|
|
|
+ $fields = 'C.name as company,P.projectname,P.id,C.id as cId';
|
|
|
}else {
|
|
|
$join[] = ['table'=>'company as C','cond'=>'L.upazilla = C.id','type'=>'inner'];
|
|
|
$group = 'L.upazilla,L.projectid';
|
|
|
$order = 'convert(C.name using gbk) asc';
|
|
|
- $fields = 'C.name as company,P.projectname,P.id';
|
|
|
+ $fields = 'C.name as company,P.projectname,P.id,C.id as cId';
|
|
|
}
|
|
|
|
|
|
- $data = $this->Lamp_model->get_list_by_join($where, $fields='*',NULL, NULL, $join, $order, $group, 'L');
|
|
|
-
|
|
|
+ $data = $this->Lamp_model->get_list_by_join($where, $fields,NULL, NULL, $join, $order, $group, 'L');
|
|
|
if (!empty($data)) {
|
|
|
$temp = array();
|
|
|
$temp2 = array();
|
|
|
foreach ($data as $key => $value) {
|
|
|
$value['sectionList'] = array();
|
|
|
$temp[$value['id']] = $value;
|
|
|
- $temp2[$value['company']] = array('company'=>$value['company'],'projectList'=>array());
|
|
|
+ $temp2[$value['cId']] = array('company'=>$value['company'],'cId'=>$value['cId'],'projectList'=>array());
|
|
|
}
|
|
|
$projectIdArr = array_column($data, 'id');
|
|
|
$sectionList = $this->Lamp_model->get_list(['projectid'=>$projectIdArr], 'section as name,projectid',NULL, NULL, 'convert(section using gbk) asc', 'projectid,section');
|
|
@@ -460,9 +459,10 @@ class Project extends Base_Controller {
|
|
|
}
|
|
|
$temp = array_values($temp);
|
|
|
foreach ($temp as $key => $value) {
|
|
|
- if (isset($temp2[$value['company']])) {
|
|
|
+ if (isset($temp2[$value['cId']])) {
|
|
|
+ unset($value['cId']);
|
|
|
unset($value['company']);
|
|
|
- $temp[$temp[$key]['company']]['projectList'][] = $value;
|
|
|
+ $temp2[$temp[$key]['cId']]['projectList'][] = $value;
|
|
|
}
|
|
|
}
|
|
|
$data = array_values($temp2);
|