mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
karat timesheet sync fix
This commit is contained in:
1 parent
ebffbd29c3
commit
c3bf06a9b0
2 files changed
+7
-2
No files matched your search
@@ -68,9 +68,11 @@ class Api
|
|||||||
|
|
||||||
public static function setTimesheet($timesheet)
|
public static function setTimesheet($timesheet)
|
||||||
{
|
{
|
||||||
|
echo 'Setting timesheet for project ' . $timesheet->subtask->mastertask->project->code . PHP_EOL;
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
'command' => 'TM_SET_vykaz',
|
'command' => 'TM_SET_vykaz',
|
||||||
'zakazka' => $timesheet->subtask->project->code,
|
'zakazka' => $timesheet->subtask->mastertask->project->code,
|
||||||
'zdroj' => $timesheet->user->code,
|
'zdroj' => $timesheet->user->code,
|
||||||
'hodin' => $timesheet->time,
|
'hodin' => $timesheet->time,
|
||||||
'datum' => $timesheet->created_at->format('Y-m-d'),
|
'datum' => $timesheet->created_at->format('Y-m-d'),
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ class KaratService
|
|||||||
$notSyncedTimesheets = Timesheet::whereNull('synced_to_karat')->get();
|
$notSyncedTimesheets = Timesheet::whereNull('synced_to_karat')->get();
|
||||||
|
|
||||||
$notSyncedTimesheets->each(function ($timesheet) {
|
$notSyncedTimesheets->each(function ($timesheet) {
|
||||||
|
if (!$timesheet->subtask || !$timesheet->subtask->mastertask->project)
|
||||||
|
return false;
|
||||||
|
|
||||||
$this->syncTimesheet($timesheet);
|
$this->syncTimesheet($timesheet);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -141,7 +144,7 @@ class KaratService
|
|||||||
private function syncTimesheet(Timesheet $timesheet) {
|
private function syncTimesheet(Timesheet $timesheet) {
|
||||||
$this->api->setTimesheet($timesheet);
|
$this->api->setTimesheet($timesheet);
|
||||||
|
|
||||||
$timesheet->synced_to_karat = true;
|
$timesheet->synced_to_karat = Carbon::now();
|
||||||
$timesheet->save();
|
$timesheet->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user