Skip to content

[施設予約] 「重複予約を許可しない」設定にしていても、予約の終了時間を「24:00」にすると重複して予約ができてしまう不具合対応 #2202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions app/Rules/CustomValiDuplicateBookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace App\Rules;

use App\Models\User\Reservations\ReservationsInput;
use Illuminate\Contracts\Validation\Rule;

use Illuminate\Support\Collection;

use App\Models\User\Reservations\ReservationsInput;
use Carbon\Carbon;

/**
* 施設予約重複チェック
Expand Down Expand Up @@ -34,6 +33,16 @@ public function __construct(int $facility_id, Collection $input_ids, string $sta
$this->start_datetime = $start_datetime;
$this->end_datetime = $end_datetime;

// 終了日時を日付と時間に分割
[$end_date, $end_time] = explode(' ', $this->end_datetime);
if ($end_time == '24:00') {
// 予約重複できない設定+2025-05-30 14:00-17:00予定あり時、2025-05-30 12:00-24:00の予約が重複登録できてしまう不具合対応。end_datatimeの'2025-05-30 24:00'は不正な値でチェックできないため、'2025-05-31 00:00'に変換する
$end_carbon = new Carbon($end_datetime);
$this->end_datetime = $end_carbon->format('Y-m-d H:i');
} else {
$this->end_datetime = $end_datetime;
}

$this->message = $message;
}

Expand Down