# Business Logic — KKW05602SFLogic.setTokiInfoFromDB() [169 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05602SF.KKW05602SFLogic` |
| Layer | Service Logic (Webview Service Framework) |
| Module | `KKW05602SF` (Package: `eo.web.webview.KKW05602SF`) |

## 1. Role

### KKW05602SFLogic.setTokiInfoFromDB()

This method is the **porting information retrieval and population** service that loads porting (phone number porting / "toki" 電話番号変更) related data from the service contract detail data bean (`svcUtwkEoTelBean`) into the screen display data bean (`bean`) and the customer contract data bean (`custKeiHktgiBean`). It serves as the **data initialization bridge** between the backend service contract detail state and the web screen representation for the phone number change screen (KKW05602SF).

The method handles two distinct porting contexts based on the porting registration condition: **post-porting after opening** (where both pre- and post-porting data exist, identified by `TOKI_ADD_OPAF = "2"`) and **pre-porting / standard porting** (the default path). It also supports an **onchange refresh mode** (`mode == 2`) that allows the user to dynamically re-select the porting registration division and reload the corresponding data — for example, switching from "post-porting registration" (`ITENSAKI_ADD_TOKI = "1"`) to "suspension/termination" handling.

The method implements a **delegation and routing pattern**: it queries a helper method (`getTokiAddCondtion`) to determine the porting state, then dispatches data extraction to either the post-porting or standard data path, applies onchange filtering if needed, transforms raw codes to display names via `getCodeValue`, formats dates via `setYmdData`, resolves phone numbers via `getItenMTelNo` and `getRRSKTelNo`, and finally writes all resolved values into the screen bean. A final call to `setTokiHdn` persists the porting information (for both pre- and post-porting) into hidden form fields for roundtrip submission.

It plays the role of a **shared service utility** called by the screen's initialization action (`actionTokiUpdInit`) to populate the form state before rendering the phone number change screen to the operator.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setTokiInfoFromDB(bean, custKeiHktgiBean, svcUtwkEoTelBean, mode)"])
    STEP1["Get target phone number from svcUtwkEoTelBean<br>using TELNO_05"]
    STEP2["Set target phone number to bean<br>using TOKI_TG_TELNO"]
    STEP3["Call getTokiAddCondtion(bean)<br>to get tokiAddCond"]
    STEP4{"tokiAddCond == '2'<br>(TOKI_ADD_OPAF = post-porting<br>after opening)"}
    STEP5["Post-porting branch:<br>Get itenKibo, tokiSbtCd, tokiAddCd,<br>itenTokiStaRsvYmd, itenTokiEndRsvYmd,<br>tokiTensoSkSvkuwno, tokiAddCdSk<br>from svcUtwkEoTelBean"]
    STEP6["Other branch:<br>Get itenKibo, tokiSbtCd, tokiAddCd,<br>itenTokiStaRsvYmd, itenTokiEndRsvYmd,<br>tokiTensoSkTelno, tokiTensoSkSvkuwno,<br>tokiAddCdMt from svcUtwkEoTelBean"]
    STEP7{"mode == 2<br>(onchange toki registration<br>division branch)"}
    STEP8["Get selectedTokiAdd from bean<br>using TOKI_ADD_DIV_CD"]
    STEP9{"selectedTokiAdd == '1'<br>(ITENSAKI_ADD_TOKI = post-porting<br>registration)"}
    STEP10["Post-porting registration branch:<br>Same data as step5<br>(post-porting source)"]
    STEP11["Other case (suspension/termination):<br>Same data as step6"]
    STEP12["Set itenKibo to bean<br>ITNTOKI_KIBO_UM and TOKI_KIBO_DSP"]
    STEP13["Set tokiSbtCd display name to bean<br>using getCodeValue(tokiSbtCd, CD00324DETAILLIST)"]
    STEP14["Set tokiSbtCd code to bean<br>using TOKI_SBT_CD"]
    STEP15["Set itenTokiEndRsvYmd to bean<br>using setYmdData -> TOKI_END_RSV_*"]
    STEP16["Set tokiAddCd, tokiAddCdMt, tokiAddCdSk<br>using TOKI_ADD_DIV_CD,<br>ITNTOKI_ADD_CD_ITNMT,<br>ITNTOKI_ADD_CD_ITNSK"]
    STEP17["Set itenTokiStaRsvYmd to bean<br>using setYmdData -> TOKI_STA_RSV_*"]
    STEP18["Set itenMTelNo to bean<br>using getItenMTelNo(tokiAddCd, telNo,<br>tokiTensoSkTelno)"]
    STEP19["Set rrksTelNo to bean<br>using getRRSKTelNo(bean, tokiAddCd,<br>tokiTensoSkTelno,<br>tokiTensoSkSvkuwno)"]
    STEP20["Get reserved phone number from<br>custKeiHktgiBean using RSV_TELNO_S_11"]
    STEP21["Set reserved phone number to bean<br>using RSV_TELNO_DSP"]
    STEP22["Set tokiNaiyo to bean<br>using getTokiNaiyo(bean, tokiSbtCd)"]
    STEP23["Call setTokiHdn(bean, svcUtwkEoTelBean)<br>Set toki info to hidden items"]
    END(["Return / Next"])
    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 -->|Yes| STEP5
    STEP4 -->|No| STEP6
    STEP5 --> STEP7
    STEP6 --> STEP7
    STEP7 -->|Yes| STEP8
    STEP8 --> STEP9
    STEP7 -->|No| STEP12
    STEP9 -->|Yes| STEP10
    STEP9 -->|No| STEP11
    STEP10 --> STEP12
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> STEP14
    STEP14 --> STEP15
    STEP15 --> STEP16
    STEP16 --> STEP17
    STEP17 --> STEP18
    STEP18 --> STEP19
    STEP19 --> STEP20
    STEP20 --> STEP21
    STEP21 --> STEP22
    STEP22 --> STEP23
    STEP23 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The screen display data bean used to populate form fields for the phone number change (toki henkou 電話番号変更) screen. It acts as the output target — all resolved display values (porting info, phone numbers, dates, codes) are written into this bean via `sendMessageString`. |
