function build_component_clientorders_list($id) { $fields = array("id", "price"); $query_fields = " id, price "; $where = " parent_id = '{$id}' "; $component_list = $this->getComponentListData($fields, $query_fields, 'clientorders_components', $where); $components_to_clientorder = array(); for ($i = 0; $i < count($component_list); $i++) { $component = new ClientorderComponents(); $component->retrieve($component_list[$i]['id']); $query = " SELECT id, status FROM componentclientordercalc WHERE deleted=0 and component_id='{$component->id}' "; $result = $this->db->query($query, true, "Error filling layout fields: "); $data = $this->db->fetchByAssoc($result); if ($data == null) { $temp = array(); $temp['id'] = $component->id; $temp['name'] = $component->name; $temp['price'] = $component->price; $temp['outdated'] = false; $components_to_clientorder[] = $temp; } if ($data['status'] == "outdated") { $temp = array(); $temp['id'] = $component->id; $temp['name'] = $component->name; $temp['clientorder_id'] = $component->parent_id; $temp['clientorder_name'] = $component->parent_name; $temp['price'] = $component->price; $temp['clientorder_id'] = $data['id']; $temp['outdated'] = true; $components_to_clientorder[] = $temp; } } return $components_to_clientorder; }