mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 11:27:24 +08:00
fix attendance retroactive
This commit is contained in:
@@ -281,7 +281,7 @@ class AttendanceRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
public function retroactive($user, $timestampMs)
|
||||
public function retroactive($user, $dateStr)
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
$user = User::query()->findOrFail((int)$user);
|
||||
@@ -290,7 +290,7 @@ class AttendanceRepository extends BaseRepository
|
||||
if (!$attendance) {
|
||||
throw new \LogicException(nexus_trans('attendance.have_not_attendance_yet'));
|
||||
}
|
||||
$date = Carbon::createFromTimestampMs($timestampMs);
|
||||
$date = Carbon::parse($dateStr);
|
||||
$now = Carbon::now();
|
||||
if ($date->gte($now) || $now->diffInDays($date) > Attendance::MAX_RETROACTIVE_DAYS) {
|
||||
throw new \LogicException(nexus_trans('attendance.target_date_can_no_be_retroactive', ['date' => $date->format('Y-m-d')]));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.9');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-09-29');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-10-12');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class AjaxInterface{
|
||||
{
|
||||
global $CURUSER;
|
||||
$rep = new \App\Repositories\AttendanceRepository();
|
||||
return $rep->retroactive($CURUSER['id'], $params['timestamp']);
|
||||
return $rep->retroactive($CURUSER['id'], $params['date']);
|
||||
}
|
||||
|
||||
public static function getPtGen($params)
|
||||
|
||||
@@ -89,23 +89,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
eventClick: function(info) {
|
||||
console.log(info.event);
|
||||
if (info.event.groupId == 'to_do') {
|
||||
retroactive(info.event.start)
|
||||
retroactive(info.event.startStr)
|
||||
}
|
||||
}
|
||||
});
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
function retroactive(start) {
|
||||
let year = start.getFullYear()
|
||||
let month = start.getMonth() + 1
|
||||
let day = start.getDate()
|
||||
let date = year + '-' + month + '-' + day
|
||||
if (!window.confirm(confirmText + date + ' ?')) {
|
||||
function retroactive(dateStr) {
|
||||
if (!window.confirm(confirmText + dateStr + ' ?')) {
|
||||
console.log("cancel")
|
||||
return
|
||||
}
|
||||
jQuery.post('ajax.php', {params: {timestamp: start.getTime()}, action: 'attendanceRetroactive'}, function (response) {
|
||||
jQuery.post('ajax.php', {params: {date: dateStr}, action: 'attendanceRetroactive'}, function (response) {
|
||||
console.log(response);
|
||||
if (response.ret != 0) {
|
||||
alert(response.msg)
|
||||
|
||||
Reference in New Issue
Block a user