プロジェクト

全般

プロフィール

Bug(バグ) #3190

2系から3系にコンバートする際に正しくフォームタイプがコンバートされない

悠 對木11年以上前に追加. 8年以上前に更新.

ステータス:
Fixed(完了)
優先度:
Normal(通常)
対象バージョン:
開始日:
2012-08-30
期日:
進捗率:

100%

3.6 で発生するか:
Yes (はい)
3.8 で発生するか:
No (いいえ)

説明

■詳細
2系にはあって3系にはないプロフィールのフォームタイプが存在し、それらが設定されていると正しくコンバートされない。

例)
text,textlong

■環境
PC / win7 Firefox14 / OpenPNE3.8.0

3190_2.patch 表示 (1.24 KB) pnetan  , 2013-05-27 18:26

関係しているリビジョン

リビジョン e7bb1545 (差分)
Yuya Watanabeほぼ11年前に追加

fixed upgrade strategy to convert form_type correctly (fixes #3190)

履歴

#1 Yuya Watanabe11年以上前に更新

  • 説明 を更新 (diff)

#2 ichikawa tatsuya11年以上前に更新

2系でフォームタイプがtext及びtextlongのものをtextareaに変更するよう修正しました。
https://github.com/ichikawatatsuya/OpenPNE3/commit/4e63aff39207518daa8df62f5cda118f4ded5162

diff --git data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
index a3eaa83..82e0934 100644
--- data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
+++ data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
@@ -72,6 +72,11 @@ class opUpgradeFrom2MemberProfileStrategy extends opUpgradeAbstractStrategy
           break;
       }

+      if ('text' === $profile['form_type'] || 'textlong' === $profile['form_type'])
+      {
+        $profile['form_type'] = 'textarea';
+      }
+
       $this->conn->execute('INSERT INTO profile (id, name, is_required, is_unique, is_edit_public_flag, default_public_flag, form_type, value_type, is_disp_regist, is_disp_config, is_disp_search, value_regexp, value_min, value_max, sort_order, created_at, updated_at) VALUES (?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())', array(
         $profile['c_profile_id'] , $profile['name']     , $profile['is_required'] , $profile['public_flag_edit'] , $publicFlagDefault ,
         $profile['form_type']    , $profile['val_type'] , $profile['disp_regist'] , $profile['disp_config']      , $profile['disp_search']         ,

#3 ichikawa tatsuya11年以上前に更新

  • ステータスNew(新規) から Accepted(着手) に変更

#4 ichikawa tatsuya11年以上前に更新

  • ステータスAccepted(着手) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

#5 ichikawa tatsuya11年以上前に更新

  • 担当者Eitarow Fukamachi にセット

#6 Yuya Watanabeほぼ11年前に更新

  • 担当者Eitarow Fukamachi から ichikawa tatsuya に変更

担当が間違っているようなので変更します.

#7 Chiharu Nakajimaほぼ11年前に更新

  • 対象バージョンOpenPNE 3.6.x から OpenPNE 3.6.10 に変更

#8 Chiharu Nakajimaほぼ11年前に更新

  • 3.8 で発生するかYes (はい) から No (いいえ) に変更

#9 Yuya Watanabeほぼ11年前に更新

  • ステータスPending Review(レビュー待ち) から Rejected(差し戻し) に変更

2.14 でのフォームタイプ

管理画面での表記
text テキスト
textlong テキスト(長)
textarea テキスト(複数行)
select 単一選択(プルダウン)
radio 単一選択(ラジオボタン)
checkbox 複数選択(チェックボックス)

3.6 でのフォームタイプ

管理画面での表記
input テキスト
textarea テキスト(複数行)
select 単一選択(プルダウン)
radio 単一選択(ラジオボタン)
checkbox 複数選択(チェックボックス)
date 日付

2.14 と 3.6 の差異

2.14 の値 3.6 の値 管理画面での表記
text input テキスト
textlong テキスト(長)

管理画面での表記との対応を見る限りだと修正した内容は正しくないようですが,大丈夫でしょうか?
確認のため差し戻します.

#10 pnetan  ほぼ11年前に更新

2系で「text」のものを「input」へ、「textlong]のものを「textarea」に変更しました。

diff --git data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
index d76268e..a3eaa83 100644
--- data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
+++ data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
@@ -72,15 +72,6 @@ class opUpgradeFrom2MemberProfileStrategy extends opUpgradeAbstractStrategy
           break;
       }

