rmlworkorder major upgrade
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// WorkorderTenantConfigModel.php
|
||||
|
||||
class WorkorderTenantConfigModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public int $addressId;
|
||||
public string $name;
|
||||
public string $documentationTypes; // JSON
|
||||
public string $workorderCreationFilters; // JSON
|
||||
public int $civilEngineeringDocsRequired;
|
||||
public int $create;
|
||||
public int $createBy;
|
||||
|
||||
public static function findForWorkorder(WorkorderModel $workorder): ?WorkorderTenantConfigModel {
|
||||
if (empty($workorder->preorderId)) return null;
|
||||
|
||||
$db = self::getDB();
|
||||
$dbName = FRONKDB_DBNAME;
|
||||
$tableWTC = self::getFullyQualifiedTable();
|
||||
$preorderId = $db->real_escape_string($workorder->preorderId);
|
||||
|
||||
$sql = "SELECT wtc.* FROM $tableWTC wtc
|
||||
JOIN `$dbName`.`Network` n ON wtc.addressId = n.owner_id
|
||||
JOIN `$dbName`.`Preordercampaign` pc ON n.id = pc.network_id
|
||||
JOIN `$dbName`.`Preorder` p ON pc.id = p.preordercampaign_id
|
||||
WHERE p.id = '$preorderId' LIMIT 1";
|
||||
|
||||
$row = $db->query($sql)?->fetch_assoc();
|
||||
|
||||
return $row ? new self($row) : null;
|
||||
}}
|
||||
Reference in New Issue
Block a user