| 2 | `custKeiHktgiBean` | `X31SDataBeanAccess` | The customer contract inheritance data bean that carries the reserved/active phone number (`RSV_TELNO_S_11`) for display. Used to read the currently contracted phone number shown to the operator. |
| 3 | `svcUtwkEoTelBean` | `X31SDataBeanAccess` | The service contract detail <eo telecom> data bean containing the raw service state including target phone number, porting preferences, porting type codes, porting dates, and forwarding numbers. This is the primary **read source** for porting data. |
| 4 | `mode` | `int` | The processing mode flag. `mode == 2` indicates the onchange porting registration division branch — when the operator changes the porting registration division selection on-screen, triggering a reload of the corresponding porting data for that selection. Other values skip the onchange branch and use the initial data already loaded in the bean. |

**Instance fields / external state read:**
- No instance fields are directly accessed by this method. All state is passed via parameters.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW05602SFLogic.getTokiAddCondtion` | (inferred: KKW05602SF) | - | Reads porting registration condition from bean to determine whether porting is post-porting, both, or other. |
| R | `KKW05602SFLogic.getCodeValue` | (inferred: KKW05602SF) | - | Converts porting type code (e.g., `tokiSbtCd`) to its display label using detail list `CD00324DETAILLIST`. |
| R | `KKW05602SFLogic.getItenMTelNo` | (inferred: KKW05602SF) | - | Determines the "previous" phone number based on porting registration division and forwarding number. |
| R | `KKW05602SFLogic.getRRSKTelNo` | (in inferred: KKW05602SF) | - | Resolves the contact phone number — for porting registration cases, extracts phone number from service contract detail number; otherwise falls back to forwarding number. |
| - | `KKW05602SFLogic.setYmdData` | (inferred: KKW05602SF) | - | Formats a YYYYMMDD date string into separate year/month/day fields on the bean. |
| - | `KKW05602SFLogic.setTokiHdn` | (inferred: KKW05602SF) | - | Sets porting information (for both pre- and post-porting) into hidden form fields for roundtrip persistence. |
| R | `KKW05602SFLogic.getTokiNaiyo` | (inferred: KKW05602SF) | - | Determines the porting content description text based on porting type code. |
| - | `OneStopDataBeanAccess.sendMessageString` | - | - | Framework method used throughout to read from and write to data beans. Acts as the data access mechanism for all bean operations (GET/SET). |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: KKW05602SFLogic | `KKW05602SFLogic.actionTokiUpdInit()` → `setTokiInfoFromDB(bean, custKeiHktgiBean, svcUtwkEoTelBean, mode)` | `setTokiHdn [-]`, `sendMessageString [-]` (R), `getTokiAddCondtion [R]`, `getCodeValue [R]`, `getItenMTelNo [R]`, `getRRSKTelNo [R]`, `setYmdData [-]`, `getTokiNaiyo [R]` |

**Notes:**
- The pre-computed graph identifies `KKW05602SFLogic.actionTokiUpdInit()` as the direct caller within the same class.
- No screen/batch entry points (e.g., `KKSVxxxx` controllers) were found within 8 hops of this method.
- The method is primarily an internal utility method used by the KKW05602SF screen's initialization action.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (Get target phone number) (L567)

> Retrieves the target phone number from the service contract detail bean and stores it in the display bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `telNo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TELNO_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get target phone number from service contract detail bean [-> "電話番号"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_TG_TELNO, X31CWebConst.DATABEAN_SET_VALUE, telNo)` // Set target phone number to display bean [-> "トーク対象電話番号"] |

**Block 2** — [IF] `(TOKI_ADD_OPAF.equals(tokiAddCond))` [TOKI_ADD_OPAF = "2" (post-porting after opening)] (L599)

> Determines whether the porting condition is post-porting after opening. If so, extracts all porting data from the post-porting branch of the service contract detail bean. Otherwise, extracts from the standard (pre-porting) branch.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `itenKibo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_KIBO_UM_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting preference [-> "移転先開放後トーク希望有無"] |
| 2 | EXEC | `tokiSbtCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_SBT_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting type code [-> "移転先開放後トーク種類コード"] |
| 3 | EXEC | `tokiAddCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting registration code [-> "移転先開放後トーク登録コード"] |
| 4 | EXEC | `itenTokiStaRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_STA_RSYMD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting start reservation date [-> "移転先開放後トーク開始予約年月日"] |
| 5 | EXEC | `itenTokiEndRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_END_RSYMD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting end reservation date [-> "移転先開放後トーク終了予約年月日"] |
| 6 | SET | `tokiTensoSkTelno = ""` // Clear forwarding target phone number for post-porting case |
| 7 | EXEC | `tokiTensoSkSvkuwno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNS_OPAF_TOKI_TSS_SVKUWNO_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get forwarding target service contract detail number [-> "移転先開放後トーク転送先サービス契約内訳番号"] |
| 8 | EXEC | `tokiAddCdSk = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get post-porting registration code for Sk [-> "移転先開放後トーク登録コード"] |

