fix: 견적서 options 필드 저장 누락 문제 해결
- QuoteUpdateRequest에 detail_items, price_adjustment_data validation 규칙 추가 - QuoteService에서 options 병합 시 array_merge 사용하여 기존 데이터 보존 - Laravel FormRequest의 validated()가 규칙 미정의 필드를 필터링하는 이슈 해결 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -301,6 +301,13 @@ public function update(int $id, array $data): Quote
|
||||
// 수정 이력 생성
|
||||
$this->createRevision($quote, $userId);
|
||||
|
||||
// 상태 변경: pending(견적대기) → draft(작성중)
|
||||
// 현장설명회에서 자동 생성된 견적을 처음 수정하면 작성중 상태로 변경
|
||||
$newStatus = $quote->status;
|
||||
if ($quote->status === Quote::STATUS_PENDING) {
|
||||
$newStatus = Quote::STATUS_DRAFT;
|
||||
}
|
||||
|
||||
// 금액 재계산
|
||||
$materialCost = (float) ($data['material_cost'] ?? $quote->material_cost);
|
||||
$laborCost = (float) ($data['labor_cost'] ?? $quote->labor_cost);
|
||||
@@ -312,6 +319,7 @@ public function update(int $id, array $data): Quote
|
||||
|
||||
// 업데이트
|
||||
$quote->update([
|
||||
'status' => $newStatus,
|
||||
'receipt_date' => $data['receipt_date'] ?? $quote->receipt_date,
|
||||
'author' => $data['author'] ?? $quote->author,
|
||||
// 발주처 정보
|
||||
@@ -349,6 +357,11 @@ public function update(int $id, array $data): Quote
|
||||
'notes' => $data['notes'] ?? $quote->notes,
|
||||
// 자동산출 입력값
|
||||
'calculation_inputs' => $data['calculation_inputs'] ?? $quote->calculation_inputs,
|
||||
// 견적 옵션 (summary_items, expense_items, price_adjustments, detail_items, price_adjustment_data)
|
||||
// 기존 options와 새 options를 병합 (새 데이터가 기존 데이터를 덮어씀)
|
||||
'options' => isset($data['options'])
|
||||
? array_merge($quote->options ?? [], $data['options'])
|
||||
: $quote->options,
|
||||
// 감사
|
||||
'updated_by' => $userId,
|
||||
'current_revision' => $quote->current_revision + 1,
|
||||
|
||||
Reference in New Issue
Block a user