# Business Logic — KKA14901SFLogic.setBtnVisibleAtTel() [349 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA14901SF.KKA14901SFLogic` |
| Layer | Webview / Presentation Logic (Controller layer — screen business logic) |
| Module | `KKA14901SF` (Package: `eo.web.webview.KKA14901SF`) |

## 1. Role

### KKA14901SFLogic.setBtnVisibleAtTel()

This method implements the **button visibility routing logic** for the "One Stop" (ワンプッシュ) telephone number screen in the telecom service contract system. It determines which action buttons — such as Add (追加), Change (変更), Cancel (解約), Restore (復帰), Reservation Cancel (予約取消), Historical Display (履歴照会), Display (照会), Return (戻る), and OP Pack (OPパック) — should be shown or hidden to the end user on the telephone number operation screen. The routing is governed by four orthogonal dimensions: the **ido_div** (操作区分 — operation/division code), which identifies the current business transaction type (new contract, service addition, option setup, option reservation cancel, etc.); the **op_svc_kei_list_ari** flag, indicating whether the target telephone number already has existing service contract lines (オプション存在フラグ); the **svc_kei_ucwk_dsl_flg** flag, indicating whether the target service has been cancelled or is in a cancelled state (サービス対象工事解約フラグ); and the **op_svc_cd** (操作サービスコード — operation service code), which distinguishes special service types like TWRYO_STIAM (通話料上限通知 — call charge upper-limit notification, code "B072"). The method follows a **conditional dispatch/routing design pattern**, branching on the `ido_div` constant first, then further subdividing by existence of existing service lines and by cancellation status. It ultimately writes the computed visibility flags into the presentation-layer data bean via `sendMessageString`, serving as a shared screen-control utility called by `setKbnButtonVisible()` and used across the KKA14901SF one-stop screen flow. No CRUD operations are performed — this method is purely a presentation-layer decision engine.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setBtnVisibleAtTel called"])

    START --> INIT["Initialize all btn_v_kbn variables to 1"]

    INIT --> COND_DIV{"ido_div check"}

    COND_DIV -->|00001 or 00002| NEW_CONV["New Contract / Service Addition"]
    COND_DIV -->|00031| OP_SETUP["Option Setup"]
    COND_DIV -->|00055| OP_CXL_RESV["Option Reservation Cancel"]
    COND_DIV -->|default| NO_SET["No Setting"]

    NEW_CONV --> BK_NEW["bk_btn_v_kbn = 0"]
    BK_NEW --> SVC_EXIST_NEW{"op_svc_kei_list_ari?"}

    SVC_EXIST_NEW -->|true| OP_WITH_NEW["Option exists: historical and display hidden, add=1, OP pack=1"]
    SVC_EXIST_NEW -->|false| OP_NONE_NEW["Option not exist: all hidden except add=1, OP pack=1"]

    OP_WITH_NEW --> SVC_TYPE_NEW{"op_svc_cd == B072?"}
    SVC_TYPE_NEW -->|true| TWRYO_NEW["chg=1, dsl=0"]
    SVC_TYPE_NEW -->|false| OTHER_NEW["chg=0, dsl=1, kaihk=1, rsv_cl=1"]

    OP_NONE_NEW --> NONE_END_NEW["End of add-only branch"]

    OP_SETUP --> BK_OP["bk_btn_v_kbn = 1"]
    BK_OP --> DSL_FLG_OP{"svc_kei_ucwk_dsl_flg?"}

    DSL_FLG_OP -->|true| DIED_NEW_OP["Service cancelled or cancelled"]
    DSL_FLG_OP -->|false| ALIVE_OP["Service still active"]

    DIED_NEW_OP --> DIED_EXIST_OP{"op_svc_kei_list_ari?"}
    DIED_EXIST_OP -->|true| DIED_W_OP["Option exists: historical=1, rest=0"]
    DIED_EXIST_OP -->|false| DIED_N_OP["Option not exist: all=0"]

    ALIVE_OP --> ALIVE_EXIST{"op_svc_kei_list_ari?"}
    ALIVE_EXIST -->|true| ALIVE_W_OP["Option exists: historical=1, add=1, OP pack=1"]
    ALIVE_EXIST -->|false| ALIVE_N_OP["Option not exist: historical=0, add=1, OP pack=1"]

    ALIVE_W_OP --> ALIVE_TYPE{"op_svc_cd == B072?"}
    ALIVE_TYPE -->|true| TWRYO_ALIVE["chg=1, dsl=0, kaihk=0, rsv_cl=0"]
    ALIVE_TYPE -->|false| OTHER_ALIVE["chg=0, dsl=1, kaihk=1, rsv_cl=1"]

    OP_CXL_RESV --> BK_CXL["bk_btn_v_kbn = 1"]
    BK_CXL --> CXL_DSL{"svc_kei_ucwk_dsl_flg?"}

    CXL_DSL -->|true| CXL_DIED["Service cancelled or cancelled"]
    CXL_DSL -->|false| CXL_ALIVE["Service still active"]

    CXL_DIED --> CDL_EXIST{"op_svc_kei_list_ari?"}
    CDL_EXIST -->|true| CDL_W["Option exists: historical=1, rest=0"]
    CDL_EXIST -->|false| CDL_N["Option not exist: all=0"]

    CXL_ALIVE --> CAL_EXIST{"op_svc_kei_list_ari?"}
    CAL_EXIST -->|true| CAL_W["Option exists: historical=1, rest=0"]
    CAL_EXIST -->|false| CAL_N["Option not exist: all=0"]

    CAL_W --> CXL_TYPE{"op_svc_cd == B072?"}
    CXL_TYPE -->|true| TWRYO_CXL["rsv_cl=0"]
    CXL_TYPE -->|false| OTHER_CXL["rsv_cl=1"]

    NO_SET --> BK_HIDDEN["bk_btn_v_kbn = 3 (closed)"]
    BK_HIDDEN --> NO_EXIST{"op_svc_kei_list_ari?"}
    NO_EXIST -->|true| NO_W["Option exists: historical=1, rest=0"]
    NO_EXIST -->|false| NO_N["Option not exist: all=0"]

    TWRYO_NEW --> SEND["SendMessage to paramBean[0]"]
    OTHER_NEW --> SEND
    NONE_END_NEW --> SEND
    DIED_W_OP --> SEND
    DIED_N_OP --> SEND
    ALIVE_W_OP --> SEND
    ALIVE_N_OP --> SEND
    TWRYO_ALIVE --> SEND
    OTHER_ALIVE --> SEND
    CDL_W --> SEND
    CDL_N --> SEND
    CAL_W --> SEND
    CAL_N --> SEND
    TWRYO_CXL --> SEND
    OTHER_CXL --> SEND
    NO_W --> SEND
    NO_N --> SEND

    SEND --> END_NODE(["Return void"])