**Block 2.1** — [ELSE] (Standard / pre-porting branch) (L609)

> When porting condition is NOT post-porting after opening, extract data from the standard (pre-porting) bean keys. This is the default path for regular porting cases.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `itenKibo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_KIBO_UM_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting preference [-> "移転トーク希望有無"] |
| 2 | EXEC | `tokiSbtCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_SBT_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting type code [-> "移転トーク種類コード"] |
| 3 | EXEC | `tokiAddCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting registration code [-> "移転トーク登録コード"] |
| 4 | EXEC | `itenTokiStaRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_MAN_STA_RSV_YMD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get manual start reservation date [-> "移転トーク手動開始予約年月日"] |
| 5 | EXEC | `itenTokiEndRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_END_RSV_YMD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting end reservation date [-> "移転トーク終了予約年月日"] |
| 6 | EXEC | `tokiTensoSkTelno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_TELNO_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get forwarding target phone number [-> "トーク転送先電話番号"] |
| 7 | EXEC | `tokiTensoSkSvkuwno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_SVKUWNO_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get forwarding target service contract detail number [-> "トーク転送先サービス契約内訳番号"] |
| 8 | EXEC | `tokiAddCdMt = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` // Get porting registration code for Mt [-> "移転トーク登録コード"] |

**Block 3** — [IF] `(mode == 2)` [onchange porting registration division branch] (L622)

> When the operator changes the porting registration division on-screen (mode == 2), re-fetch the corresponding porting data based on the currently selected division code. This supports dynamic screen updates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectedTokiAdd = ""` // Initialize selected porting registration division |
| 2 | EXEC | `selectedTokiAdd = bean.sendMessageString(KKW05602SFConst.TOKI_ADD_DIV_CD, X31CWebConst.DATABEAN_GET_VALUE)` // Get selected porting registration division code from bean [-> "トーク登録区分コード"] |
| 3 | IF | [Block 3.1 — ITENSAKI_ADD_TOKI check] `L626` |

