feat:수당지급일 입력 시 개발상태 인계 여부 검증 안전장치 추가
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -292,9 +292,18 @@ public function updateCommissionDate(int $id, Request $request)
|
||||
$field = $request->input('field');
|
||||
$date = $request->input('date') ?: now()->format('Y-m-d');
|
||||
|
||||
// 수당지급일 필드는 개발상태가 '인계'일 때만 저장 가능
|
||||
$paidFields = ['first_partner_paid_at', 'second_partner_paid_at', 'manager_paid_at'];
|
||||
if (in_array($field, $paidFields) && $management->hq_status !== 'handover') {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '개발상태가 인계일 때만 수당이 지급됩니다.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$updateData = [$field => $date];
|
||||
|
||||
// 납입일 입력 시 수당지급일 자동 계산 (익월 10일)
|
||||
// 납입일 입력 시 수당지급일 자동 계산 (익월 10일) - 인계 상태일 때만
|
||||
$autoFields = [
|
||||
'first_payment_at' => 'first_partner_paid_at',
|
||||
'second_payment_at' => 'second_partner_paid_at',
|
||||
@@ -302,7 +311,7 @@ public function updateCommissionDate(int $id, Request $request)
|
||||
|
||||
$autoField = null;
|
||||
$autoDate = null;
|
||||
if (isset($autoFields[$field])) {
|
||||
if (isset($autoFields[$field]) && $management->hq_status === 'handover') {
|
||||
$autoField = $autoFields[$field];
|
||||
$autoDate = \Carbon\Carbon::parse($date)->addMonth()->day(10)->format('Y-m-d');
|
||||
$updateData[$autoField] = $autoDate;
|
||||
|
||||
Reference in New Issue
Block a user