|
@@ -7,10 +7,13 @@ use Customer;
|
|
|
use DB;
|
|
use DB;
|
|
|
use Location;
|
|
use Location;
|
|
|
use Test;
|
|
use Test;
|
|
|
|
|
+use User;
|
|
|
|
|
|
|
|
class LocationSearch {
|
|
class LocationSearch {
|
|
|
|
|
|
|
|
private Customer $customer;
|
|
private Customer $customer;
|
|
|
|
|
+ private ?User $user = null;
|
|
|
|
|
+
|
|
|
private ?int $id = null;
|
|
private ?int $id = null;
|
|
|
private ?array $ids = null;
|
|
private ?array $ids = null;
|
|
|
private ?string $internalId = null;
|
|
private ?string $internalId = null;
|
|
@@ -28,8 +31,9 @@ class LocationSearch {
|
|
|
/** @var Test[] */
|
|
/** @var Test[] */
|
|
|
private array $allTests = [];
|
|
private array $allTests = [];
|
|
|
|
|
|
|
|
- public function __construct(Customer $customer) {
|
|
|
|
|
|
|
+ public function __construct(Customer $customer, ?User $user) {
|
|
|
$this->customer = $customer;
|
|
$this->customer = $customer;
|
|
|
|
|
+ $this->user = $user;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getId(): ?int {
|
|
public function getId(): ?int {
|
|
@@ -138,6 +142,10 @@ class LocationSearch {
|
|
|
"location_id" => array_column($locations, "id")
|
|
"location_id" => array_column($locations, "id")
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ if($this->user && $this->user->level <= User::LEVEL_CUSTOMER) {
|
|
|
|
|
+ $base_test_nvp["status"] = Test::STATUS_COMPLETED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$this->populateAllTests($base_test_nvp);
|
|
$this->populateAllTests($base_test_nvp);
|
|
|
$this->populateLiveTests($base_test_nvp);
|
|
$this->populateLiveTests($base_test_nvp);
|
|
|
|
|
|