added tenant configuration
This commit is contained in:
@@ -8,4 +8,23 @@ class WorkorderCompanyModel extends TTCrudBaseModel {
|
||||
public ?string $visibleForAddressId;
|
||||
public int $create;
|
||||
public int $createBy;
|
||||
|
||||
public static function getCompanyWorkers(int $companyId): array {
|
||||
if (!$company = self::get($companyId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$db = self::getDB();
|
||||
$addressId = $db->real_escape_string($company->addressId);
|
||||
|
||||
$sql = "SELECT w.id, w.name, w.email
|
||||
FROM `" . FRONKDB_DBNAME . "`.`Worker` w
|
||||
JOIN `" . FRONKDB_DBNAME . "`.`WorkerPermission` wp ON w.id = wp.worker_id
|
||||
WHERE w.address_id = '$addressId' AND wp.canRMLCompany = 'true' AND w.active = 1
|
||||
ORDER BY w.name ASC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
return $result ? $result->fetch_all(MYSQLI_ASSOC) : [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user