From 79ecf9cd6a9d52001d9baa77b84b3290497dfeb8 Mon Sep 17 00:00:00 2001 From: gamonoid Date: Tue, 3 Oct 2017 08:17:58 +0200 Subject: [PATCH] Allow punch out time to be null - fix for mysql strict date mode --- migrations/list.php | 1 + ...v20171001_200201_update_attendance_out.php | 23 +++++++++++++++++++ .../User/Api/AttendanceActionManager.php | 1 - 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 migrations/v20171001_200201_update_attendance_out.php diff --git a/migrations/list.php b/migrations/list.php index 3cea4f46..7a8e0c1a 100644 --- a/migrations/list.php +++ b/migrations/list.php @@ -1,5 +1,6 @@ executeQuery($sql); + } + + public function down(){ + $sql = <<<'SQL' + alter table Attendance modify column `out_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'; +SQL; + + return $this->executeQuery($sql); + } + +} + diff --git a/src/Attendance/User/Api/AttendanceActionManager.php b/src/Attendance/User/Api/AttendanceActionManager.php index a5c466f7..39730f65 100644 --- a/src/Attendance/User/Api/AttendanceActionManager.php +++ b/src/Attendance/User/Api/AttendanceActionManager.php @@ -135,7 +135,6 @@ class AttendanceActionManager extends SubActionManager $this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch Out \ time:".$openPunch->out_time); } else { $openPunch->in_time = $dateTime; - $openPunch->out_time = '0000-00-00 00:00:00'; $openPunch->note = $req->note; $openPunch->image_in = $req->image; $openPunch->employee = $employee->id;