diff --git a/app/Controllers/Admin/Customer/CustomerController.php b/app/Controllers/Admin/Customer/CustomerController.php index 6c83547..3d1d112 100644 --- a/app/Controllers/Admin/Customer/CustomerController.php +++ b/app/Controllers/Admin/Customer/CustomerController.php @@ -75,11 +75,10 @@ abstract class CustomerController extends AdminController { switch ($field) { case 'clientinfo_uid': - $temps = []; + $options = []; foreach ($this->getClientService()->getEntities() as $entity) { - $temps[$entity->getPK()] = $entity->getTitle(); + $options[$entity->getPK()] = $entity->getTitle(); } - $options[$field] = $temps; break; case 'SERVER': case 'CPU': @@ -90,12 +89,11 @@ abstract class CustomerController extends AdminController case 'DEFENCE': case 'SOFTWARE': case 'DOMAIN': - $temps = []; + $options = []; // throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.->{$item_type}"); foreach ($this->getEquipmentService($field)->getEntities() as $entity) { - $temps[$entity->getPK()] = $entity->getTitle(); + $options[$entity->getPK()] = $entity->getTitle(); } - $options[$field] = $temps; break; default: $options = parent::getFormFieldOption($field); diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 00f32f7..efab706 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -49,7 +49,7 @@ class ServiceController extends CustomerController { switch ($this->getAction()) { case 'index': - $this->control = $this->_control; + $this->control = $this->getControlDatas(); $this->getHelper()->setViewDatas($this->getViewDatas()); $result = view($this->view_path . 'service' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]); break; @@ -65,13 +65,15 @@ class ServiceController extends CustomerController //추가 Field작업 처리 $this->item_types = lang($this->getServiceItemService()->getClassName() . '.' . strtoupper('ITEM_TYPE')); foreach ($this->item_types as $field => $label) { - $this->field_options = $this->getFormFieldOption($field, $this->field_options); + $this->setFilterFieldOption($field, $this->getFormFieldOption($field)); } $entities = []; foreach (parent::index_process() as $entity) { foreach ($this->item_types as $field => $label) { - $itemEntities = $this->getServiceItemService()->getEntities(['item_type' => $field]); - $entity->setItemEntities($field, $itemEntities); + $entity->setItemEntities( + $field, + $this->getServiceItemService()->getEntities(['item_type' => $field]) + ); } $entities[] = $entity; } diff --git a/app/Controllers/Admin/Customer/ServiceItemController.php b/app/Controllers/Admin/Customer/ServiceItemController.php index 801564d..ec717f1 100644 --- a/app/Controllers/Admin/Customer/ServiceItemController.php +++ b/app/Controllers/Admin/Customer/ServiceItemController.php @@ -78,7 +78,7 @@ class ServiceItemController extends CustomerController { switch ($this->getAction()) { case 'index': - $this->control = $this->_control; + $this->control = $this->getControlDatas(); $this->getHelper()->setViewDatas($this->getViewDatas()); $result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]); break; diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 7659915..5764657 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -66,6 +66,10 @@ abstract class CommonController extends BaseController return $this->_myLogService; } //Index,FieldForm관련 + final protected function getControlDatas(): array + { + return $this->_control; + } final protected function setAction(string $action): void { $this->_control['action'] = $action; @@ -241,8 +245,7 @@ abstract class CommonController extends BaseController case 'login_form': case 'index': case 'view': - $this->control = $this->_control; - // dd($this->control); + $this->control = $this->getControlDatas(); $this->getHelper()->setViewDatas($this->getViewDatas()); $result = view($this->view_path . $this->getAction(), [ 'viewDatas' => $this->getViewDatas() diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index 0711053..75b01d6 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -12,12 +12,9 @@ class ServiceEntity extends CustomerEntity { return $this->attributes[$type] ?? []; } - public function setItemEntities(string $type, array $partEntities): void + public function setItemEntities(string $type, array $itemEntities): void { - if (!isset($this->attributes[$type])) { - $this->attributes[$type] = []; - } - $this->attributes[$type] = $partEntities; + $this->attributes[$type] = $itemEntities; // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR); } } diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 401662d..cbe12cb 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -59,7 +59,13 @@ class ServiceHelper extends CustomerHelper case "DOMAIN": $temps = ["