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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA14201SF.KKA14201SFLogic` |
| Layer | Service (webview business logic layer) |
| Module | `KKA14201SF` (Package: `eo.web.webview.KKA14201SF`) |

## 1. Role

### KKA14201SFLogic.setBtnVisibleAtTel()

This method determines the visibility and enable/disable state of all operation buttons for the **telephone service (phone line)** screen in the One Stop (wanstop) contract management system. It acts as a **button routing/dispatch utility** called by `setKbnButtonVisible()` based on the detected service type (`SVC_CD_02` = telephone service). The method evaluates three business dimensions to compute button states: (1) the **operation division code** (`ido_div`), which classifies the current transaction context (e.g., new contract, service addition, operation settings, reservation cancel); (2) the **presence of operation service items** (`op_svc_kei_list_ari`), indicating whether the customer already has active service contract line items; and (3) the **contract cancellation status** (`svc_kei_ucwk_dsl_flg`), indicating whether the target phone line has been cancelled or terminated (including cancelled status). It also applies a specialized rule for the **Twryo Stiam (twryo cost notification)** service (`op_svc_cd = "B072"`) which adjusts change and cancellation button availability. The method computes 9 boolean button flags — each set to `"1"` (visible/enabled) or `"0"` (hidden/disabled) — and pushes them to the DataBean via `sendMessageString()` calls for downstream JSP rendering. Buttons covered include: Back, Reservation Cancel, Restore (Recover), Cancel (Terminate), Change (Modify), Add (Register), Display (View), History Display (View), and OP Pack (Optical-Packet). This method implements a **conditional branching pattern** — routing through one of four `ido_div` branches, then further splitting by service item presence and cancellation status within each.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setBtnVisibleAtTel"])
    INIT["Initialize all btn_v_kbn = 1"]

    START --> INIT

    INIT --> C1{ido_div = 00001 or 00002}

    C1 -->|Yes| BRANCH_NEW["New Contract / Service Addition"]
    BRANCH_NEW --> BK_HIDE["bk_btn_v_kbn = 0"]

    BK_HIDE --> OP_CHECK1{op_svc_kei_list_ari?}

    OP_CHECK1 -->|Yes| WITH_OPS1["Service items exist"]
    WITH_OPS1 --> SETS1["rireki=0, shokai=0, add=1, kaihk=0, rsv_cl=0, op_pack=1"]
    SETS1 --> TWRYO1{op_svc_cd = B072}

    TWRYO1 -->|Yes| TWRYO_YES1["chg=1, dsl=0"]
    TWRYO1 -->|No| TWRYO_NO1["chg=0, dsl=1, kaihk=1, rsv_cl=1"]

    OP_CHECK1 -->|No| NO_OPS1["No service items"]
    NO_OPS1 --> SETS2["rireki=0, shokai=0, add=1, chg=0, dsl=0, kaihk=0, rsv_cl=0, op_pack=1"]

    C1 -->|No| C2{ido_div = 00031}

    TWRYO_YES1 --> DSL_CHECK{svc_kei_ucwk_dsl_flg?}
    TWRYO_NO1 --> DSL_CHECK
    SETS2 --> DSL_CHECK

    DSL_CHECK -->|Yes| DSL_TRUE["Line cancelled"]
    DSL_TRUE --> WITH_OPS_DSL{op_svc_kei_list_ari?}

    WITH_OPS_DSL -->|Yes| DSL_WITH_OPS["rireki=1, all others=0, op_pack=0"]
    WITH_OPS_DSL -->|No| DSL_NO_OPS["all buttons=0"]

    DSL_CHECK -->|No| DSL_FALSE["Line active"]
    DSL_FALSE --> WITH_OPS2{op_svc_kei_list_ari?}

    WITH_OPS2 -->|Yes| WITH_OPS3["Service items exist"]
    WITH_OPS3 --> SETS3["rireki=1, shokai=0, add=1, op_pack=1"]
    SETS3 --> TWRYO3{op_svc_cd = B072}

    TWRYO3 -->|Yes| TWRYO_YES3["chg=1, dsl=0, kaihk=0, rsv_cl=0"]
    TWRYO3 -->|No| TWRYO_NO3["chg=0, dsl=1, kaihk=1, rsv_cl=1"]

    WITH_OPS2 -->|No| NO_OPS2["No service items"]
    NO_OPS2 --> SETS4["rireki=0, shokai=0, add=1, chg=0, dsl=0, kaihk=0, rsv_cl=0, op_pack=1"]

    C2 -->|Yes| BRANCH_OP["Operation Settings"]
    BRANCH_OP --> BK_SHOW_OP["bk_btn_v_kbn = 1"]

    C2 -->|No| C3{ido_div = 00055}

    TWRYO_YES3 --> DSL_CHECK2{svc_kei_ucwk_dsl_flg?}
    TWRYO_NO3 --> DSL_CHECK2
    SETS4 --> DSL_CHECK2

    DSL_CHECK2 -->|Yes| DSL_TRUE2["Line cancelled"]
    DSL_TRUE2 --> WITH_OPS_DSL2{op_svc_kei_list_ari?}

    WITH_OPS_DSL2 -->|Yes| DSL_WITH_OPS2["rireki=1, all others=0, op_pack=0"]
    WITH_OPS_DSL2 -->|No| DSL_NO_OPS2["all buttons=0"]

    DSL_CHECK2 -->|No| DSL_FALSE2["Line active"]
    DSL_FALSE2 --> WITH_OPS4{op_svc_kei_list_ari?}

    WITH_OPS4 -->|Yes| WITH_OPS5["Service items exist"]
    WITH_OPS5 --> SETS5["rireki=1, shokai=0, add=0, chg=0, dsl=0, kaihk=0, op_pack=0"]
    SETS5 --> TWRYO5{op_svc_cd = B072}

    TWRYO5 -->|Yes| TWRYO_YES5["rsv_cl=0"]
    TWRYO5 -->|No| TWRYO_NO5["rsv_cl=1"]

    WITH_OPS4 -->|No| NO_OPS3["No service items"]
    NO_OPS3 --> SETS6["all buttons=0"]

    C3 -->|Yes| BRANCH_RC["Reservation Cancel"]
    BRANCH_RC --> BK_SHOW_RC["bk_btn_v_kbn = 1"]

    C3 -->|No| BRANCH_DEF["Default"]
    BRANCH_DEF --> BK_SHOW_DEF["bk_btn_v_kbn = 3"]

    TWRYO_YES5 --> DEF_OPS_CHK{op_svc_kei_list_ari?}
    TWRYO_NO5 --> DEF_OPS_CHK
    SETS6 --> DEF_OPS_CHK

    DEF_OPS_CHK -->|Yes| DEF_WITH_OPS["rireki=1, all others=0, op_pack=0"]
    DEF_OPS_CHK -->|No| DEF_NO_OPS["all buttons=0"]

    DSL_WITH_OPS --> SEND["Send 9 button flags via sendMessageString"]
    DSL_NO_OPS --> SEND
    DSL_WITH_OPS2 --> SEND
    DSL_NO_OPS2 --> SEND
    TWRYO_YES1 --> SEND
    TWRYO_NO1 --> SEND
    TWRYO_YES3 --> SEND
    TWRYO_NO3 --> SEND
    TWRYO_YES5 --> SEND
    TWRYO_NO5 --> SEND
    SETS1 --> SEND
    SETS2 --> SEND
    SETS3 --> SEND
    SETS4 --> SEND
    SETS5 --> SEND
    SETS6 --> SEND
    DEF_WITH_OPS --> SEND
    DEF_NO_OPS --> SEND
    SEND --> END(["Return / Next"])
```

