overhauled workorder module
This commit is contained in:
@@ -174,9 +174,26 @@ class WorkorderCompanyController extends WorkorderBaseController {
|
||||
}
|
||||
|
||||
$workorder = WorkorderModel::get($workorderId);
|
||||
if (in_array($workorder->status, ['correction_requested', 'problem_solved', 'civil_engineering_completed'])) {
|
||||
$workorder->status = 'assigned';
|
||||
$oldStatus = $workorder->status;
|
||||
$newStatus = null;
|
||||
|
||||
if (in_array($oldStatus, ['assigned', 'scheduled'])) {
|
||||
$newStatus = 'in_progress';
|
||||
} else if (in_array($oldStatus, ['correction_requested', 'problem_solved', 'civil_engineering_completed'])) {
|
||||
$newStatus = 'assigned';
|
||||
}
|
||||
|
||||
if ($newStatus) {
|
||||
$workorder->status = $newStatus;
|
||||
WorkorderModel::update((array)$workorder);
|
||||
|
||||
WorkorderJournalModel::create([
|
||||
'workorderId' => $workorder->id,
|
||||
'text' => 'Status wurde nach Dokumenten-Upload automatisch auf In Beearbeitung gesetzt.',
|
||||
'statusChange' => $this->getStatusText($oldStatus) . " -> " . $this->getStatusText($newStatus),
|
||||
'create' => time(),
|
||||
'createBy' => $this->user->id,
|
||||
]);
|
||||
}
|
||||
|
||||
self::returnJson(['success' => true, 'message' => "Datei(en) erfolgreich hochgeladen."]);
|
||||
|
||||
Reference in New Issue
Block a user