```

**Constant Resolution Reference:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `IDO_DIV_VALUE_00001` | `"00001"` | New Contract (新規契約) |
| `IDO_DIV_VALUE_00002` | `"00002"` | Service Addition (サービス追加) |
| `IDO_DIV_VALUE_00031` | `"00031"` | Option Setup (オプション設定) |
| `IDO_DIV_VALUE_00055` | `"00055"` | Option Reservation Cancel (オプション予約取消) |
| `OP_SVC_CD_VALUE_TWRYO_STIAM` | `"B072"` | Call Charge Upper-limit Notification (通話料上限通知) — special premium rate service |
| `DATABEAN_SET_VALUE` | `"(set value)"` | Data bean set operation type constant from `X31CWebConst` |

**Button visibility flag meanings:**

| Variable | Japanese | Business Meaning | "1" = Visible | "0" = Hidden |
|----------|----------|------------------|---------------|--------------|
| `rireki_shokai_btn_v_kbn` | 履歴照会 | Historical display | Show past records | Hide past records |
| `shokai_btn_v_kbn` | 照会 | Display | Show current record | Hide current record |
| `add_btn_v_kbn` | 追加 | Add / Create new | Enable add | Disable add |
| `chg_btn_v_kbn` | 変更 | Change / Modify | Enable modify | Disable modify |
| `dsl_btn_v_kbn` | 解約 | Cancel / Terminate | Enable cancel | Disable cancel |
| `kaihk_btn_v_kbn` | 復帰 | Restore / Reactivate | Enable restore | Disable restore |
| `rsv_cl_btn_v_kbn` | 予約取消 | Reservation Cancel | Enable res-canc | Disable res-canc |
| `bk_btn_v_kbn` | 戻る | Return / Go Back | Enable return | Disable return |
| `op_pack_btn_v_kbn` | OPパック | OP Pack button | Show OP pack | Hide OP pack |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `OneStopDataBeanAccess[]` | Array of presentation-layer data beans used to push button visibility flags to the screen UI. Each element represents a screen field; the method writes to `paramBean[0]` to set 9 distinct button visibility control fields (Return, Reservation Cancel, Restore, Cancel, Change, Add, Display, Historical Display, OP Pack). This is the primary communication channel to the view layer. |
| 2 | `ido_div` | `String` | Operation division code (操作区分コード) — the master switch that determines which of the 4 high-level business scenarios applies. Values: `"00001"` (New Contract), `"00002"` (Service Addition), `"00031"` (Option Setup), `"00055"` (Option Reservation Cancel), or any other value (catch-all "No Setting"). This is the primary decision variable. |
| 3 | `op_svc_cd` | `String` | Operation service code (操作サービスコード) — identifies the specific type of service being operated on. Most notably checked against `"B072"` (TWRYO_STIAM — Call Charge Upper-limit Notification / 通話料上限通知), which has special button visibility rules (enables Change but disables Cancel and other operations). Other service types follow the standard path. |
| 4 | `op_svc_kei_list_ari` | `boolean` | Option existence flag (オプション存在フラグ) — indicates whether the target telephone number already has one or more existing service contract lines (option lines). `true` = option lines exist (existing customer), `false` = no option lines (new customer or no lines yet). This deeply affects button visibility patterns. |
| 5 | `svc_kei_ucwk_dsl_flg` | `boolean` | Service detail work cancel flag (サービス対象工事解約フラグ) — indicates whether the target service has been cancelled or is in a cancelled/cancellation-completed state. `true` = cancelled/cancelled (解除済み／キャンセル済), `false` = service still active (解除済み以外). Only checked in the `"00031"` and `"00055"` `ido_div` branches. |

**External state read:** None. This method is fully stateless with respect to instance fields. All logic is driven by the 5 parameters.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `OneStopDataBeanAccess.sendMessageString` | - | - | Writes button visibility flag values to the data bean for screen display. Called 10 times per execution — once per button type. This is a set operation on the presentation-layer bean, not a database operation. |

**Analysis:** This method performs **no database CRUD operations**. It is purely a presentation-layer visibility control routine. The only external calls are to `OneStopDataBeanAccess.sendMessageString()`, which pushes computed visibility flags (0 or 1) into the screen's data bean for rendering. The `sendMessageString` calls use `X31CWebConst.DATABEAN_SET_VALUE` as the set-type constant, indicating a direct field-set operation.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

**Direct callers:**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: KKA14901SFLogic | `KKA14901SFLogic.setKbnButtonVisible` -> `KKA14901SFLogic.setBtnVisibleAtTel` | `sendMessageString [U] OneStopDataBeanAccess (10 calls for each button visibility flag)` |

**Analysis:** The method is called exclusively from `setKbnButtonVisible()` within the same class (`KKA14901SFLogic`). This is a screen-control method that is invoked during the button-visibility calculation phase of the KKA14901SF one-stop screen's processing flow. The terminal operations are all `sendMessageString` calls that write visibility flags to the presentation data bean — there are no SC (Service Component), CBS, or database interactions in the call chain.

## 6. Per-Branch Detail Blocks

### Variable Initialization Block (L4340–L4353)

This block initializes all 9 button visibility control variables to the default value of `"1"` (visible). This represents the "visible by default" philosophy — buttons are shown unless the business logic explicitly hides them.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display (履歴照会) |
| 2 | SET | `shokai_btn_v_kbn = "1"` // Display (照会) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add (追加) |
| 4 | SET | `chg_btn_v_kbn = "1"` // Change (変更) |
| 5 | SET | `dsl_btn_v_kbn = "1"` // Cancel (解約) |
| 6 | SET | `kaihk_btn_v_kbn = "1"` // Restore (復帰) |
| 7 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel (予約取消) |
| 8 | SET | `bk_btn_v_kbn = "1"` // Return (戻る) |
| 9 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack (OPパック) — ANK-2056-00-00 ADD |

### Block 1 — IF `ido_div` in ["00001", "00002"] (New Contract / Service Addition) (L4360–L4407)

Handles two business scenarios: New Contract (`"00001"`) and Service Addition (`"00002"`). In both cases, the Return button is hidden (`bk_btn_v_kbn = "0"`). Further subdivides by whether the telephone number already has existing option lines.

**Block 1.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4368–L4389)**

The telephone number has existing service contract lines. Historical display and Display are hidden, but Add is enabled. Sub-branches by service type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add enabled (追加) |
| 4 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 5 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 6 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack enabled (OPパック) — ANK-2056-00-00 |

**Block 1.1.1 — Nested: `op_svc_cd == "B072"` (TWRYO_STIAM) (L4379–L4382)**

The service is Call Charge Upper-limit Notification (通話料上限通知). Change is enabled, Cancel is disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` // Change enabled (変更) |
| 2 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |

**Block 1.1.2 — Nested: else (Other service types) (L4384–L4390)**

Standard service types. Change is disabled, Cancel and Restore are enabled. Quality improvement support (IT1-2013-0001038) added Reservation Cancel and Restore.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 2 | SET | `dsl_btn_v_kbn = "1"` // Cancel enabled (解約) |
| 3 | SET | `kaihk_btn_v_kbn = "1"` // Restore enabled (復帰) — IT1-2013-0001038 ADD |
| 4 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel enabled (予約取消) — IT1-2013-0001038 ADD |

**Block 1.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4396–L4407)**

The telephone number has no existing service contract lines. Only Add is enabled. All other buttons (including Historical Display, Display, Change, Cancel, Restore) are hidden.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add enabled (追加) |
| 4 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 5 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 6 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 7 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack enabled (OPパック) — ANK-2056-00-00 |

### Block 2 — IF `ido_div == "00031"` (Option Setup) (L4417–L4517)

Handles Option Setup (オプション設定) scenario. Return button is enabled (`bk_btn_v_kbn = "1"`). Subdivides by the cancel flag (`svc_kei_ucwk_dsl_flg`).

**Block 2.1 — Nested: `svc_kei_ucwk_dsl_flg == true` (Service cancelled/cancelled) (L4427–L4477)**