**Processing Flow Summary:**

1. **Initialization (L4501–L4517):** All 9 button visibility flags (`rireki_shokai_btn_v_kbn`, `shokai_btn_v_kbn`, `add_btn_v_kbn`, `chg_btn_v_kbn`, `dsl_btn_v_kbn`, `kaihk_btn_v_kbn`, `rsv_cl_btn_v_kbn`, `bk_btn_v_kbn`, `op_pack_btn_v_kbn`) are initialized to `"1"` (visible/enabled).

2. **Branch 1 — New Contract / Service Addition (L4523–L4573):** When `ido_div` is `"00001"` (New Contract) or `"00002"` (Service Addition):
   - The Back button is hidden (`bk_btn_v_kbn = "0"`).
   - If service items exist: only Add and OP Pack are enabled. For Twryo Stiam (`"B072"`), Change is additionally enabled; otherwise Cancel, Restore, and Reservation Cancel are enabled.
   - If no service items exist: only Add and OP Pack are enabled; all others are disabled.

3. **Branch 2 — Operation Settings (L4580–L4677):** When `ido_div` is `"00031"` (Operation Settings):
   - The Back button is visible (`bk_btn_v_kbn = "1"`).
   - If the line is cancelled/terminated (`svc_kei_ucwk_dsl_flg = true`): only History Display is enabled (with service items) or all buttons are disabled (without).
   - If the line is active: when service items exist, Add and History Display are enabled. For Twryo Stiam, Change is additionally enabled; otherwise Cancel, Restore, and Reservation Cancel are enabled.

