function updateClientData($intRclId, $arrClientData) { backupRankClientData($intRclId); foreach ($arrClientData as $field_rank_client => $value_rank_client) { $_POST[$field_rank_client] = $value_rank_client; } //End foreach $_POST[rcl_id] = $intRclId; print DataJasUpdateString('rank_client') . "<br /><br />"; DataJasUpdate('rank_client'); # exit; }
$_POST['rcm_tel'] = $_POST['mobile']; } //End if //メールアドレス if ($_POST['email']) { $_POST['rcm_mail'] = $_POST['email']; } #$_POST['rcm_contactid'] = $this->id; require 'cin/defalut.php'; if ($_POST[record] == false || $rsCountRcm === 0) { #$_POST[record]がないときは INSERT $sqlRcl = " SELECT * FROM rank_client "; $sqlRcl .= " WHERE TRUE "; $sqlRcl .= " AND rcl_accountid = {$_POST[account_id]} "; #print $sqlRcl . "<br />"; $rsRcl = mysql_db_query($dbName, $sqlRcl); $rowRcl = mysql_fetch_array($rsRcl); unset($_POST[rcm_id]); $_POST['rcm_client_id'] = $rowRcl['rcl_id']; $_POST['rcm_make_datetime'] = date('Y-m-d H:i:s'); #データ作成日付 #print DataJasInsertString('rank_charger_mas') . "<br />"; #exit; DataJasInsert('rank_charger_mas'); } else { $_POST[rcm_id] = $rowRcm[rcm_id]; #print "update : " . DataJasUpdateString('rank_charger_mas') . "<br />"; #exit; DataJasUpdate('rank_charger_mas'); } //End if
function jas_products_save($productid, $salesorderflag) { $arrrUrlStrict = array("part" => "0", "部分一致(下層ページも課金対象)" => "0", "domain" => "1", "ドメイン一致" => "1", "perfect" => "2", "完全一致" => "2", "文字のマッチ" => "3", "文字マッチ" => "3", "character" => "3"); $queryItem = " SELECT * FROM `vtiger_products` "; $queryItem .= " LEFT JOIN `vtiger_account` ON `seo_agency_customers` = `accountid`"; $queryItem .= " WHERE TRUE "; $queryItem .= " AND productid = {$productid} "; $queryItem .= " AND productcategory = 'SEO' "; print $queryItem . "<br /><br />"; global $adb; $resultItem = $adb->pquery($queryItem); $countItemNum = $adb->num_rows($resultItem); $rowItem = $adb->fetch_array($resultItem); #if($countItemNum === 0) return false; #print "コメントあうとしてね<br /><br />"; if (is_null($rowItem[seo_keyword]) || is_null($rowItem[seo_url])) { return false; } #キーワード、URLどちらかが空で合った場合、登録・変更しない //KwIDの取得(基幹) $arrKeywordInfo['rkw_id'] = (int) $rowItem['seo_kwid']; #Kwid /** ▼ JASへの代理店顧客情報保存準備 ****/ if ((int) $rowItem['seo_agency_customers'] !== 0) { #代理店顧客があるとき if ($rowItem['jgid'] == false) { //JASに代理店顧客情報がないので登録する $_POST['agencyflag'] = true; $arrKeywordInfo['rkw_child_cliid'] = jas_account_save($rowItem['accountid']); $arrKeywordInfo['rkw_child_client'] = $rowItem['accountname']; } else { $arrKeywordInfo['rkw_child_cliid'] = $rowItem['jgid']; $arrKeywordInfo['rkw_child_client'] = $rowItem['accountname']; } //End if } else { #代理店顧客がないとき $arrKeywordInfo['rkw_child_cliid'] = 0; $arrKeywordInfo['rkw_child_client'] = ""; } //End if /** ▲ JASへの代理店顧客情報保存準備 ****/ #rkw_word キーワード名 $arrKeywordInfo['rkw_word'] = $rowItem['seo_keyword']; #rkw_url $arrKeywordInfo['rkw_url'] = $rowItem['seo_url']; #$arrKeywordInfo['rkw_resistdate'] = date('Y-m-d'); #rkw_contract_startdate 契約期間開始日 $arrKeywordInfo['rkw_contract_startdate'] = $rowItem['start_date']; #rkw_contract_enddate 契約期間終了日 $arrKeywordInfo['rkw_contract_enddate'] = $rowItem['expiry_date']; #rkw_url_strict 順位チェック方法 $arrKeywordInfo['rkw_url_strict'] = $arrrUrlStrict[$rowItem['seo_rank_check']]; #rkw_away_flag 解約処理 if ((int) $rowItem['seo_away_flag'] === 1) { #有効がいいえのとき $arrKeywordInfo['rkw_away_flag'] = 1; #JASの解約フラグをたてる } else { #それ以外(有効がはいのとき) $arrKeywordInfo['rkw_away_flag'] = 0; #JASの解約フラグを解除する } //End if #rkw_fee_month 月額固定金額 $arrKeywordInfo['rkw_fee_month'] = (int) preg_replace('@,@', '', $rowItem['unit_price']); print "KwId : " . $arrKeywordInfo['rkw_id'] . "<br />"; echo "<pre>"; var_dump($salesorderflag); var_dump($arrKeywordInfo); echo "</pre>"; /** ▼ JASへの反映 **/ if ($salesorderflag == true && $arrKeywordInfo['rkw_id'] === 0) { #JASにKWが登録されているとき /** ▼ JASのキーワードデータの追加 *****/ #rkw_input_flag キーワード内訳 $arrKeywordInfo['rkw_input_flag'] = 1; #rkw_segment セグメント $arrKeywordInfo['rkw_segment'] = 1; #rkw_random_flag ランダムフラグ デフォルト値:1 $arrKeywordInfo['rkw_random_flag'] = 1; $arrKeywordInfo['rkw_fee_status'] = '固定'; $arrKeywordInfo['rkw_account_type'] = 4; foreach ($arrKeywordInfo as $rkw_fields_name => $strKeywordData) { $_POST[$rkw_fields_name] = $strKeywordData; } //End foreach //キーワードIDの初期化 unset($_POST['rkw_id']); print "Insert : " . DataJasInsertString('rank_keyword') . "<br /><br />"; $_POST['rkw_id'] = DataJasInsert('rank_keyword'); $queryInsert = " UPDATE `vtiger_products` SET "; $queryInsert .= " seo_kwid = {$_POST['rkw_id']} "; $queryInsert .= " WHERE TRUE "; $queryInsert .= " AND productid = {$productid} "; print $queryInsert . "<br /><br />"; global $adb; $adb->pquery($queryInsert); /** ▲ JASのキーワードデータの追加 *****/ } elseif ($arrKeywordInfo['rkw_id'] === 0) { #キーワードIDが0のときはなにもしない return false; } elseif ($module === 'Products' || $module === 'Services') { #製品登録のみキーワードの更新をおこなう /** ▼ JASのキーワードデータの更新 ***/ /** ▼ 変更前キーワード情報の取得 ****/ # require('cin/SQLConnect.php'); require 'cin/SQLConnect_jas.php'; $sqlRkw = "SELECT * FROM rank_keyword WHERE TRUE AND rkw_id = {$arrKeywordInfo['rkw_id']} "; print $sqlRkw . "<br /><br />"; $rsRkw = mysql_db_query($dbName, $sqlRkw); $rsCountRkw = mysql_num_rows($rsRkw); $rowRkw = mysql_fetch_array($rsRkw); $arrRkw = $rowRkw; if ((int) $rowRkw['rkw_account_type'] !== 4) { return false; } require 'cin/SQLClose.php'; /** ▲ 変更前キーワード情報の取得 ****/ /** ▼ ** キーワードの履歴を保存する ****/ foreach ($arrRkw as $rkw_fields_name => $strRkwValue) { unset($_POST[$rkw_fields_name]); $_POST[$rkw_fields_name] = $strRkwValue; } //End foreach $_POST[rkw_create_datetime] = date('Y-m-d H:i:s'); print "Insert : " . DataInsertString('backup_keyword') . "<br /><br />"; DataInsert('backup_keyword'); /** ▲ ** キーワードの履歴を保存する ****/ /** ▼ ** 変更後の反映 *********/ foreach ($arrKeywordInfo as $rkw_fields_name => $strKeywordData) { $_POST[$rkw_fields_name] = $strKeywordData; } //End foreach print "Update : " . DataJasUpdateString('rank_keyword') . "<br /><br />"; DataJasUpdate('rank_keyword'); /** ▲ ** 変更後の反映 **********/ /** ▲ JASのキーワードデータの更新 ***/ } //End if /** ▼ ** vitiger_crmentityへの契約期間を説明に反映 ***/ $queryUpdate = " UPDATE `vtiger_crmentity` SET "; $queryUpdate .= " description = CONCAT("; $queryUpdate .= " description, ' 契約期間:" . $arrKeywordInfo['rkw_contract_startdate'] . "~" . $arrKeywordInfo['rkw_contract_enddate'] . "' "; $queryUpdate .= " ) "; $queryUpdate .= " WHERE TRUE "; $queryUpdate .= " AND crmid = {$productid} "; print $queryUpdate . "<br /><br />"; global $adb; $adb->pquery($queryUpdate); /** ▲ ** vtiger_crmentityへの契約期間を説明の反映 ***/ registDomain($_POST[rkw_id]); return (int) $_POST[rkw_id]; }
$prefix = "E"; } if ($_POST[rcl_agencyflag] == "2") { $prefix = "A"; } $username = $prefix . "-" . substr(DateNow(0), 2, 2) . substr(0, 5, 2) . "-" . substr("00000" . $row[rcl_id], -5); $pass = randPass(6); require 'cin/SQLConnect_jas.php'; #$sql = "UPDATE `rank_client` SET `rcl_username` = '" . $username . "', `rcl_password` = '" . $pass . "' WHERE (`rcl_name` = '" . $_POST[rcl_name] ."');"; $sql = "UPDATE `rank_client` SET `rcl_username` = '" . $username . "', `rcl_password` = '" . $pass . "' WHERE (`rcl_id` = '" . $_POST[rcl_id] . "');"; #15-02-13変更 print $sql . "<BR><BR>"; $c_hit = mysql_db_query($dbName, $sql) or die('UPDATE error: ' . mysql_errno() . ', ' . mysql_error()); mysql_close($GLOBALS[dbHandle]); //==================================================================== # }//End if } else { #$_POST[record]があるときUPDATEする require 'cin/SQLConnect_jas.php'; $sql = " SELECT rcl_id FROM `rank_client` "; $sql .= " WHERE TRUE "; $sql .= " AND rcl_accountid = {$_POST[record]} "; # print $sql . "<br />"; $rsRcl = mysql_db_query($dbName, $sql); $rowRcl = mysql_fetch_array($rsRcl); $_POST[rcl_id] = $rowRcl[rcl_id]; require 'cin/SQLClose.php'; # print "update : " . DataJasUpdateString('rank_client') . "<br />"; DataJasUpdate('rank_client'); } //End if
function updateChargerMasData($intRcmId, $arrChargerMasData) { backupRankChargerData($intRcmId); foreach ($arrChargerMasData as $field_rank_charger_mas => $value_rank_charger_mas) { unset($_POST[$field_rank_charger_mas]); $_POST[$field_rank_charger_mas] = $value_rank_charger_mas; } //End foreach $_POST[rcm_id] = $intRcmId; print DataJasUpdateString('rank_charger_mas') . "<br /><br />"; DataJasUpdate('rank_charger_mas'); #exit; }