Project

General

Profile

Bug(バグ) #3190

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

Added by 悠 對木 almost 7 years ago. Updated over 3 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Target version:
Start date:
2012-08-30
Due date:
% Done:

100%

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

Description

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

例)
text,textlong

■環境
PC / win7 Firefox14 / OpenPNE3.8.0

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

Associated revisions

Revision e7bb1545 (diff)
Added by Yuya Watanabe about 6 years ago

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

History

#1 Updated by Yuya Watanabe almost 7 years ago

  • Description updated (diff)

#2 Updated by ichikawa tatsuya over 6 years ago

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 Updated by ichikawa tatsuya over 6 years ago

  • Status changed from New(新規) to Accepted(着手)

#4 Updated by ichikawa tatsuya over 6 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

#5 Updated by ichikawa tatsuya over 6 years ago

  • Assignee set to Eitarow Fukamachi

#6 Updated by Yuya Watanabe about 6 years ago

  • Assignee changed from Eitarow Fukamachi to ichikawa tatsuya

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

#7 Updated by Chiharu Nakajima about 6 years ago

  • Target version changed from OpenPNE 3.6.x to OpenPNE 3.6.10

#8 Updated by Chiharu Nakajima about 6 years ago

  • 3.8 で発生するか changed from Yes (はい) to No (いいえ)

#9 Updated by Yuya Watanabe about 6 years ago

  • Status changed from Pending Review(レビュー待ち) to 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 Updated by pnetan   about 6 years ago

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 Updated by pnetan   about 6 years ago

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

#12 Updated by ichikawa tatsuya about 6 years ago

  • Status changed from Rejected(差し戻し) to Accepted(着手)
  • % Done changed from 50 to 0

#13 Updated by ichikawa tatsuya about 6 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

#14 Updated by Yuya Watanabe about 6 years ago

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

$ 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 Updated by Yuya Watanabe about 6 years ago

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

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 Updated by Yuya Watanabe about 6 years ago

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

#17 Updated by Yuya Watanabe about 6 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

#18 Updated by Chiharu Nakajima about 6 years ago

  • Status changed from Pending Testing(テスト待ち) to Fixed(完了)
  • % Done changed from 70 to 100

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

Also available in: Atom PDF