4. **Branch 3 — Reservation Cancel (L4684–L4777):** When `ido_div` is `"00055"` (Reservation Cancel):
   - The Back button is visible (`bk_btn_v_kbn = "1"`).
   - If the line is cancelled/terminated: only History Display is enabled (with service items) or all disabled.
   - If the line is active: when service items exist, only History Display is enabled. For Twryo Stiam, Reservation Cancel is disabled; otherwise it is enabled.

5. **Branch 4 — Default / Other (L4784–L4833):** For any other `ido_div` value:
   - The Back button is set to `"3"` (hidden/unused per ANK-2121 modification).
   - If service items exist: only History Display is enabled; all others disabled.
   - If no service items exist: all buttons are disabled.

6. **DataBean Write-Back (L4836–L4847):** All 9 button visibility flags are written to `paramBean[0]` via `sendMessageString()` with keys from `KKW02301SFConst` and the constant `X31CWebConst.DATABEAN_SET_VALUE`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `OneStopDataBeanAccess[]` | Array of DataBean access objects used to read/write screen data. Index `[0]` is used to write back all 9 button visibility flags via `sendMessageString()`. Serves as the bridge between business logic and JSP presentation. |
| 2 | `ido_div` | `String` | Operation division code — classifies the current transaction type/context. Determines which of the 4 main button-configuration branches to enter. Expected values: `"00001"` (New Contract), `"00002"` (Service Addition), `"00031"` (Operation Settings), `"00055"` (Reservation Cancel). Any other value falls into the default branch. |
| 3 | `op_svc_cd` | `String` | Operation service code — identifies the specific operation service type within the selected service item. Used to detect the Twryo Stiam service (`"B072"`) which has special button rules (Change button remains available while Cancel is disabled). |
| 4 | `op_svc_kei_list_ari` | `boolean` | Service item existence flag — `true` indicates the customer already has operation service contract line items; `false` means no items exist. This flag determines whether the screen should show CRUD buttons (Add/Change/Cancel) or be restricted to view-only (History Display). |
| 5 | `svc_kei_ucwk_dsl_flg` | `boolean` | Service detail work cancellation flag — `true` indicates the target phone line has been cancelled or terminated (including cancelled status); `false` means the line is active. This flag heavily constrains available operations: cancelled lines can only show history, not perform any modifications. |

**Constants referenced (resolved):**

| Constant | Value | Business Meaning |
|----------|-------|------------------|
| `JKKCommonConst.IDO_DIV_VALUE_00001` | `"00001"` | Operation division — New Contract (shinkei keiyaku) |
| `JKKCommonConst.IDO_DIV_VALUE_00002` | `"00002"` | Operation division — Service Addition (saabisu tsuika) |
| `JKKCommonConst.IDO_DIV_VALUE_00031` | `"00031"` | Operation division — Operation Settings (opushon settei) |
| `JKKCommonConst.IDO_DIV_VALUE_00055` | `"00055"` | Operation division — Reservation Cancel (kaiyaku torikeshi) |
| `JKKCommonConst.OP_SVC_CD_VALUE_TWRYO_STIAM` | `"B072"` | Operation service code — Twryo Stiam (phone line cost notification service) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| W | `OneStopDataBeanAccess.sendMessageString` | - | - | Writes button visibility flags to the DataBean — pushes 9 key-value pairs to paramBean[0] for JSP rendering |

