# PETA INTEGRITAS KONFIGURASI & IDENTITAS UNIK SUBSIDIARY
**Workspace:** `w:\normalisasi_sansub`  
**Cakupan:** `san_add`, `san_ppu`, `san_sarana`, `san_sdl`, `san_tsa`  
**Tanggal Pemetaan:** 19 November 2026 (Hasil pemindaian 8.284 file di kelima folder)

Dokumen ini adalah **Single Source of Truth** untuk seluruh titik konfigurasi dan aset identitas yang **unik per subsidiary**. Gunakan dokumen ini sebagai daftar cek wajib setiap kali:
1. Melakukan sinkronisasi kode lintas cabang (*jangan pernah menimpa file di daftar ini*).
2. Melakukan *cloning* aplikasi untuk subsidiary baru atau memindahkan server/domain.
3. Mengganti logo, favicon, domain, atau database agar **tidak terjadi mismatch** (misalnya URL `san_tsa` tetapi logo cetaknya masih `san_sarana`).

---

## 1. Ringkasan 10 Titik Identitas Unik per Subsidiary

Terdapat tepat **10 file** (5 file konfigurasi/kode + 5 file aset visual) yang membedakan identitas tiap subsidiary:

| No | Kategori | Path File Relatif | Fungsi / Dampak Jika Tertukar |
| :-: | :--- | :--- | :--- |
| 1 | **Database** | `application/config/database.php` | Koneksi database utama `$db['default']['database']`. **KRITIS:** salah nama DB = transaksi masuk ke database PT/cabang lain! |
| 2 | **Domain / URL** | `application/helpers/he_url_helper.php` | Konstanta `ADM_LOCAL_DOMAIN` (baris 15) & `local_version()`. Salah domain = link eksternal, redirect, atau callback CRM/API mengarah ke cabang lain. |
| 3 | **Log Profiling** | `application/controllers/_tray.php` | Path log Linux `/var/www/san_[sub]/logs/profile.txt`. Salah path = gagal tulis log / mencampur log cabang lain. |
| 4 | **Env / IP Whitelist** | `index.php` | Whitelist IP lokal/development (`192.168.5.x`) untuk menentukan mode environment. |
| 5 | **User Whitelist Note** | `application/config/heWebs.php` | Daftar catatan/konfigurasi user khusus cabang (perbedaan blok komentar/entri antara `san_add`/`san_sarana`/`san_sdl` vs `san_ppu`/`san_tsa`). |
| 6 | **Favicon Root** | `favicon.ico` | Ikon tab browser default yang diminta langsung oleh browser di root domain (`/favicon.ico`). |
| 7 | **Favicon Template** | `public/images/profiles/favicon.ico` | Ikon tab browser yang disuntikkan via tag template `{favicon}`. **Harus identik dengan `favicon.ico` di root.** |
| 8 | **Logo Navbar** | `public/images/profiles/logo_header.png` | Logo kecil di pojok kiri atas navbar aplikasi (`img_logo_header()` -> `{logo_header}` di `Layout.php:L337`). |
| 9 | **Logo Cetakan (Print)** | `public/images/profiles/logo_header_full.png` | Logo resolusi penuh pada header dokumen cetakan (`img_logo_header_full()` -> `{logo_header_print_00}` di `Layout.php:L338`). |
| 10 | **Logo Aset / Fallback** | `assets/images/san_221.png` | Logo perusahaan untuk aset statis / cetakan tertentu. |

> **Catatan File Global (100% Identik di 5 Subsidiary — Bukan Identitas Cabang):**
> - `application/config/config.php` (`MD5: 63b117d3`) — `base_url` dideteksi dinamis.
> - `application/config/autoload.php`, `routes.php`, `constants.php` (`MD5: 453c3d6b`), `.htaccess` (`MD5: 30d1456a`).
> - `application/libraries/Layout.php` (`skin_header` seragam `"skin-green"` di kelima cabang).

---

## 2. Matriks Nilai Eksisting per Subsidiary (Konfigurasi & Kode)

