diff --git a/application/WorkorderMph/WorkorderMphModel.php b/application/WorkorderMph/WorkorderMphModel.php index 5f5688f8e..a2ffde2de 100644 --- a/application/WorkorderMph/WorkorderMphModel.php +++ b/application/WorkorderMph/WorkorderMphModel.php @@ -16,6 +16,7 @@ class WorkorderMphModel extends TTCrudBaseModel public ?int $conduitToHuepLaid; public ?int $huepMounted; public ?int $dropCableAvailable; + public ?int $spliceCompleted; public int $create; public int $createBy; } diff --git a/application/WorkorderMphBase/WorkorderMphBaseController.php b/application/WorkorderMphBase/WorkorderMphBaseController.php index 03b3811b0..f0afa7a52 100644 --- a/application/WorkorderMphBase/WorkorderMphBaseController.php +++ b/application/WorkorderMphBase/WorkorderMphBaseController.php @@ -143,7 +143,7 @@ class WorkorderMphBaseController extends TTCrud $db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME); $hausnummerId = $db->escape($workorder->hausnummerId); - $sql = "SELECT w.id, w.bezeichner, w.contact + $sql = "SELECT w.id, w.bezeichner, w.contact, w.oaid, w.note FROM Wohneinheit w WHERE w.hausnummer_id = $hausnummerId ORDER BY w.bezeichner"; @@ -161,12 +161,15 @@ class WorkorderMphBaseController extends TTCrud $response = []; foreach ($wohneinheiten as $we) { $record = $recordsMap[$we['id']] ?? null; + // Prefer WorkorderMphWohneinheit note, fallback to addressdb note + $note = $record ? $record->note : $we['note']; $response[] = [ 'wohneinheitId' => intval($we['id']), 'bezeichner' => $we['bezeichner'], 'contact' => $we['contact'], + 'oaid' => $we['oaid'], 'status' => $record ? $record->status : 1, - 'note' => $record ? $record->note : null, + 'note' => $note, 'recordId' => $record ? $record->id : null, ]; } @@ -215,6 +218,13 @@ class WorkorderMphBaseController extends TTCrud ]); } + // Also save note to addressdb.Wohneinheit + $db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME); + $escapedNote = $note !== null ? "'" . $db->escape($note) . "'" : "NULL"; + $escapedWohneinheitId = $db->escape($wohneinheitId); + $updateSql = "UPDATE Wohneinheit SET note = $escapedNote WHERE id = $escapedWohneinheitId"; + $db->query($updateSql); + // Add journal entry if status or note changed if ($oldStatus !== $status || $oldNote !== $note) { $changes = []; @@ -274,7 +284,7 @@ class WorkorderMphBaseController extends TTCrud if (!$workorder) self::sendError("Arbeitsauftrag nicht gefunden."); $changes = []; - $checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable']; + $checkboxFields = ['easement', 'btb', 'fttxLocationSupplied', 'conduitToHuepLaid', 'huepMounted', 'dropCableAvailable', 'spliceCompleted']; foreach ($checkboxFields as $field) { if (array_key_exists($field, $post)) { diff --git a/db/migrations/20251117145123_add_splice_completed_to_workorder_mph.php b/db/migrations/20251117145123_add_splice_completed_to_workorder_mph.php new file mode 100644 index 000000000..8cda96ea5 --- /dev/null +++ b/db/migrations/20251117145123_add_splice_completed_to_workorder_mph.php @@ -0,0 +1,30 @@ +getEnvironment() == "thetool") { + $table = $this->table('WorkorderMph'); + $table->addColumn('spliceCompleted', 'boolean', [ + 'null' => true, + 'default' => null, + 'comment' => 'Spleiß im HÜP/HAK erledigt', + 'after' => 'dropCableAvailable' + ]); + $table->update(); + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $table = $this->table('WorkorderMph'); + $table->removeColumn('spliceCompleted'); + $table->save(); + } + } +} diff --git a/public/js/pages/WorkorderMphBase/WorkorderMphBase.js b/public/js/pages/WorkorderMphBase/WorkorderMphBase.js index 5d9600ae3..c73b1d0b4 100644 --- a/public/js/pages/WorkorderMphBase/WorkorderMphBase.js +++ b/public/js/pages/WorkorderMphBase/WorkorderMphBase.js @@ -40,7 +40,7 @@ Vue.component('wohneinheit-status-manager', {
{{ we.bezeichner }}
- OAID: {{ we.wohneinheitId }} + OAID: {{ we.oaid }}
{{ we.contact }} @@ -87,8 +87,7 @@ Vue.component('wohneinheit-status-manager', { this.wohneinheiten = data.wohneinheiten.map(we => ({ ...we, changed: false, - saving: false, - note: we.note || 'Tür 1, Tür 2, Tür 3' + saving: false })); this.statusOptions = data.statusOptions || []; } catch (e) { @@ -185,6 +184,12 @@ Vue.component('checkbox-documentation', { Dropkabel vorhanden + +