// check OK
        if ($err->clear) {
            //登録
            if ($forms['id'] == '') {
                // set other_id = 0
                $values['other_id'] = '0';
                if ($id = $dao->add($values)) {
                    $forms['flag'] = $id;
                    $smarty->assign('message', '登録が完了しました。');
                } else {
                    $smarty->assign('message', '登録が失敗しました。');
                }
                // 更新
            } else {
                $values['other_id'] = $forms['other_id'];
                if ($dao->edit($forms['id'], $values)) {
                    $smarty->assign('message', '更新が完了しました。');
                } else {
                    $smarty->assign('message', '更新が失敗しました。');
                }
                $id = $forms['id'];
            }
            $phase = 'complete';
        } else {
            $phase = 'input';
        }
    }
}
if (isset($forms)) {
    $smarty->assign('forms', $forms);
}
         // add tantou data
         if ($tantou_dao->add0($tantou_val)) {
         } else {
             $executeflg = FALSE;
             break;
         }
     }
     // if auth = 2, then get account_id from session
     if ($auth == '2') {
         $account_id = $_SESSION['PREGO_ADMIN']['STAFF_SEQ'];
     }
     // update account other_id
     $account_values = array();
     $account_values['other_id'] = $id;
     $smarty->assign('corporate_id', $id);
     if ($account_dao->edit($account_id, $account_values)) {
     } else {
         $executeflg = FALSE;
         break;
     }
 } else {
     $executeflg = FALSE;
 }
 if ($executeflg) {
     $corporate_dao->commit_trans();
     // get login_id and login_pwd
     $account_sql = "select * from mp_account where other_id = '{$id}' ";
     $mail_account_data = $account_dao->get_rows($account_sql);
     foreach ($mail_account_data as $k => $v) {
         $mail_id = $v['login_id'];
         $mail_pwd = $v['login_pwd'];