private function inputCommit(&$m, $ankenId) { $core =& $this->_core; // POSTから更新後のDataObject取得 $o =& $m->Anken_Edit_getObject($_POST); if ($o == null) { throw new RequestParamsException(); } // 変更前のDataObjectを取得 $name = "old_anken_{$ankenId}"; $old =& $core->getSession($name); if ($old == null) { throw new RequestParamsException(); } // 変更権限がない項目を元に戻す $o =& AuthManager::rollbackUnauthColumnForAnkenData($core, $o, $old); ///////////////////////////////// // 入力確認 ///////////////////////////////// $check =& $o->getChecker(); $check->checkAll(); if ($check->getErrorCount() == 0) { ///////////////////////////////// // キャンペーンコードをチェック ///////////////////////////////// // 更新前キャンペーンコード $code_old = $old->getField('campaign_code')->getValue(); // 更新後キャンペーンコード $code_new = $o->getField('campaign_code')->getValue(); // 変更有りの場合、重複数を数える $count = 0; if ($code_old !== $code_new) { $count = $m->getCountCampaignCode($code_new); } // 重複数なしで更新実行 if ($count == 0) { ////////////////////////////// // セッション保存 ////////////////////////////// $name = "new_anken_{$ankenId}"; $core->setSession($name, $o); ////////////////////////////// // 確認ページへ移動 ////////////////////////////// $core->movePage("edit_conf.php?aid={$ankenId}"); } else { ////////////////////////////// // エラー表示 ////////////////////////////// $this->_dataFrom['error_title'] = 'キャンペーンコード'; $this->_dataFrom['error'] = '入力されたキャンペーンコードは既に使われています。'; $m->setFormInputData($o); } } else { ////////////////////////////// // エラー表示 ////////////////////////////// $this->_dataFrom['error_title'] = '入力が間違っています。'; $this->_dataFrom['error'] = $check->getErrorMessage(); $m->setFormInputData($o); } }
private function inputCommit(&$m, $ankenId) { $core =& $this->_core; // POSTデータからオブジェクトを取得 $o =& $m->Anken_Edit_getObject($_POST); $old =& $core->getSession('old_anken'); // 変更権限がない項目を元に戻す $o =& AuthManager::rollbackUnauthColumnForAnkenData($core, $o, $old); // 入力確認 $check =& $o->getChecker(); $check->checkAll(); if ($check->getErrorCount() == 0) { ///////////////////////////////// // キャンペーンコードをチェック ///////////////////////////////// // 更新前キャンペーンコード $code_old = $old->getField('campaign_code')->getValue(); // 更新後キャンペーンコード $code_new = $o->getField('campaign_code')->getValue(); // 変更有りの場合、重複数を数える $count = 0; if ($code_old !== $code_new) { $count = $m->getCountCampaignCode($code_new); } // 重複数なしで更新実行 if ($count == 0) { // 新しい案件情報をセッションに保存 $core->setSession('new_anken', $o); // 確認ページへ移動 $core->movePage('edit_conf.php?aid=' . $ankenId); } else { // エラー表示 $this->_dataFrom['error_title'] = 'キャンペーンコード'; $this->_dataFrom['error'] = '入力されたキャンペーンコードは既に使われています。'; $m->setFormInputData($o); } } else { // エラー表示 $this->_dataFrom['error_title'] = '入力が間違っています。'; $this->_dataFrom['error'] = $check->getErrorMessage(); $m->setFormInputData($o); } }