fix: remove remaining references to AttendancePolicy
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\AttendancePolicy;
|
||||
use App\Models\AttendanceRecord;
|
||||
use App\Models\Employee;
|
||||
use App\Models\Shift;
|
||||
@@ -460,10 +459,6 @@ class BiometricAttendanceController extends Controller
|
||||
$shift = Shift::where('id', $employee->shift_id)->where('status', 'active')->first() ?? Shift::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
$attendance->shift_id = $shift?->id;
|
||||
}
|
||||
if (empty($attendance->attendance_policy_id)) {
|
||||
$policy = AttendancePolicy::where('id', $employee->attendance_policy_id)->where('status', 'active')->first() ?? AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
$attendance->attendance_policy_id = $policy?->id;
|
||||
}
|
||||
|
||||
$attendance->biometric_id = $firstEntry->id;
|
||||
$attendance->branch_id = $employee->branch_id ?? $firstEntry->branch_id;
|
||||
@@ -485,14 +480,12 @@ class BiometricAttendanceController extends Controller
|
||||
}
|
||||
} else {
|
||||
$shift = Shift::where('id', $employee->shift_id)->where('status', 'active')->first() ?? Shift::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
$policy = AttendancePolicy::where('id', $employee->attendance_policy_id)->where('status', 'active')->first() ?? AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
|
||||
$attendance = new AttendanceRecord();
|
||||
$attendance->employee_id = $employee->user_id;
|
||||
$attendance->branch_id = $employee->branch_id ?? $firstEntry->branch_id;
|
||||
$attendance->biometric_id = $firstEntry->id;
|
||||
$attendance->shift_id = $shift?->id;
|
||||
$attendance->attendance_policy_id = $policy?->id;
|
||||
$attendance->date = $attedanceDate;
|
||||
$attendance->clock_in = $clockInTime;
|
||||
$attendance->clock_out = $clockOutTime;
|
||||
@@ -565,10 +558,6 @@ class BiometricAttendanceController extends Controller
|
||||
->where('status', 'active')
|
||||
->first() ?? Shift::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
|
||||
$policy = AttendancePolicy::where('id', $employee->attendance_policy_id)
|
||||
->where('status', 'active')
|
||||
->first() ?? AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
|
||||
$biometricRecord = \App\Models\BiometricAttendance::find($biometricId);
|
||||
|
||||
$attendance = new AttendanceRecord();
|
||||
@@ -576,7 +565,6 @@ class BiometricAttendanceController extends Controller
|
||||
$attendance->branch_id = $employee->branch_id ?? ($biometricRecord ? $biometricRecord->branch_id : null);
|
||||
$attendance->biometric_id = $biometricId;
|
||||
$attendance->shift_id = $shift?->id;
|
||||
$attendance->attendance_policy_id = $policy?->id;
|
||||
$attendance->date = $attedanceDate;
|
||||
$attendance->clock_in = $clockInTime;
|
||||
$attendance->clock_out = $clockOutTime;
|
||||
@@ -641,7 +629,6 @@ class BiometricAttendanceController extends Controller
|
||||
}
|
||||
|
||||
$shift = Shift::where('id', $employee->shift_id)->where('status', 'active')->first() ?? Shift::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
$policy = AttendancePolicy::where('id', $employee->attendance_policy_id)->where('status', 'active')->first() ?? AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
|
||||
|
||||
// Check if record already exists
|
||||
$attendance = AttendanceRecord::where('employee_id', $employee->user_id)
|
||||
@@ -656,9 +643,6 @@ class BiometricAttendanceController extends Controller
|
||||
if (empty($attendance->shift_id)) {
|
||||
$attendance->shift_id = $shift?->id;
|
||||
}
|
||||
if (empty($attendance->attendance_policy_id)) {
|
||||
$attendance->attendance_policy_id = $policy?->id;
|
||||
}
|
||||
$attendance->clock_in = $inTime->format('H:i:s');
|
||||
$attendance->clock_out = $outTime->format('H:i:s');
|
||||
$attendance->clock_in_source = 'zkteco';
|
||||
@@ -671,7 +655,6 @@ class BiometricAttendanceController extends Controller
|
||||
$attendance->biometric_id = $clockInId;
|
||||
$attendance->branch_id = $employee->branch_id ?? $clockInRecord->branch_id;
|
||||
$attendance->shift_id = $shift?->id;
|
||||
$attendance->attendance_policy_id = $policy?->id;
|
||||
$attendance->date = $attedanceDate;
|
||||
$attendance->clock_in = $inTime->format('H:i:s');
|
||||
$attendance->clock_out = $outTime->format('H:i:s');
|
||||
|
||||
Reference in New Issue
Block a user