The method performs **no database reads/writes** and **no service component (SC/CBS) calls**. All operations are purely in-memory computations: initializing local variables, evaluating conditional branches, and writing pre-computed values to the DataBean. This is a **pure UI-state computation method** — it determines what buttons to show/hide based on the current business context without touching persistent data.

**Detailed `sendMessageString` calls (writes to DataBean):**

| # | Type | Method Call | Button Key |
|---|------|-------------|------------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.BK_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, bk_btn_v_kbn)` | Back button visibility |
| 2 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.RSV_CL_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, rsv_cl_btn_v_kbn)` | Reservation Cancel button visibility |
| 3 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.KAIHK_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, kaihk_btn_v_kbn)` | Restore (Recover) button visibility |
| 4 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.DSL_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, dsl_btn_v_kbn)` | Cancel (Terminate) button visibility |
| 5 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.CHG_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, chg_btn_v_kbn)` | Change (Modify) button visibility |
| 6 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.ADD_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, add_btn_v_kbn)` | Add (Register) button visibility |
| 7 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.SHOKAI_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, shokai_btn_v_kbn)` | Display (View) button visibility |
| 8 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.RIREKI_SHOKAI_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, rireki_shokai_btn_v_kbn)` | History Display button visibility |
| 9 | EXEC | `paramBean[0].sendMessageString(KKW02301SFConst.OP_PACK_BTN_V_KBN, X31CWebConst.DATABEAN_SET_VALUE, op_pack_btn_v_kbn)` | OP Pack (Optical-Packet) button visibility |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `sendMessageString` (9 calls to DataBean write-back).

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKA14201SFLogic | `setKbnButtonVisible(paramBean)` -> reads svc_cd -> checks `JKKCommonConst.SVC_CD_02` -> `setBtnVisibleAtTel(paramBean, ido_div, op_svc_cd, op_svc_kei_list_ari, svc_kei_ucwk_dsl_flg)` | `sendMessageString [W] DataBean` (9 writes) |

**Full call chain context:**

```
setKbnButtonVisible(OneStopDataBeanAccess[] paramBean)
  -> paramBean[0].sendMessageString(KKW02301SFConst.SVC_CD, GET)    // reads service code
  -> paramBean[0].sendMessageString(KKW02301SFConst.IDO_DIV, GET)   // reads operation division
  -> paramBean[0].getDataBeanArray(KKW02301SFConst.OP_SVC_KEI_LIST) // reads service item list
  -> if (SVC_CD_02 == svc_cd)
       -> setBtnVisibleAtTel(paramBean, ido_div, op_svc_cd, op_svc_kei_list_ari, svc_kei_ucwk_dsl_flg)
  -> paramBean[0].sendMessageString(KKW02301SFConst.*_BTN_V_KBN, SET)  // writes button flags
```

**Terminal operations summary:** The method performs 9 terminal `sendMessageString` write operations to the DataBean, each setting a button visibility flag (`"0"` or `"1"`). These flags are consumed by the JSP layer for rendering the telephone service operation screen.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] `(all variables)` (L4501)

> Initialize all 9 button visibility flags to `"1"` (visible/enabled by default). This ensures that all buttons start in a visible state and will be selectively hidden/disabled by subsequent branches.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4501) |
| 2 | SET | `shokai_btn_v_kbn = "1"` // Display — visible (L4502) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add — visible (L4503) |
| 4 | SET | `chg_btn_v_kbn = "1"` // Change — visible (L4504) |
| 5 | SET | `dsl_btn_v_kbn = "1"` // Cancel (Terminate) — visible (L4505) |
| 6 | SET | `kaihk_btn_v_kbn = "1"` // Restore (Recover) — visible (L4506) |
| 7 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel — visible (L4507) |
| 8 | SET | `bk_btn_v_kbn = "1"` // Back — visible (L4508) |
| 9 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack — visible [ANK-2056] (L4515) |