**Block 3.1** — [IF] `(ITENSAKI_ADD_TOKI.equals(selectedTokiAdd))` [ITENSAKI_ADD_TOKI = "1" (post-porting registration)] (L626)

> The selected division is "post-porting registration". Extract data from the post-porting branch of the service bean, same as Block 2.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `itenKibo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_KIBO_UM_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 2 | EXEC | `tokiSbtCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_SBT_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 3 | EXEC | `tokiAddCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 4 | EXEC | `itenTokiStaRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_STA_RSYMD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 5 | EXEC | `itenTokiEndRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_END_RSYMD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 6 | SET | `tokiTensoSkTelno = ""` // Clear forwarding target phone number |
| 7 | EXEC | `tokiTensoSkSvkuwno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNS_OPAF_TOKI_TSS_SVKUWNO_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 8 | EXEC | `tokiAddCdSk = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITENS_OPAF_TOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |

**Block 3.2** — [ELSE] (Other onchange case — suspension/termination) (L637)

> The selected division is NOT post-porting registration (e.g., it is "suspension" or "termination"). Extract data from the standard (pre-porting) branch, same as Block 2.1.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `itenKibo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_KIBO_UM_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 2 | EXEC | `tokiSbtCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_SBT_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 3 | EXEC | `tokiAddCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 4 | EXEC | `itenTokiStaRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_MAN_STA_RSV_YMD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 5 | EXEC | `itenTokiEndRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_END_RSV_YMD_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 6 | EXEC | `tokiTensoSkTelno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_TELNO_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 7 | EXEC | `tokiTensoSkSvkuwno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_SVKUWNO_05, X31CWebConst.DATABEAN_GET_VALUE)` |
| 8 | EXEC | `tokiAddCdMt = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_05, X31CWebConst.DATABEAN_GET_VALUE)` |

**Block 4** — [SET] (Set porting preference) (L654)

> Write the porting preference (whether the customer requests porting) to the display bean in two field variants.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW05602SFConst.ITNTOKI_KIBO_UM, X31CWebConst.DATABEAN_SET_VALUE, itenKibo)` // Set porting preference [-> "移転トーク希望有無"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_KIBO_DSP, X31CWebConst.DATABEAN_SET_VALUE, itenKibo)` // Set porting preference display [-> "トーク希望（表示）"] |

**Block 5** — [SET] (Set porting type) (L659)

> Convert the raw porting type code to its display name and set both the code and display name on the bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_SBT, X31CWebConst.DATABEAN_SET_VALUE, getCodeValue(tokiSbtCd, bean, KKW05602SFConst.CD00324DETAILLIST))` // Set porting type display name using detail list [-> "トーク種類"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, tokiSbtCd)` // Set porting type code [-> "トーク種類コード"] |

**Block 6** — [SET] (Set porting end reservation date) (L667)