+      if ('text' === $profile['form_type'])
+      {
+        $profile['form_type'] = 'input';
+      }
+      elseif ('textlong' === $profile['form_type'])
+      {
+        $profile['form_type'] = 'textarea';
+      }
+
       $this->conn->execute('INSERT INTO profile (id, name, is_required, is_unique, is_edit_public_flag, default_public_flag, form_type, value_type, is_disp_regist, is_disp_config, is_disp_search, value_regexp, value_min, value_max, sort_order, created_at, updated_at) VALUES (?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())', array(
         $profile['c_profile_id'] , $profile['name']     , $profile['is_required'] , $profile['public_flag_edit'] , $publicFlagDefault ,
         $profile['form_type']    , $profile['val_type'] , $profile['disp_regist'] , $profile['disp_config']      , $profile['disp_search']         ,

#11 pnetan  ほぼ11年前に更新

ファイルを添付するの忘れてました

#12 ichikawa tatsuyaほぼ11年前に更新

  • ステータスRejected(差し戻し) から Accepted(着手) に変更
  • 進捗率50 から 0 に変更

#13 ichikawa tatsuyaほぼ11年前に更新

  • ステータスAccepted(着手) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

#14 Yuya Watanabeほぼ11年前に更新

パッチ適用時に失敗するようです.

$ wget https://redmine.openpne.jp/attachments/download/472/3190_2.patch 
$ patch -p0 --dry-run < 3190_2.patch
patching file data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
patch: **** malformed patch at line 12: +      }

#15 Yuya Watanabeほぼ11年前に更新

正しいパッチは下記の通りです.

diff --git data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
index d76268e..a3eaa83 100644
--- data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
+++ data/upgrade/2/opUpgradeFrom2MemberProfileStrategy.class.php
@@ -72,6 +72,15 @@ class opUpgradeFrom2MemberProfileStrategy extends opUpgradeAbstractStrategy
           break;
       }

+      if ('text' === $profile['form_type'])
+      {
+        $profile['form_type'] = 'input';
+      }
+      elseif ('textlong' === $profile['form_type'])
+      {
+        $profile['form_type'] = 'textarea';
+      }
+
       $this->conn->execute('INSERT INTO profile (id, name, is_required, is_unique, is_edit_public_flag, default_public_flag, form_type, value_type, is_disp_regist, is_disp_config, is_disp_search, value_regexp, value_min, value_max, sort_order, created_at, updated_at) VALUES (?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())', array(
         $profile['c_profile_id'] , $profile['name']     , $profile['is_required'] , $profile['public_flag_edit'] , $publicFlagDefault ,
         $profile['form_type']    , $profile['val_type'] , $profile['disp_regist'] , $profile['disp_config']      , $profile['disp_search']         ,

パッチファイルの差分. 3190_2.patch が修正したもの.3190_2.patch.1 が添付ファイル.

$ diff 3190_2.patch 3190_2.patch.1
5c5
< @@ -72,6 +72,15 @@ class opUpgradeFrom2MemberProfileStrategy extends opUpgradeAbstractStrategy
---
> @@ -72,15 +72,6 @@ class opUpgradeFrom2MemberProfileStrategy extends opUpgradeAbstractStrategy

#16 Yuya Watanabeほぼ11年前に更新

更新履歴 e7bb1545032e65658633951a5830b76917a18c4a で適用されました。

#17 Yuya Watanabeほぼ11年前に更新

  • ステータスPending Review(レビュー待ち) から Pending Testing(テスト待ち) に変更
  • 進捗率50 から 70 に変更

#18 Chiharu Nakajimaほぼ11年前に更新

  • ステータスPending Testing(テスト待ち) から Fixed(完了) に変更
  • 進捗率70 から 100 に変更

テスト完了しました。問題ありません。

他の形式にエクスポート: Atom PDF