Ignore:
Timestamp:
2010/01/07 12:02:22 (16 years ago)
Author:
Yammy
Message:

http://svn.ec-cube.net/open_trac/ticket/535
[アンケート管理]チェックボックスの回答に同じ回答を登録した場合に不具合となる場合がある

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_4-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php

    r17845 r18469  
    113113            } 
    114114 
     115            for( $i = 0; $i < count( $_POST["question"] ); $i++ ) { 
     116                if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) { 
     117                    $temp_data = array(); 
     118                    // 項目間(テキストボックス)があいていたら詰めていく 
     119                    for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 
     120                        if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" ); 
     121                    } 
     122                    $_POST["question"][$i]["option"] = $temp_data; 
     123                } else { 
     124                    $_POST["question"][$i]["option"] = NULL; 
     125                } 
     126            } 
     127 
    115128            $error = $this->lfErrCheck(); 
    116129 
     
    150163                //エラー表示 
    151164                $this->ERROR = $error; 
     165var_dump($this->ERROR); 
    152166                $this->QUESTION_ID = $_REQUEST['question_id']; 
    153167                $this->ERROR_COLOR = $this->lfGetErrColor($error, ERR_COLOR); 
     
    294308            if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) { 
    295309 
    296                 $temp_data = array(); 
    297310                for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 
    298  
    299                     // 項目間(テキストボックス)があいていたら詰めていく 
    300                     if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" ); 
    301  
    302                 } 
    303  
    304                 $_POST["question"][$i]["option"] = $temp_data; 
     311                    // 同じ回答がないかチェック 
     312                    if (strlen($_POST["question"][$i]["option"][$j]) > 0) { 
     313                        $checkArray = $_POST["question"][$i]["option"]; 
     314                        // 自身の値をunset 
     315                        unset($checkArray[$j]); 
     316                        if (in_array($_POST["question"][$i]["option"][$j], $checkArray)) { 
     317                            $objErr->arrErr["question"][$i]["option"][$j] = "同じ質問に同じ回答は設定出来ません。"; 
     318                        } 
     319                    } 
     320                } 
    305321 
    306322                if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0 
    307323                                                                                 && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "下記の2つ以上の項目に記入してください。"; 
     324 
    308325            } 
    309326        } 
Note: See TracChangeset for help on using the changeset viewer.