> Format the porting end reservation date (YYYYMMDD string) into separate year/month/day bean fields.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setYmdData(bean, itenTokiEndRsvYmd, KKW05602SFConst.TOKI_END_RSV_YEAR, KKW05602SFConst.TOKI_END_RSV_MON, KKW05602SFConst.TOKI_END_RSV_DAY)` // Set end date parts [-> "トーク終了予約日（年）", "トーク終了予約日（月）", "トーク終了予約日（日）"] |

**Block 7** — [SET] (Set porting registration division) (L676)

> Write the porting registration division code and its per-branch variants (pre-porting Mt and post-porting Sk) to the bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_ADD_DIV_CD, X31CWebConst.DATABEAN_SET_VALUE, tokiAddCd)` // Set porting registration division code [-> "トーク登録区分コード"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_ITNMT, X31CWebConst.DATABEAN_SET_VALUE, tokiAddCdMt)` // Set pre-porting division code [-> "移転トーク登録コード（移転元）"] |
| 3 | EXEC | `bean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_ITNSK, X31CWebConst.DATABEAN_SET_VALUE, tokiAddCdSk)` // Set post-porting division code [-> "移転トーク登録コード（移転先）"] |

**Block 8** — [SET] (Set porting manual start reservation date) (L684)

> Format the porting start reservation date into year/month/day fields.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setYmdData(bean, itenTokiStaRsvYmd, KKW05602SFConst.TOKI_STA_RSV_YEAR, KKW05602SFConst.TOKI_STA_RSV_MON, KKW05602SFConst.TOKI_STA_RSV_DAY)` // Set start date parts [-> "トーク手動開始予約日（年）", "トーク手動開始予約日（月）", "トーク手動開始予約日（日）"] |

**Block 9** — [SET] (Set previous phone number) (L690)

> Compute and display the previous phone number. When porting to post-opening, this is the original number; otherwise, it may be the forwarding number.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW05602SFConst.ITENM_TELNO, X31CWebConst.DATABEAN_SET_VALUE, getItenMTelNo(tokiAddCd, telNo, tokiTensoSkTelno))` // Set previous phone number [-> "移転元電話番号"] |

**Block 10** — [SET] (Set contact phone number) (L693)

> Resolve the contact phone number. For porting registration cases, this is derived from the service contract detail number of the forwarding target; otherwise, it falls back to the forwarding target phone number.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `rrksTelNo = getRRSKTelNo(bean, tokiAddCd, tokiTensoSkTelno, tokiTensoSkSvkuwno)` // Resolve contact phone number [-> "連絡先電話番号"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.RRKS_TELNO, X31CWebConst.DATABEAN_SET_VALUE, rrksTelNo)` // Set contact phone number to bean [-> "連絡先電話番号"] |

**Block 11** — [SET] (Set reserved phone number) (L699)

> Read the currently reserved/active phone number from the customer contract bean and display it.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `rsvTelNo = custKeiHktgiBean.sendMessageString(KKW05602SFConst.RSV_TELNO_S_11, X31CWebConst.DATABEAN_GET_VALUE)` // Get reserved phone number (select) [-> "予約中電話番号（選択）"] |
| 2 | EXEC | `bean.sendMessageString(KKW05602SFConst.RSV_TELNO_DSP, X31CWebConst.DATABEAN_SET_VALUE, rsvTelNo)` // Set reserved phone number display [-> "予約中電話番号（表示）"] |

**Block 12** — [SET] (Set porting content description) (L704)