---

**Block 2** — [IF] `ido_div = "00001" or "00002"` [IDO_DIV_VALUE_00001="00001", IDO_DIV_VALUE_00002="00002"] (L4523)

> Branch: New Contract / Service Addition. The Back button is hidden because the user arrived from a higher-level screen and cannot go back. Button state further depends on whether service items exist and whether the operation is Twryo Stiam.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "0"` // Back hidden (L4529) |

**Block 2.1** — [IF] `op_svc_kei_list_ari == true` (L4532)

> Service items exist — user has active contract lines. Add, OP Pack are enabled. If Twryo Stiam, Change is available; otherwise Cancel, Restore, and Reservation Cancel are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4535) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4536) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add — visible (L4537) |
| 4 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4538) |
| 5 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4539) |
| 6 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack — visible [ANK-2056] (L4542) |

**Block 2.1.1** — [IF] `op_svc_cd = "B072"` [TWRYO_STIAM="B072"] (L4544)

> Twryo Stiam (phone line cost notification) — special case: Change is enabled, Cancel is disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` // Change — visible (L4545) |
| 2 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4546) |

**Block 2.1.2** — [ELSE] (L4549)

> Non-Twryo Stiam — Change is disabled, Cancel, Restore, and Reservation Cancel are enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4550) |
| 2 | SET | `dsl_btn_v_kbn = "1"` // Cancel — visible (L4551) |
| 3 | SET | `kaihk_btn_v_kbn = "1"` // Restore — visible [IT1-2013-0001038] (L4553) |
| 4 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel — visible [IT1-2013-0001038] (L4554) |

**Block 2.2** — [ELSE] (L4559)

> Service items do not exist — no contract lines. Only Add and OP Pack are enabled; all others are disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4562) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4563) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add — visible (L4564) |
| 4 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4565) |
| 5 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4566) |
| 6 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4567) |
| 7 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4568) |
| 8 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack — visible [ANK-2056] (L4571) |

---

**Block 3** — [ELSE IF] `ido_div = "00031"` [IDO_DIV_VALUE_00031="00031"] (L4580)

> Branch: Operation Settings. The Back button is visible (`bk_btn_v_kbn = "1"`). Button state depends on whether the phone line is cancelled/terminated (`svc_kei_ucwk_dsl_flg`) and whether service items exist.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "1"` // Back — visible (L4586) |

**Block 3.1** — [IF] `svc_kei_ucwk_dsl_flg == true` (L4595)

> The phone line is cancelled/terminated. Operations are heavily restricted.

**Block 3.1.1** — [IF] `op_svc_kei_list_ari == true` (L4600)

> Service items exist but line is cancelled. Only History Display is enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4603) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4604) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4605) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4606) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4607) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4608) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4609) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4612) |

**Block 3.1.2** — [ELSE] (L4617)

> No service items and line is cancelled. All buttons disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4620) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4621) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4622) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4623) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4624) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4625) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4626) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4629) |

**Block 3.2** — [ELSE] (L4634)

> The phone line is NOT cancelled/terminated (active line).

**Block 3.2.1** — [IF] `op_svc_kei_list_ari == true` (L4639)

> Active line with service items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4642) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4643) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add — visible (L4644) |
| 4 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack — visible [ANK-2056] (L4647) |

**Block 3.2.1.1** — [IF] `op_svc_cd = "B072"` [TWRYO_STIAM="B072"] (L4649)

> Twryo Stiam — Change enabled, Cancel disabled, Restore disabled, Reservation Cancel disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` // Change — visible (L4650) |
| 2 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4651) |
| 3 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4652) |
| 4 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4653) |

**Block 3.2.1.2** — [ELSE] (L4656)