The target service has been cancelled or is in a cancelled state. Very restricted button set.

**Block 2.1.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4435–L4449)**

Even though the service is cancelled, option lines exist. Only Historical Display and Return are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display enabled (履歴照会) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 2.1.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4455–L4477)**

Service is cancelled AND no option lines exist. All buttons are hidden (including Historical Display).

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 2.2 — Nested: `svc_kei_ucwk_dsl_flg == false` (Service still active) (L4484–L4517)**

The target service is still active. More buttons are available.

**Block 2.2.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4492–L4509)**

Service is active AND option lines exist. Historical Display, Add, and OP Pack are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display enabled (履歴照会) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add enabled (追加) |
| 4 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack enabled (OPパック) — ANK-2056-00-00 |

**Block 2.2.1.1 — Nested: `op_svc_cd == "B072"` (TWRYO_STIAM) (L4500–L4503)**

Special service type. Change is enabled, Cancel, Restore, and Reservation Cancel are hidden.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` // Change enabled (変更) |
| 2 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 3 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 4 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |

**Block 2.2.1.2 — Nested: else (Other service types) (L4505–L4509)**

Standard service types. Change is hidden, Cancel, Restore, and Reservation Cancel are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 2 | SET | `dsl_btn_v_kbn = "1"` // Cancel enabled (解約) |
| 3 | SET | `kaihk_btn_v_kbn = "1"` // Restore enabled (復帰) |
| 4 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel enabled (予約取消) |

**Block 2.2.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4513–L4517)**

Service is active but no option lines exist. Only Add is enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add enabled (追加) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack enabled (OPパック) — ANK-2056-00-00 |

### Block 3 — IF `ido_div == "00055"` (Option Reservation Cancel) (L4527–L4577)

Handles Option Reservation Cancel (オプション予約取消) scenario. Return button is enabled (`bk_btn_v_kbn = "1"`). Subdivides by cancel flag and option existence.

**Block 3.1 — Nested: `svc_kei_ucwk_dsl_flg == true` (Service cancelled/cancelled) (L4537–L4563)**

**Block 3.1.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4545–L4559)**

Only Historical Display and Return are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display enabled (履歴照会) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 3.1.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4565–L4577)**

All buttons hidden.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 3.2 — Nested: `svc_kei_ucwk_dsl_flg == false` (Service still active) (L4578–L4577)**

**Block 3.2.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4586–L4567)**

Service active AND option lines exist. Only Historical Display and Return enabled. Sub-branch by service type for Reservation Cancel.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display enabled (履歴照会) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 3.2.1.1 — Nested: `op_svc_cd == "B072"` (TWRYO_STIAM) (L4598–L4600)**

Reservation Cancel is hidden for this service type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |

**Block 3.2.1.2 — Nested: else (Other service types) (L4602–L4604)**

Reservation Cancel is enabled for standard services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel enabled (予約取消) |

**Block 3.2.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4610–L4617)**

All buttons hidden except Return.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

### Block 4 — ELSE (No Setting / default) (L4624–L4650)

Default case for any `ido_div` value not matching the four known patterns. Return button is set to `"3"` (closed — 閉じる) per ANK-2121-00-00 modification (previously `"0"` hidden).

**Block 4.1 — Nested: `op_svc_kei_list_ari == true` (Option lines exist) (L4632–L4646)**

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "3"` // Return closed (閉じる) — ANK-2121-00-00 MOD |
| 2 | SET | `rireki_shokai_btn_v_kbn = "1"` // Historical display enabled (履歴照会) |
| 3 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 4 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 5 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 6 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 7 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 8 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 9 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