> Determine the descriptive text for the porting content (e.g., "suspension with forwarding number", "transfer with number reservation") based on the porting type code.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW05602SFConst.TOKI_NAIYO, X31CWebConst.DATABEAN_SET_VALUE, getTokiNaiyo(bean, tokiSbtCd))` // Set porting content description [-> "トーク内容"] |

**Block 13** — [CALL] (Set hidden porting fields) (L710)

> Persist all porting information (both pre-porting and post-porting) into hidden form fields for roundtrip submission persistence.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setTokiHdn(bean, svcUtwkEoTelBean)` // Set porting info to hidden items for roundtrip |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `toki` (トーク) | Domain term | Phone number porting (tel number change) — short for "tokushu denwa bangō henkou" (special telephone number change), the process of porting a phone number to a new service/provider while keeping the number |
| `tokiAddCond` | Field | Porting registration condition — determines whether the porting state is post-porting after opening (`"2"`), both (`"1"`), or other |
| `tokiAddCd` | Field | Porting registration code — classifies the type of porting registration (e.g., post-porting registration, standard registration) |
| `tokiSbtCd` | Field | Porting type code — classifies the porting operation type (e.g., suspension, transfer, termination with number) |
| `itenKibo` | Field | Porting preference (yes/no) — whether the customer requests porting |
| `itenTokiStaRsvYmd` | Field | Porting start reservation date — the scheduled date when the porting operation begins (YYYYMMDD format) |
| `itenTokiEndRsvYmd` | Field | Porting end reservation date — the scheduled date when the porting operation completes (YYYYMMDD format) |
| `tokiTensoSkTelno` | Field | Porting forwarding target phone number — the new phone number the ported number will forward to |
| `tokiTensoSkSvkuwno` | Field | Porting forwarding target service contract detail number — the service contract line item number at the forwarding destination |
| `ITENSAKI_ADD_TOKI` | Constant | "1" — Post-porting registration code / division, indicating the operator selected "port after porting destination is open" |
| `TOKI_ADD_OPAF` | Constant | "2" — Post-porting after opening code, indicating both pre- and post-porting data exist (post-porting state has been opened) |
| `TOKI_ADD_BOTH` | Constant | "1" — Both pre- and post-porting data exist |
| `CD00324DETAILLIST` | Field | Porting type code detail list — lookup table used by `getCodeValue` to convert porting type codes to display labels |
| `CD00325DETAILLIST` | Field | Porting registration code division detail list — lookup table for porting registration division codes |
| ` getCodeValue` | Method | Converts a raw code value to its human-readable display label by looking up the code in a detail list |
| `setYmdData` | Method | Formats a YYYYMMDD date string into separate year, month, and day bean fields for form display |
| `getItenMTelNo` | Method | Determines the "previous" (pre-porting source) phone number, considering porting registration division and forwarding number |
| `getRRSKTelNo` | Method | Resolves the contact phone number — for porting registration, derives from service contract detail number; otherwise returns forwarding number |
| `getTokiNaiyo` | Method | Determines the porting content description text based on porting type code (e.g., "suspension with forwarding number", "transfer with number reservation") |
| `setTokiHdn` | Method | Sets porting information for both pre-porting and post-porting cases into hidden form fields for roundtrip submission |
| `bean` | Parameter | Screen display data bean — the output target for all form field values rendered to the web screen |
| `svcUtwkEoTelBean` | Parameter | Service contract detail <eo telecom> data bean — the read source for raw porting and service state data from the backend |
| `custKeiHktgiBean` | Parameter | Customer contract inheritance data bean — carries the currently active/reserved phone number for display |
| `mode` | Parameter | Processing mode flag — `mode == 2` triggers onchange branch for dynamic reload of porting data when the user changes the porting division selection |
| `TELNO_05` | Constant | "電話番号" — Service contract detail <eo telecom> phone number field key |
| `TOKI_TG_TELNO` | Constant | "トーク対象電話番号" — Target phone number for porting |
| `RSV_TELNO_S_11` | Constant | "予約中電話番号（選択）" — Reserved/active phone number (select) field key in customer contract bean |
| `RSV_TELNO_DSP` | Constant | "予約中電話番号（表示）" — Reserved phone number display field |
| `ITNTOKI_KIBO_UM` | Constant | "移転トーク希望有無" — Porting preference (yes/no) bean field |
| `TOKI_KIBO_DSP` | Constant | "トーク希望（表示）" — Porting preference display field |
| `TOKI_SBT` | Constant | "トーク種類" — Porting type display field |
| `TOKI_SBT_CD` | Constant | "トーク種類コード" — Porting type code field |
| `TOKI_NAIYO` | Constant | "トーク内容" — Porting content description field |
| `TOKI_ADD_DIV_CD` | Constant | "トーク登録区分コード" — Porting registration division code field |
| `ITENM_TELNO` | Constant | "移転元電話番号" — Pre-porting source phone number |
| `RRKS_TELNO` | Constant | "連絡先電話番号" — Contact phone number |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity in K-Opticom's system |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service offered by K-Opticom |
| KK-Opticom | Business term | K-Opticom, the telecommunications service provider — this system is part of K-Opticom's customer service operations platform |
| 電話番号変更 (Denwa Bangou Henkou) | Japanese term | Phone number change / porting — the business operation of changing a subscriber's phone number while retaining it across service transitions |