| Titik Konfigurasi | `san_add` | `san_ppu` | `san_sarana` | `san_sdl` | `san_tsa` |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **`database.php`** (`default.database`) | `run_san_add` | `run_san_ppu` | `run_san_sarana` | `run_san_sdl` | `run_san_tsa` |
| **`database.php`** (`default.hostname` / `username`) | `192.168.11.100` / `app_admin` | `192.168.11.100` / `app_admin` | `192.168.11.100` / `app_admin` | `192.168.11.100` / `app_admin` | `192.168.11.100` / `app_admin` |
| **`he_url_helper.php:L15`** (`ADM_LOCAL_DOMAIN`) | `https://add.mayagrahakencana.com/` | `https://ppu.mayagrahakencana.com/` | `https://sarana.mayagrahakencana.com/` | `https://sdl.mayagrahakencana.com/` | `https://tsa.mayagrahakencana.com/` |
| **`he_url_helper.php`** (`local_version()`) | `1.0101.2022.Corp` | `1.0101.2026.Corp` | `1.0101.2022.Corp` | `1.0101.2022.Corp` | `1.0101.2022.Corp` |
| **`_tray.php`** (Log Path) | `/var/www/san_add/logs/profile.txt` *(aktif)* | `/var/www/san_ppu/logs/profile.txt` *(aktif)* | `/var/www/san_sarana/logs/profile.txt` *(comment)* | `/var/www/san_sdl/logs/profile.txt` *(aktif)* | `/var/www/san_tsa/logs/profile.txt` *(aktif)* |
| **`index.php`** (IP Dev Aktif) | `192.168.5.1` | *(semua ter-comment)* | `192.168.5.3` | *(semua ter-comment)* | *(semua ter-comment)* |

---

## 3. Matriks Aset Visual (MD5 & Ukuran File) + Temuan Mismatch Saat Ini

| Path Aset Visual | `san_add` | `san_ppu` | `san_sarana` | `san_sdl` | `san_tsa` |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **`favicon.ico`** *(root)* | `1be14239` (15 KB) | `98700c32` (15 KB) | `e88405db` (7 KB) | `48a04fb9` (225 KB) ⚠️ | `07c0e2fc` (15 KB) |
| **`public/images/profiles/favicon.ico`** | `1be14239` (15 KB) | `98700c32` (15 KB) | `e88405db` (7 KB) | `8abe1d7d` (15 KB) ⚠️ | `07c0e2fc` (15 KB) |
| **`public/images/profiles/logo_header.png`** | `87ab56ea` (5.6 KB) | `5e841597` (15.6 KB) | `65f4839a` (8.8 KB) | `8aac165b` (12.9 KB) | `19b07295` (16.2 KB) |
| **`public/images/profiles/logo_header_full.png`** | `87ab56ea` (5.6 KB) | `5e841597` (15.6 KB) | `65f4839a` (8.8 KB) | `65f4839a` (8.8 KB) 🚨 | `dca43a04` (15.2 KB) ⚠️ |
| **`assets/images/san_221.png`** | `dca43a04` (15.2 KB) ⚠️ | `5e841597` (15.6 KB) | `65f4839a` (8.8 KB) | `65f4839a` (8.8 KB) 🚨 | `dca43a04` (15.2 KB) ⚠️ |

### 🚨 Temuan Mismatch Aset Visual yang Sudah Terjadi di Workspace Saat Ini
Berdasarkan hash MD5 di atas, ditemukan **3 anomali branding** yang sudah ada sebelumnya (sebelum proses normalisasi):
1. **`san_sdl` memakai logo `san_sarana` pada logo cetak:**
   - `san_sdl/public/images/profiles/logo_header_full.png` (`65f4839a`) dan `san_sdl/assets/images/san_221.png` (`65f4839a`) **100% identik dengan logo `san_sarana`**, berbeda dengan `san_sdl/public/images/profiles/logo_header.png` (`8aac165b`).
2. **`san_sdl` memiliki 2 favicon berbeda:**
   - `san_sdl/favicon.ico` (`48a04fb9`, 225 KB) tidak sama dengan `san_sdl/public/images/profiles/favicon.ico` (`8abe1d7d`, 15 KB).
