fixed createLocations Action not working
This commit is contained in:
@@ -28,6 +28,7 @@ class WarehouseAdministrationController extends mfBaseController {
|
|||||||
protected function createLocationsAction(): void {
|
protected function createLocationsAction(): void {
|
||||||
$existingLocations = WarehouseLocationModel::getAll();
|
$existingLocations = WarehouseLocationModel::getAll();
|
||||||
$companyCars = TimerecordingCarModel::getAll();
|
$companyCars = TimerecordingCarModel::getAll();
|
||||||
|
$beforeCount = WarehouseLocationModel::count();
|
||||||
|
|
||||||
|
|
||||||
$wantedCarLocations = [];
|
$wantedCarLocations = [];
|
||||||
@@ -73,7 +74,7 @@ class WarehouseAdministrationController extends mfBaseController {
|
|||||||
"title" => $wantedCarLocation,
|
"title" => $wantedCarLocation,
|
||||||
"description" => "Automatisch erstellt",
|
"description" => "Automatisch erstellt",
|
||||||
"assignedTo" => $assignedTo,
|
"assignedTo" => $assignedTo,
|
||||||
"createdBy" => $this->me->id,
|
"createBy" => $this->me->id,
|
||||||
"create" => time()
|
"create" => time()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -97,14 +98,18 @@ class WarehouseAdministrationController extends mfBaseController {
|
|||||||
"title" => $user->name . "'s Lagerort",
|
"title" => $user->name . "'s Lagerort",
|
||||||
"description" => "Automatisch erstellt",
|
"description" => "Automatisch erstellt",
|
||||||
"assignedTo" => $user->id,
|
"assignedTo" => $user->id,
|
||||||
"createdBy" => $this->me->id,
|
"createBy" => $this->me->id,
|
||||||
"create" => time()
|
"create" => time()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var_dump($existingLocations);
|
$afterCount = WarehouseLocationModel::count();
|
||||||
die();
|
|
||||||
|
|
||||||
|
if ($afterCount - $beforeCount === 0) {
|
||||||
|
$this->returnJSON(["success" => true, "message" => "Alle Lagerorte existieren bereits"]);
|
||||||
|
} else {
|
||||||
|
$this->returnJSON(["success" => true, "message" => "Es wurden " . ($afterCount - $beforeCount) . " neue Lagerorte erstellt"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,6 @@ class WarehouseLocationModel extends TTCrudBaseModel {
|
|||||||
public string $title;
|
public string $title;
|
||||||
public string $description;
|
public string $description;
|
||||||
public int $assignedTo;
|
public int $assignedTo;
|
||||||
public int $createdBy;
|
public int $createBy;
|
||||||
public int $create;
|
public int $create;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user