> Non-Twryo Stiam — Change disabled, Cancel enabled, Restore enabled, Reservation Cancel enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4657) |
| 2 | SET | `dsl_btn_v_kbn = "1"` // Cancel — visible (L4658) |
| 3 | SET | `kaihk_btn_v_kbn = "1"` // Restore — visible (L4659) |
| 4 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel — visible (L4660) |

**Block 3.2.2** — [ELSE] (L4665)

> Active line, no service items. Only Add and OP Pack enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4668) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4669) |
| 3 | SET | `add_btn_v_kbn = "1"` // Add — visible (L4670) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4671) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4672) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4673) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4674) |
| 8 | SET | `op_pack_btn_v_kbn = "1"` // OP Pack — visible [ANK-2056] (L4677) |

---

**Block 4** — [ELSE IF] `ido_div = "00055"` [IDO_DIV_VALUE_00055="00055"] (L4684)

> Branch: Reservation Cancel. The Back button is visible (`bk_btn_v_kbn = "1"`). Similar structure to Branch 3 but with different button rules — focused on reservation cancellation workflow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "1"` // Back — visible (L4690) |

**Block 4.1** — [IF] `svc_kei_ucwk_dsl_flg == true` (L4699)

> Line is cancelled/terminated during reservation cancel.

**Block 4.1.1** — [IF] `op_svc_kei_list_ari == true` (L4704)

> Service items exist but line cancelled. Only History Display enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4707) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4708) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4709) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4710) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4711) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4712) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4713) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4716) |

**Block 4.1.2** — [ELSE] (L4721)

> No service items, line cancelled. All buttons disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4724) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4725) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4726) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4727) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4728) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4729) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4730) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4733) |

**Block 4.2** — [ELSE] (L4738)

> Line is active (not cancelled).

**Block 4.2.1** — [IF] `op_svc_kei_list_ari == true` (L4743)

> Active line with service items. History Display always enabled. Reservation Cancel behavior depends on Twryo Stiam.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4746) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4747) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4748) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4749) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4750) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4751) |
| 7 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4754) |

**Block 4.2.1.1** — [IF] `op_svc_cd = "B072"` [TWRYO_STIAM="B072"] (L4756)

> Twryo Stiam — Reservation Cancel is disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4757) |

**Block 4.2.1.2** — [ELSE] (L4760)

> Non-Twryo Stiam — Reservation Cancel is enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsv_cl_btn_v_kbn = "1"` // Reservation Cancel — visible (L4761) |

**Block 4.2.2** — [ELSE] (L4766)

> Active line, no service items. All buttons disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4769) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4770) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4771) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4772) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4773) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4774) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4775) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4778) |

---

**Block 5** — [ELSE] `(default — all other ido_div values)` (L4790)

> Branch: Default / Other operation divisions. The Back button is set to `"3"` (hidden/unused per ANK-2121-00-00 modification from original `"0"`). No check for `svc_kei_ucwk_dsl_flg` — only `op_svc_kei_list_ari` is evaluated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "3"` // Back hidden/unused [ANK-2121-00-00] (L4801) |

**Block 5.1** — [IF] `op_svc_kei_list_ari == true` (L4806)

> Service items exist. Only History Display is enabled; all CRUD buttons are disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` // History Display — visible (L4809) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4810) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4811) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4812) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4813) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4814) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4815) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4818) |

**Block 5.2** — [ELSE] (L4823)

> No service items. All buttons disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` // History Display — hidden (L4826) |
| 2 | SET | `shokai_btn_v_kbn = "0"` // Display — hidden (L4827) |
| 3 | SET | `add_btn_v_kbn = "0"` // Add — hidden (L4828) |
| 4 | SET | `chg_btn_v_kbn = "0"` // Change — hidden (L4829) |
| 5 | SET | `dsl_btn_v_kbn = "0"` // Cancel — hidden (L4830) |
| 6 | SET | `kaihk_btn_v_kbn = "0"` // Restore — hidden (L4831) |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` // Reservation Cancel — hidden (L4832) |
| 8 | SET | `op_pack_btn_v_kbn = "0"` // OP Pack — hidden [ANK-2056] (L4835) |

---

**Block 6** — [TERMINAL DATA WRITE-BACK] (L4836)

