rmlworkorder major upgrade

This commit is contained in:
Luca Haid
2025-09-02 08:36:33 +00:00
parent 549027a67c
commit b173a6edc1
24 changed files with 1762 additions and 2073 deletions

View File

@@ -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;
}}