**Block 4.2 — Nested: `op_svc_kei_list_ari == false` (No option lines) (L4652–L4664)**

All buttons hidden including Historical Display.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // Historical display hidden (履歴照会 ※非活性) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display hidden (照会 ※非活性) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add hidden (追加 ※非活性) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change hidden (変更 ※非活性) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel hidden (解約 ※非活性) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore hidden (復帰 ※非活性) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel hidden (予約取消 ※非活性) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack hidden (OPパック ※非活性) — ANK-2056-00-00 |

### Block 5 — Write Visibility Flags (L4651–L4664)

The final block pushes all 10 button visibility flag values to the data bean. This is the output phase — every path converges here.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `paramBean[0].sendMessageString(BK_BTN_V_KBN, DATABEAN_SET_VALUE, bk_btn_v_kbn)` // Set Return button visibility |
| 2 | CALL | `paramBean[0].sendMessageString(RSV_CL_BTN_V_KBN, DATABEAN_SET_VALUE, rsv_cl_btn_v_kbn)` // Set Reservation Cancel visibility |
| 3 | CALL | `paramBean[0].sendMessageString(KAIHK_BTN_V_KBN, DATABEAN_SET_VALUE, kaihk_btn_v_kbn)` // Set Restore visibility |
| 4 | CALL | `paramBean[0].sendMessageString(DSL_BTN_V_KBN, DATABEAN_SET_VALUE, dsl_btn_v_kbn)` // Set Cancel visibility |
| 5 | CALL | `paramBean[0].sendMessageString(CHG_BTN_V_KBN, DATABEAN_SET_VALUE, chg_btn_v_kbn)` // Set Change visibility |
| 6 | CALL | `paramBean[0].sendMessageString(ADD_BTN_V_KBN, DATABEAN_SET_VALUE, add_btn_v_kbn)` // Set Add visibility |
| 7 | CALL | `paramBean[0].sendMessageString(SHOKAI_BTN_V_KBN, DATABEAN_SET_VALUE, shokai_btn_v_kbn)` // Set Display visibility |
| 8 | CALL | `paramBean[0].sendMessageString(RIREKI_SHOKAI_BTN_V_KBN, DATABEAN_SET_VALUE, rireki_shokai_btn_v_kbn)` // Set Historical Display visibility |
| 9 | CALL | `paramBean[0].sendMessageString(OP_PACK_BTN_V_KBN, DATABEAN_SET_VALUE, op_pack_btn_v_kbn)` // Set OP Pack visibility — ANK-2056-00-00 |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_div` | Field | Operation Division Code (操作区分コード) — master code identifying the type of business operation being performed on a telephone number |
| `op_svc_cd` | Field | Operation Service Code (操作サービスコード) — identifies the specific service type being operated on (e.g., "B072" = TWRYO_STIAM) |
| `op_svc_kei_list_ari` | Field | Option Existence Flag (オプション存在フラグ) — true if the telephone number has existing service contract lines; false if none exist |
| `svc_kei_ucwk_dsl_flg` | Field | Service Detail Work Cancel Flag (サービス対象工事解約フラグ) — true if the target service has been cancelled or is in a cancelled/cancellation-completed state |
| `bk_btn_v_kbn` | Field | Return Button Visibility Type (戻るボタン表示区分) — controls whether the Return button is shown ("1"), hidden ("0"), or closed ("3") |
| `add_btn_v_kbn` | Field | Add Button Visibility Type (追加ボタン表示区分) — controls whether the Add button is enabled |
| `chg_btn_v_kbn` | Field | Change Button Visibility Type (変更ボタン表示区分) — controls whether the Change/Modify button is enabled |
| `dsl_btn_v_kbn` | Field | Cancel Button Visibility Type (解約ボタン表示区分) — controls whether the Cancel/Terminate button is enabled |
| `kaihk_btn_v_kbn` | Field | Restore Button Visibility Type (復帰ボタン表示区分) — controls whether the Restore/Reactivate button is enabled |
| `rsv_cl_btn_v_kbn` | Field | Reservation Cancel Button Visibility Type (予約取消ボタン表示区分) — controls whether the Reservation Cancel button is enabled |
| `shokai_btn_v_kbn` | Field | Display Button Visibility Type (照会ボタン表示区分) — controls whether the Display button for the current record is shown |
| `rireki_shokai_btn_v_kbn` | Field | Historical Display Button Visibility Type (履歴照会ボタン表示区分) — controls whether the Historical Display button is shown |
| `op_pack_btn_v_kbn` | Field | OP Pack Button Visibility Type (OPパックボタン表示区分) — controls whether the OP Pack button is shown (added in ANK-2056-00-00) |
| `TWRYO_STIAM` | Business term | Call Charge Upper-limit Notification (通話料上限通知) — a premium-rate service with code "B072" that has special button visibility rules (enables Change but restricts other operations) |
| `B072` | Field | The service code value for TWRYO_STIAM (通話料上限通知) |
| One Stop (ワンプッシュ) | Business term | "One Push" — a streamlined UI flow for performing multiple telephone number operations in a single screen without navigation |
| OP (オプション) | Abbreviation | Option — additional service lines attached to a base telephone number contract (e.g., mail service, IPTV, etc.) |
| SC | Abbreviation | Service Component — backend service layer component that handles business logic and data access |
| CBS | Abbreviation | Core Business Service — backend service layer component in the CBS architecture |
| Entity | Abbreviation | Database entity — a class representing a database table or view |
| DATABEAN_SET_VALUE | Constant | Data bean set operation type constant (`X31CWebConst.DATABEAN_SET_VALUE`) — indicates a direct field-set operation on the presentation data bean |
| `BK_BTN_V_KBN` | Constant | Return Button Visibility Key (戻るボタン表示区分) — key for the Return button in the data bean |
| `RSV_CL_BTN_V_KBN` | Constant | Reservation Cancel Button Visibility Key (予約取消ボタン表示区分) |
| `KAIHK_BTN_V_KBN` | Constant | Restore Button Visibility Key (復帰ボタン表示区分) |
| `DSL_BTN_V_KBN` | Constant | Cancel Button Visibility Key (解約ボタン表示区分) |
| `CHG_BTN_V_KBN` | Constant | Change Button Visibility Key (変更ボタン表示区分) |
| `ADD_BTN_V_KBN` | Constant | Add Button Visibility Key (追加ボタン表示区分) |
| `SHOKAI_BTN_V_KBN` | Constant | Display Button Visibility Key (照会ボタン表示区分) |
| `RIREKI_SHOKAI_BTN_V_KBN` | Constant | Historical Display Button Visibility Key (履歴照会ボタン表示区分) |
| `OP_PACK_BTN_V_KBN` | Constant | OP Pack Button Visibility Key (OPパックボタン表示区分) — added in ANK-2056-00-00 |