> Write all 9 button visibility flags to the DataBean via `sendMessageString`. These are consumed by the JSP for rendering button states.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(BK_BTN_V_KBN, SET, bk_btn_v_kbn)` // Back button (L4836) |
| 2 | EXEC | `paramBean[0].sendMessageString(RSV_CL_BTN_V_KBN, SET, rsv_cl_btn_v_kbn)` // Reservation Cancel (L4837) |
| 3 | EXEC | `paramBean[0].sendMessageString(KAIHK_BTN_V_KBN, SET, kaihk_btn_v_kbn)` // Restore (L4838) |
| 4 | EXEC | `paramBean[0].sendMessageString(DSL_BTN_V_KBN, SET, dsl_btn_v_kbn)` // Cancel/Terminate (L4839) |
| 5 | EXEC | `paramBean[0].sendMessageString(CHG_BTN_V_KBN, SET, chg_btn_v_kbn)` // Change/Modify (L4840) |
| 6 | EXEC | `paramBean[0].sendMessageString(ADD_BTN_V_KBN, SET, add_btn_v_kbn)` // Add/Register (L4841) |
| 7 | EXEC | `paramBean[0].sendMessageString(SHOKAI_BTN_V_KBN, SET, shokai_btn_v_kbn)` // Display/View (L4842) |
| 8 | EXEC | `paramBean[0].sendMessageString(RIREKI_SHOKAI_BTN_V_KBN, SET, rireki_shokai_btn_v_kbn)` // History Display (L4843) |
| 9 | EXEC | `paramBean[0].sendMessageString(OP_PACK_BTN_V_KBN, SET, op_pack_btn_v_kbn)` // OP Pack [ANK-2056] (L4846) |

**Block 7** — [RETURN] `void` (L4847)

> Method completes. Control returns to `setKbnButtonVisible()` which continues to process other service types (Net, TV) or returns to the calling screen method.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_div` | Field | Operation Division Code — classifies the type of business transaction being performed (new contract, service addition, operation settings, etc.) |
| `op_svc_cd` | Field | Operation Service Code — identifies the specific operation service within a service item; `"B072"` denotes the Twryo Stiam (phone line cost notification) service |
| `op_svc_kei_list_ari` | Field | Operation Service Item Existence Flag — `true` if the customer has existing operation service contract line items |
| `svc_kei_ucwk_dsl_flg` | Field | Service Detail Work Cancellation Flag — `true` if the target phone line has been cancelled or terminated |
| `rireki_shokai_btn_v_kbn` | Field | History Display Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the History Display button. |
| `shokai_btn_v_kbn` | Field | Display Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Display/View button. |
| `add_btn_v_kbn` | Field | Add Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Add/Register button. |
| `chg_btn_v_kbn` | Field | Change Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Change/Modify button. |
| `dsl_btn_v_kbn` | Field | Cancel Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Cancel/Terminate button. |
| `kaihk_btn_v_kbn` | Field | Restore Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Restore/Recover button. |
| `rsv_cl_btn_v_kbn` | Field | Reservation Cancel Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Reservation Cancel button. |
| `bk_btn_v_kbn` | Field | Back Button Visibility Key — `"1"` = visible, `"0"` = hidden, `"3"` = hidden/unused. Controls the Back button. |
| `op_pack_btn_v_kbn` | Field | OP Pack Button Visibility Key — `"1"` = visible, `"0"` = hidden. Controls the Optical-Packet button. |
| `paramBean` | Field | OneStopDataBeanAccess array — DataBean access object used to read/write screen data between Java logic and JSP presentation |
| OneStopDataBeanAccess | Class | DataBean access wrapper class for One Stop (wanstop) system screens — provides `sendMessageString()` for key-value data exchange |
| OneStopDataBeanAccess.sendMessageString | Method | Reads or writes a string value to the DataBean by key, using `DATABEAN_GET_VALUE` or `DATABEAN_SET_VALUE` as the operation mode |
| X31CWebConst.DATABEAN_SET_VALUE | Constant | Enum/string constant indicating `sendMessageString()` should WRITE to the DataBean |
| `KKW02301SFConst.BK_BTN_V_KBN` | Constant | DataBean key for the Back button visibility flag |
| `KKW02301SFConst.RSV_CL_BTN_V_KBN` | Constant | DataBean key for the Reservation Cancel button visibility flag |
| `KKW02301SFConst.KAIHK_BTN_V_KBN` | Constant | DataBean key for the Restore button visibility flag |
| `KKW02301SFConst.DSL_BTN_V_KBN` | Constant | DataBean key for the Cancel (Terminate) button visibility flag |
| `KKW02301SFConst.CHG_BTN_V_KBN` | Constant | DataBean key for the Change (Modify) button visibility flag |
| `KKW02301SFConst.ADD_BTN_V_KBN` | Constant | DataBean key for the Add (Register) button visibility flag |
| `KKW02301SFConst.SHOKAI_BTN_V_KBN` | Constant | DataBean key for the Display (View) button visibility flag |
| `KKW02301SFConst.RIREKI_SHOKAI_BTN_V_KBN` | Constant | DataBean key for the History Display button visibility flag |
| `KKW02301SFConst.OP_PACK_BTN_V_KBN` | Constant | DataBean key for the OP Pack (Optical-Packet) button visibility flag |
| `KKW02301SFConst.SVC_CD` | Constant | DataBean key for the service code (used by caller `setKbnButtonVisible`) |
| `KKW02301SFConst.IDO_DIV` | Constant | DataBean key for the operation division code |
| `JKKCommonConst.IDO_DIV_VALUE_00001` | Constant | `"00001"` — Operation Division: New Contract (shinkei keiyaku) |
| `JKKCommonConst.IDO_DIV_VALUE_00002` | Constant | `"00002"` — Operation Division: Service Addition (saabisu tsuika) |
| `JKKCommonConst.IDO_DIV_VALUE_00031` | Constant | `"00031"` — Operation Division: Operation Settings (opushon settei) |
| `JKKCommonConst.IDO_DIV_VALUE_00055` | Constant | `"00055"` — Operation Division: Reservation Cancel (kaiyaku torikeshi) |
| `JKKCommonConst.OP_SVC_CD_VALUE_TWRYO_STIAM` | Constant | `"B072"` — Operation Service Code: Twryo Stiam (phone line cost notification service) |
| `JKKCommonConst.SVC_CD_02` | Constant | Service code value for Telephone Service (denwa saabisu) |
| `JOKYAKU` | Business term | Reservation — refers to the reservation management workflow for telecom service contracts |
| `SHINKEI KEIYAKU` | Business term | New Contract — initial service registration for a new customer line |
| `SAABISU TSUIKA` | Business term | Service Addition — adding new services to an existing customer account |
| `OPUSHON SETTEI` | Business term | Operation Settings — configuring or modifying existing service settings |
| `TAISHO DENWA` | Business term | Target Phone — the phone line being operated on |
| `KAIYAKU TORIKESHI` | Business term | Reservation Cancel — cancelling a previously reserved service change |
| `RYAKU` | Business term | Cancellation/Termination — the phone line has been cancelled or terminated |
| `KAIHKU` | Business term | Restore/Recover — restoring a cancelled line or reversing a cancellation |
| `HANBAI` | Business term | Sales — refers to sales promotion and discount registration |
| WANSTOP | Business term | One Stop — the unified contract management system (wanstopu men) |
| TWRYO STIAM | Business term | Twryo Stiam (Phone Line Cost Stimulation) — a telecom cost notification service (service code B072) with special button rules |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband service (referenced in related methods of this class) |
| OP PACK | Business term | Optical-Packet — bundled optical and packet-based communication services |
| ANK-2056-00-00 | Change ID | Added OP Pack button visibility support for the Optical-Packet service |
| ANK-2121-00-00 | Change ID | Modified Back button default from `"0"` (hidden) to `"3"` (hidden/unused) for the default branch |
| IT1-2013-0001038 | Change ID | Quality improvement support — added Restore and Reservation Cancel buttons as visible for non-Twryo Stiam services in new contract flow |
