Allow punch out time to be null - fix for mysql strict date mode

This commit is contained in:
gamonoid
2017-10-03 08:17:58 +02:00
parent 45ea7e0f0d
commit 79ecf9cd6a
3 changed files with 24 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
<?php
$migrationList = [];
$migrationList[] = 'v20171001_200201_update_attendance_out';
$migrationList[] = 'v20170918_200000_add_attendance_image_out';
$migrationList[] = 'v20170908_200000_payroll_group';
$migrationList[] = 'v20170702_190500_add_attendance_image';

View File

@@ -0,0 +1,23 @@
<?php
namespace Classes\Migration;
class v20171001_200201_update_attendance_out extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
alter table Attendance modify column `out_time` datetime default NULL;
SQL;
return $this->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);
}
}

View File

@@ -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;