3. **`san_tsa` & `san_add` berbagi file `dca43a04`:**
   - `san_tsa/public/images/profiles/logo_header_full.png` (`dca43a04`) dan `san_tsa/assets/images/san_221.png` (`dca43a04`) identik dengan `san_add/assets/images/san_221.png` (`dca43a04`), namun berbeda dengan `logo_header.png` milik `san_tsa` (`19b07295`) maupun `san_add` (`87ab56ea`). Perlu diverifikasi visual apakah `dca43a04` adalah logo lama atau logo milik salah satu cabang.

---

## 4. Checklist Wajib Saat Clone / Ubah Identitas Subsidiary

Gunakan checklist ini secara berurutan setiap kali membuat cabang baru atau mengubah identitas cabang agar **tidak ada satu pun yang tertinggal**:

- [ ] **1. Database (`application/config/database.php`)**
  - Ubah `$db['default']['database']` menjadi `run_san_[kode_baru]`.
  - Pastikan `hostname`, `username`, `password` sesuai server target.
- [ ] **2. Domain (`application/helpers/he_url_helper.php`)**
  - Ubah baris 15: `define('ADM_LOCAL_DOMAIN', 'https://[sub].mayagrahakencana.com/');`.
  - (Opsional) Bump `local_version()` untuk *cache busting* CSS/JS browser.
- [ ] **3. Log Path (`application/controllers/_tray.php`)**
  - Ubah path `/var/www/san_[kode_baru]/logs/profile.txt` (atau nonaktifkan dengan komentar jika tidak perlu profiling di produksi).
- [ ] **4. Environment (`index.php`)**
  - Pastikan tidak ada IP lokal developer yang tidak semestinya aktif di produksi.
- [ ] **5. Favicon (2 file sekaligus — wajib identik)**
  - Ganti `favicon.ico` (root) **DAN** `public/images/profiles/favicon.ico` dengan file `.ico` yang sama.
- [ ] **6. Logo Aplikasi & Cetakan (3 file sekaligus)**
  - Ganti `public/images/profiles/logo_header.png` (navbar).
  - Ganti `public/images/profiles/logo_header_full.png` (header print).
  - Ganti `assets/images/san_221.png` (aset statis/fallback).
- [ ] **7. Data Master Profil Perusahaan di Database**
  - Pastikan tabel profil perusahaan (`MdlCompany` / `company_profile` di database `run_san_[kode_baru]`) sudah sesuai nama PT, alamat, NPWP, dan telepon cabang tersebut.

---

## 5. Script Verifikasi Cepat (PowerShell — 1 Detik)

Jalankan perintah ini di PowerShell dari `w:\normalisasi_sansub` kapan saja setelah deploy atau perubahan konfigurasi untuk memastikan **0 mismatch** antar ke-5 subsidiary:

```powershell
foreach ($s in @('san_add','san_ppu','san_sarana','san_sdl','san_tsa')) {
    $db  = (Select-String "$s\application\config\database.php" -Pattern "'database'\s*=>\s*'run_san_[^']+'").Matches.Value
    $url = (Select-String "$s\application\helpers\he_url_helper.php" -Pattern "ADM_LOCAL_DOMAIN.*").Matches.Value
    $log = (Select-String "$s\application\controllers\_tray.php" -Pattern "/var/www/[^']+").Matches.Value
    $lh  = (Get-FileHash "$s\public\images\profiles\logo_header.png" -Algorithm MD5).Hash.Substring(0,8)
    $lhf = (Get-FileHash "$s\public\images\profiles\logo_header_full.png" -Algorithm MD5).Hash.Substring(0,8)
    $fav1 = (Get-FileHash "$s\favicon.ico" -Algorithm MD5).Hash.Substring(0,8)
    $fav2 = (Get-FileHash "$s\public\images\profiles\favicon.ico" -Algorithm MD5).Hash.Substring(0,8)
    Write-Output "$s | $db | $log | logo=$lh/$lhf | fav=$fav1/$fav2 | $url"
}
```
