From 9435c8440e1f9d1973731b5d1ad5d882351d6e0d Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Mon, 8 Sep 2025 19:04:32 +0900 Subject: [PATCH] dbmsv2 init...1 --- .../Admin/Equipment/ServerController.php | 6 +- app/Controllers/CommonController.php | 13 ++-- app/Database/dbmsv2.vuerd.json | 17 +++--- app/Entities/CommonEntity.php | 4 ++ app/Entities/Equipment/PartEntity.php | 4 +- app/Entities/Equipment/ServerEntity.php | 4 +- app/Entities/Equipment/ServerPartEntity.php | 2 +- app/Helpers/CommonHelper.php | 24 ++------ app/Helpers/Customer/ServiceHelper.php | 3 - app/Helpers/Equipment/ServerHelper.php | 4 ++ app/Language/en/Equipment/IP.php | 2 +- app/Language/en/Equipment/Server.php | 1 - app/Models/Equipment/ServerModel.php | 2 - app/Services/Auth/GoogleService.php | 2 +- app/Services/CommonService.php | 4 +- app/Services/Customer/ServiceService.php | 43 ++++++++++---- app/Services/Equipment/ServerPartService.php | 27 ++++----- app/Services/Equipment/ServerService.php | 59 +++++++++---------- app/Views/admin/index.php | 1 + app/Views/admin/server/create_form.php | 2 +- app/Views/admin/server/index.php | 9 ++- app/Views/admin/server/modify_form.php | 2 +- app/Views/admin/server/view.php | 8 +-- app/Views/admin/service/create_form.php | 24 -------- app/Views/admin/service/index.php | 3 +- app/Views/admin/service/modify_form.php | 24 -------- 26 files changed, 121 insertions(+), 173 deletions(-) delete mode 100644 app/Views/admin/service/create_form.php delete mode 100644 app/Views/admin/service/modify_form.php diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index 0acd11e..7ff4792 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -38,8 +38,6 @@ class ServerController extends EquipmentController protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { switch ($this->getAction()) { - case 'create_form': - case 'modify_form': case 'view': case 'index': $this->control = $this->getControlDatas(); @@ -58,7 +56,7 @@ class ServerController extends EquipmentController } return $result; } - protected function getFormData(string $field, array $requestDatas, array $formDatas): array + protected function setFormData(string $field, array $requestDatas, array $formDatas): array { switch ($field) { case 'CPU': @@ -72,7 +70,7 @@ class ServerController extends EquipmentController $formDatas["{$field}_extra"] = $requestDatas["{$field}_extra"] ?? null; break; default: - $formDatas = parent::getFormData($field, $requestDatas, $formDatas); + $formDatas = parent::setFormData($field, $requestDatas, $formDatas); } return $formDatas; } diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 7dc529d..f612692 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -165,20 +165,15 @@ abstract class CommonController extends BaseController $this->setControlDatas('field_optons', $options); } //FormDatas 전달값,Default값 - final protected function getFormDatas($formDatas = []): array + final protected function getFormDatas(): array { - foreach ($this->getControlDatas('form_datas') as $field => $value) { - $formDatas[$field] = $value; - } - return $formDatas; + return $this->getControlDatas('form_datas'); } final protected function setFormDatas(array $requestDatas, array $formDatas = []): void { foreach ($this->getControlDatas('actionFields') as $field) { - $formDatas = $this->getFormData($field, $requestDatas, $formDatas); + $formDatas = $this->setFormData($field, $requestDatas, $formDatas); } - // echo var_dump($requestDatas); - // dd($formDatas); $this->setControlDatas('form_datas', $formDatas); } //FormDatas 검증 @@ -227,7 +222,7 @@ abstract class CommonController extends BaseController return $options; } //FormData Field별 전달값 처리 - protected function getFormData(string $field, array $requestDatas, array $formDatas): array + protected function setFormData(string $field, array $requestDatas, array $formDatas): array { switch ($field) { default: diff --git a/app/Database/dbmsv2.vuerd.json b/app/Database/dbmsv2.vuerd.json index 7fc9fd7..fc4406c 100644 --- a/app/Database/dbmsv2.vuerd.json +++ b/app/Database/dbmsv2.vuerd.json @@ -4,9 +4,9 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -1058.7976, - "scrollLeft": -797, - "zoomLevel": 0.91, + "scrollTop": -1366.5228, + "scrollLeft": -185.0714, + "zoomLevel": 0.73, "show": 511, "database": 4, "databaseName": "", @@ -250,7 +250,6 @@ "m77kSp3scTgMhInPBjsc3", "9F6QpQqxeEggZ0FHM81O1", "tsDqk1dzwzUtvBzpjmarJ", - "DPWDmZrk302pW-5V72rvt", "hmZlcR-Pw2C_ife1zzo5o", "AGBQ4FnuIDU-Dy5QoS0Fu", "bh-W1plz0vCW2rURDnfDR", @@ -327,7 +326,7 @@ "color": "" }, "meta": { - "updateAt": 1756961447384, + "updateAt": 1757309382902, "createAt": 1745819764137 } }, @@ -8777,7 +8776,7 @@ "RITMHZcQAJ7KvtxkTtMv-" ], "x": 1472.7756, - "y": 2238.6057, + "y": 2226.6057, "direction": 2 }, "end": { @@ -8814,7 +8813,7 @@ "4iRyOhmW3b7kbiZT8lQyY" ], "x": 1472.7756, - "y": 2107.9390333333336, + "y": 2103.9390333333336, "direction": 2 }, "meta": { @@ -8889,7 +8888,7 @@ "RITMHZcQAJ7KvtxkTtMv-" ], "x": 948.7756, - "y": 2238.6057, + "y": 2226.6057, "direction": 1 }, "end": { @@ -8917,7 +8916,7 @@ "RITMHZcQAJ7KvtxkTtMv-" ], "x": 1472.7756, - "y": 2369.2723666666666, + "y": 2349.2723666666666, "direction": 2 }, "end": { diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php index b95bb15..fca306c 100644 --- a/app/Entities/CommonEntity.php +++ b/app/Entities/CommonEntity.php @@ -27,6 +27,10 @@ abstract class CommonEntity extends Entity $field = constant("static::TITLE"); return $this->attributes[$field]; } + public function getCustomTitle(): string + { + return $this->getTitle(); + } public function getStatus(): string|null { return $this->attributes['status'] ?? null; diff --git a/app/Entities/Equipment/PartEntity.php b/app/Entities/Equipment/PartEntity.php index 32c11a9..9bd6380 100644 --- a/app/Entities/Equipment/PartEntity.php +++ b/app/Entities/Equipment/PartEntity.php @@ -18,8 +18,8 @@ class PartEntity extends EquipmentEntity { return $this->attributes['price']; } - public function getFormTitle(): string + public function getCustomTitle(): string { - return number_format($this->getPrice()) . "원," . $this->getTitle(); + return $this->getTitle() . " " . number_format($this->getPrice()) . "원,"; } } diff --git a/app/Entities/Equipment/ServerEntity.php b/app/Entities/Equipment/ServerEntity.php index 4445dbc..482985f 100644 --- a/app/Entities/Equipment/ServerEntity.php +++ b/app/Entities/Equipment/ServerEntity.php @@ -44,8 +44,8 @@ class ServerEntity extends EquipmentEntity { return $this->attributes['code']; } - public function getTitle(): string + public function getCustomTitle(): string { - return sprintf("%s[%s]", parent::getTitle(), $this->getCode()); + return sprintf("[%s] %s", $this->getCode(), $this->getTitle()); } } diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index b1110aa..2f01e8c 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -23,7 +23,7 @@ class ServerPartEntity extends EquipmentEntity { return $this->getPartEntity() !== null ? sprintf( "%s%s", - $this->getBilling() === "" ? "" : ($this->getBilling() === PAYMENT['BILLING']["ONETIME"] ? ICONS['ONETIME'] : ICONS['MONTH']), + $this->getBilling() === "" ? "" : ($this->getBilling() === PAYMENT['BILLING']["ONETIME"] ? ICONS['ONETIME'] : ($this->getBilling() === PAYMENT['BILLING']["MONTH"] ? ICONS['MONTH'] : "")), $this->getPartEntity()->getTitle() ) : ""; } diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index c76083d..2910712 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -227,7 +227,7 @@ class CommonHelper foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) { $isSelected = $key == $value ? ' selected' : ''; $isDisabled = $viewDatas['control']['action'] === 'index' && $entity->getStatus() !== $entity::DEFAULT_STATUS ? ' readonly' : ''; - $html .= sprintf("", $key, $isSelected, $isDisabled, array_key_exists('isForm', $extras) ? $entity->getFormTitle() : $entity->getTitle()); + $html .= sprintf("", $key, $isSelected, $isDisabled, $entity->getCustomTitle()); } $html .= ''; return $html; @@ -281,6 +281,7 @@ class CommonHelper case 'old_clientinfo_uid': case 'clientinfo_uid': case 'serviceinfo_uid': + case 'serverinfo_uid': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); break; @@ -348,26 +349,11 @@ class CommonHelper public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string { switch ($field) { - case 'user_uid': - case 'old_clientinfo_uid': - case 'clientinfo_uid': - case 'serviceinfo_uid': - case 'serverinfo_uid': - case 'part_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + default: + $filter = $this->getFieldForm($field, $value, $viewDatas, $extras);; break; } - if (!array_key_exists($field, $viewDatas['control']['field_optons'])) { - throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 정의되지 않았습니다."); - } - if (!is_array($viewDatas['control']['field_optons'][$field])) { - throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다."); - } - $options = ["" => lang("{$viewDatas['class_path']}.label.{$field}") . " 선택"]; - foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) { - $options[$key] = $entity->getTitle(); - } - return form_dropdown($field, $options, $value, $extras);; + return $filter; } public function getListLabel(string $field, string $label, array $viewDatas, array $extras = []): string { diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 07bb2aa..518fe7d 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -37,9 +37,6 @@ class ServiceHelper extends CustomerHelper public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null { switch ($field) { - case 'serverinfo_uid': - $value = $viewDatas['control']['field_optons'][$field][$viewDatas['entity']->getServerEntity()->getPK()]->getTitle(); - break; case 'billing_at': if (array_key_exists('unPaids', $viewDatas)) { if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) { diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index d48977e..708d73c 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -24,6 +24,10 @@ class ServerHelper extends EquipmentHelper // $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : ''; $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; + case 'title': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); + break; case 'manufactur_at': case 'format_at': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; diff --git a/app/Language/en/Equipment/IP.php b/app/Language/en/Equipment/IP.php index 7a12e7e..970d994 100644 --- a/app/Language/en/Equipment/IP.php +++ b/app/Language/en/Equipment/IP.php @@ -3,7 +3,7 @@ return [ 'title' => "IP정보", 'label' => [ 'lineinfo_uid' => '회선정보', - 'old_clientinfo_uid' => "전고객", + 'old_clientinfo_uid' => "종전사용고객", 'clientinfo_uid' => '고객정보', 'serverinfo_uid' => '서버정보', 'ip' => "IP", diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php index 1084c48..c705514 100644 --- a/app/Language/en/Equipment/Server.php +++ b/app/Language/en/Equipment/Server.php @@ -8,7 +8,6 @@ return [ 'type' => "장비벤더", 'title' => "모델명", 'price' => "기본가", - 'amount' => "제공가", 'manufactur_at' => "입고일", 'format_at' => "포맷보류일", 'status' => "상태", diff --git a/app/Models/Equipment/ServerModel.php b/app/Models/Equipment/ServerModel.php index 8bf985b..33db346 100644 --- a/app/Models/Equipment/ServerModel.php +++ b/app/Models/Equipment/ServerModel.php @@ -20,7 +20,6 @@ class ServerModel extends EquipmentModel "type", "title", "price", - "amount", "manufactur_at", "format_at", "status", @@ -44,7 +43,6 @@ class ServerModel extends EquipmentModel $rule = "required|trim|string"; break; case "price": - case "amount": $rule = "required|numeric"; break; case "type": diff --git a/app/Services/Auth/GoogleService.php b/app/Services/Auth/GoogleService.php index ac2b048..5505506 100644 --- a/app/Services/Auth/GoogleService.php +++ b/app/Services/Auth/GoogleService.php @@ -21,7 +21,7 @@ class GoogleService extends AuthService if (!$this->_mySocket) { throw new \Exception("Socket이 지정되지 않았습니다."); } - return $this->_mySOcket; + return $this->_mySocket; } public function getFormFields(): array { diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index d3024b7..9c5fc92 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -2,8 +2,8 @@ namespace App\Services; +use App\Entities\CommonEntity; use App\Entities\FormOptionEntity; -use App\Libraries\LogCollector; use CodeIgniter\Model; abstract class CommonService @@ -32,7 +32,7 @@ abstract class CommonService return $this->_model; } //Entity별로 작업처리시 - protected function getEntity_process(mixed $entity): mixed + protected function getEntity_process(object $entity): mixed { return $entity; } diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 4f4fd45..0367840 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -92,10 +92,13 @@ class ServiceService extends CustomerService } protected function getEntity_process(mixed $entity): ServiceEntity { + if (!($entity instanceof ServiceEntity)) { + throw new \Exception(__METHOD__ . "에서 형식오류:ServiceEntity만 허용됩니다."); + } //서버정보 정의 $serverEntity = $this->getServerService()->getEntity(['serviceinfo_uid' => $entity->getPK()]); if (!($serverEntity instanceof ServerEntity)) { - throw new \Exception("{$entity->getPK()}에 해당하는 서버정보를 찾을수없습니다."); + throw new \Exception("{$entity->getPK()}에 해당하는 서버정보를 찾을수 없습니다."); } return $entity->setServerEntity($serverEntity); } @@ -168,19 +171,19 @@ class ServiceService extends CustomerService } //서버정보 상태설정용 - private function setServer_process(ServiceEntity $entity, string $status): ServerEntity + private function setServer_process(ServiceEntity $entity, mixed $serverinfo_uid, string $status): ServiceEntity { //서버경우 서비스중으로 설정 - $serverEntity = $this->getServerService()->getEntity(['serviceinfo_uid' => $entity->getPK()]); + $serverEntity = $this->getServerService()->getEntity($serverinfo_uid); if (!($serverEntity instanceof ServerEntity)) { - throw new \Exception("{$entity->getPK()}에 해당하는 서버정보를 찾을수없습니다."); + throw new \Exception("{$serverinfo_uid}에 해당하는 서버정보를 찾을수없습니다."); } //서버정보 상태수정 $serverEntity = $this->getServerService()->modify( $serverEntity, ['serviceEntity' => $entity, 'status' => $status], ); - return $serverEntity; + return $entity->setServerEntity($serverEntity); } //생성 public function create(array $formDatas): ServiceEntity @@ -189,7 +192,11 @@ class ServiceService extends CustomerService throw new \Exception("서버가 지정되지 않았습니다."); } $entity = parent::create($formDatas); - $serverEntity = $this->setServer_process($entity, STATUS['OCCUPIED']); + $serverEntity = $this->setServer_process( + $entity, + $formDatas['serverinfo_uid'], + STATUS['OCCUPIED'] + ); return $entity->setServerEntity($serverEntity); } //수정 @@ -199,18 +206,34 @@ class ServiceService extends CustomerService throw new \Exception("신규 서버가 지정되지 않았습니다."); } //기존서버정보 사용가능으로 설정 - $this->setServer_process($entity, STATUS['AVAILABLE']); + if ($entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) { + $entity = $this->setServer_process( + $entity, + $entity->getServerInfoUID(), + STATUS['AVAILABLE'] + ); + } //서비스 정보수정 $entity = parent::modify($entity, $formDatas); //신규서버정보 사용중으로 설정 - $serverEntity = $this->setServer_process($entity, STATUS['OCCUPIED']); - return $entity->setServerEntity($serverEntity); + if ($entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) { + $entity = $this->setServer_process( + $entity, + $formDatas['serverinfo_uid'], + STATUS['OCCUPIED'] + ); + } + return $entity; } //삭제 public function delete(mixed $entity): ServiceEntity { //기존서버정보 사용가능으로 설정 - $this->setServer_process($entity, STATUS['AVAILABLE']); + $this->setServer_process( + $entity, + $entity->getServerInfoUID(), + STATUS['AVAILABLE'] + ); return parent::delete($entity); } } diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index 95e054b..9b79932 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -76,6 +76,9 @@ class ServerPartService extends EquipmentService //partEntity 정보 추가 protected function getEntity_process(mixed $entity): ServerPartEntity { + if (!($entity instanceof ServerPartEntity)) { + throw new \Exception(__METHOD__ . "에서 형식오류:ServicePartEntity만 허용됩니다."); + } switch ($entity->getType()) { case 'SWITCH': $partService = $this->getSwitchService(); @@ -90,11 +93,7 @@ class ServerPartService extends EquipmentService $partService = $this->getPartService(); break; } - $partEntity = $partService->getEntity($entity->getPartUID()); - if ($entity) { - $entity->setPartEntity($partEntity); - } - return $entity; + return $entity->setPartEntity($partService->getEntity($entity->getPartUID())); } //기본 기능부분 // FieldForm관련용 @@ -170,7 +169,7 @@ class ServerPartService extends EquipmentService case 'SWITCH': case 'CS': //부품정보에 서버정보 설정 및 서비스,고객정보 정의 - if ($formDatas['status'] === STATUS['AVAILABLE']) { + if ($status === STATUS['AVAILABLE']) { //사용가능 $formDatas['clientinfo_uid'] = null; $formDatas['serviceinfo_uid'] = null; @@ -198,7 +197,7 @@ class ServerPartService extends EquipmentService if (!array_key_exists('serverinfo_uid', $formDatas)) { throw new \Exception("서버 정보가 지정되지 않았습니다."); } - $serverEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']); + $serverEntity = $this->getServerService()->getEntity($formDatas['serverinfo_uid']); } if (!($serverEntity instanceof ServerEntity)) { throw new \Exception("서버 정보가 지정되지 않았습니다."); @@ -225,20 +224,14 @@ class ServerPartService extends EquipmentService if (!array_key_exists('serverinfo_uid', $formDatas)) { throw new \Exception("서버 정보가 지정되지 않았습니다."); } - $serverEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']); + $serverEntity = $this->getServerService()->getEntity($formDatas['serverinfo_uid']); } if (!($serverEntity instanceof ServerEntity)) { throw new \Exception("서버 정보가 지정되지 않았습니다."); } - if ($formDatas['status'] === STATUS['OCCUPIED']) { - $formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID(); - $formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID(); - $formDatas["serverinfo_uid"] = $serverEntity->getPK(); - } else { - $formDatas["clientinfo_uid"] = null; - $formDatas["serviceinfo_uid"] = null; - $formDatas["serverinfo_uid"] = null; - } + $formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID(); + $formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID(); + $formDatas["serverinfo_uid"] = $serverEntity->getPK(); //기존 Part_UID와 신규 Part_UID가 다르면 기존 Part정보 사용가능으로 변경 if ($entity->getPartUID() != $formDatas['part_uid']) { $this->setPart_process($entity, $entity->getPartUID(), STATUS['AVAILABLE']); diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 3800da2..1d54a5a 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -2,6 +2,7 @@ namespace App\Services\Equipment; +use App\Entities\CommonEntity; use App\Entities\Customer\ServiceEntity; use App\Entities\Equipment\ServerEntity; use App\Models\Equipment\ServerModel; @@ -18,17 +19,15 @@ class ServerService extends EquipmentService public function getFormFields(): array { return [ + "clientinfo_uid", + "serviceinfo_uid", "code", "type", "title", "price", - "amount", "manufactur_at", "format_at", "status", - "CPU", - "RAM", - "DISK", ]; } public function getFormFilters(): array @@ -52,7 +51,6 @@ class ServerService extends EquipmentService "type", 'title', 'price', - 'amount', 'manufactur_at', "format_at", 'status', @@ -64,6 +62,7 @@ class ServerService extends EquipmentService 'clientinfo_uid', 'serviceinfo_uid', 'type', + "title", 'status' ]; } @@ -81,7 +80,9 @@ class ServerService extends EquipmentService //partEntity 정보 추가 protected function getEntity_process(mixed $entity): ServerEntity { - //부품연결정보 정의 + if (!($entity instanceof ServerEntity)) { + throw new \Exception(__METHOD__ . "에서 형식오류:ServerEntity만 허용됩니다."); + } foreach (SERVERPART['PARTTYPES'] as $partType) { foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]) as $serverPartEntity) { $entity = $entity->addServerPartEntity($partType, $serverPartEntity); @@ -138,18 +139,17 @@ class ServerService extends EquipmentService { $entity = parent::create($formDatas); //신규 ServerPart정보 생성 - foreach (SERVERPART['SERVER_PARTTYPES'] as $partType) { - $serverPartFormDatas = []; - $serverPartFormDatas['serverEntity'] = $entity; - $serverPartFormDatas['type'] = $partType; - $serverPartFormDatas['part_uid'] = $partType . "_uid"; - $serverPartFormDatas["billing"] = array_key_exists("{$partType}_billing", $formDatas) ? $formDatas["{$partType}_billing"] : null; - $serverPartFormDatas["amount"] = array_key_exists("{$partType}_amount", $formDatas) ? $formDatas["{$partType}_amount"] : 0; - $serverPartFormDatas["cnt"] = array_key_exists("{$partType}_cnt", $formDatas) ? $formDatas["{$partType}_cnt"] : 1; - $serverPartFormDatas["extra"] = array_key_exists("{$partType}_extra", $formDatas) ? $formDatas["{$partType}_extra"] : null; - $this->getServerPartService()->create($serverPartFormDatas); - } - return $entity->getEntity_process($entity); + // foreach (SERVERPART['SERVER_PARTTYPES'] as $partType) { + // $serverPartFormDatas = []; + // $serverPartFormDatas['serverEntity'] = $entity; + // $serverPartFormDatas['type'] = $partType; + // $serverPartFormDatas['part_uid'] = $partType . "_uid"; + // $serverPartFormDatas["billing"] = array_key_exists("{$partType}_billing", $formDatas) ? $formDatas["{$partType}_billing"] : null; + // $serverPartFormDatas["cnt"] = array_key_exists("{$partType}_cnt", $formDatas) ? $formDatas["{$partType}_cnt"] : 1; + // $serverPartFormDatas["extra"] = array_key_exists("{$partType}_extra", $formDatas) ? $formDatas["{$partType}_extra"] : null; + // $this->getServerPartService()->create($serverPartFormDatas); + // } + return $this->getEntity_process($entity); } //Service별 수정 public function modify(mixed $entity, array $formDatas): ServerEntity @@ -164,18 +164,17 @@ class ServerService extends EquipmentService } $serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']); } - if (!($serviceEntity instanceof ServiceEntity)) { - throw new \Exception("서비스 정보가 지정되지 않았습니다."); - } - //서비스상태에 따라 - if ($formDatas['status'] === STATUS['AVAILABLE']) { - //사용가능 - $formDatas["clientinfo_uid"] = null; - $formDatas["serviceinfo_uid"] = null; - } else { - //사용중 , 일시정지 - $formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID(); - $formDatas["serviceinfo_uid"] = $serviceEntity->getPK(); + if ($serviceEntity instanceof ServiceEntity) { + //서비스상태에 따라 + if ($formDatas['status'] === STATUS['AVAILABLE']) { + //사용가능 + $formDatas["clientinfo_uid"] = null; + $formDatas["serviceinfo_uid"] = null; + } else { + //사용중 , 일시정지 + $formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID(); + $formDatas["serviceinfo_uid"] = $serviceEntity->getPK(); + } } //서버정보수정 return $this->getEntity_process(parent::modify($entity, $formDatas)); diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php index 418428c..df4a1b1 100644 --- a/app/Views/admin/index.php +++ b/app/Views/admin/index.php @@ -28,6 +28,7 @@ include("templates/{$viewDatas['layout']}/index_content_top"); ?> + 'batchjob_form', 'method' => "post"]) ?> diff --git a/app/Views/admin/server/create_form.php b/app/Views/admin/server/create_form.php index 935516b..c971b79 100644 --- a/app/Views/admin/server/create_form.php +++ b/app/Views/admin/server/create_form.php @@ -14,7 +14,7 @@
- +
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> getFieldForm($field, old($field, $viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?> diff --git a/app/Views/admin/server/index.php b/app/Views/admin/server/index.php index f5e8581..7c6cd18 100644 --- a/app/Views/admin/server/index.php +++ b/app/Views/admin/server/index.php @@ -28,6 +28,7 @@ include("templates/{$viewDatas['layout']}/index_content_top"); ?> + 'batchjob_form', 'method' => "post"]) ?> @@ -42,8 +43,7 @@ getListLabel('title', lang("{$viewDatas['class_path']}.label.title"), $viewDatas) ?>
- getListLabel('price', lang("{$viewDatas['class_path']}.label.price"), $viewDatas) ?>/ - getListLabel('amount', lang("{$viewDatas['class_path']}.label.amount"), $viewDatas) ?> + getListLabel('price', lang("{$viewDatas['class_path']}.label.price"), $viewDatas) ?> getListLabel('manufactur_at', lang("{$viewDatas['class_path']}.label.manufactur_at"), $viewDatas) ?>/ @@ -72,7 +72,6 @@
getFieldView('price', $entity->price, $viewDatas) ?>
-
getFieldView('amount', $entity->amount, $viewDatas) ?>
getFieldView('manufactur_at', $entity->manufactur_at, $viewDatas) ?>
@@ -83,8 +82,8 @@ - - + +
getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>
diff --git a/app/Views/admin/server/modify_form.php b/app/Views/admin/server/modify_form.php index 5b5646d..8acd5d9 100644 --- a/app/Views/admin/server/modify_form.php +++ b/app/Views/admin/server/modify_form.php @@ -6,7 +6,7 @@
- +
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> diff --git a/app/Views/admin/server/view.php b/app/Views/admin/server/view.php index ad5c8fc..898a397 100644 --- a/app/Views/admin/server/view.php +++ b/app/Views/admin/server/view.php @@ -13,7 +13,7 @@
- +
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> @@ -26,10 +26,10 @@ - + - - + +
getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>
diff --git a/app/Views/admin/service/create_form.php b/app/Views/admin/service/create_form.php deleted file mode 100644 index 0d856d4..0000000 --- a/app/Views/admin/service/create_form.php +++ /dev/null @@ -1,24 +0,0 @@ -extend(LAYOUTS[$viewDatas['layout']]['path']) ?> -section('content') ?> -alert($error) ?> -
-
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
- -
- - - - - - - -
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> - getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?> - -
-
"btn btn-outline btn-primary")); ?>
- -
-
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
-
-endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/service/index.php b/app/Views/admin/service/index.php index ddacb58..c10531d 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -28,6 +28,7 @@ include("templates/{$viewDatas['layout']}/index_content_top"); ?> + 'batchjob_form', 'method' => "post"]) ?> @@ -88,7 +89,7 @@
- + diff --git a/app/Views/admin/service/modify_form.php b/app/Views/admin/service/modify_form.php deleted file mode 100644 index 5b5646d..0000000 --- a/app/Views/admin/service/modify_form.php +++ /dev/null @@ -1,24 +0,0 @@ -extend(LAYOUTS[$viewDatas['layout']]['path']) ?> -section('content') ?> -alert($error) ?> -
-
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
- -
-
getListButton($partType, $partType, $viewDatas) ?>getListButton($partType, $partType, $viewDatas) ?> getFieldView($partType, "", $viewDatas) ?>
- - - - - - -
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> - getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> - -
-
"btn btn-outline btn-primary")); ?>
- - -
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
- -endSection() ?> \ No newline at end of file