| 1 |
<?php |
| 2 |
// Utility.php |
| 3 |
|
| 4 |
function usces_upgrade_07(){ |
| 5 |
$upgrade = (int)get_option('usces_upgrade'); |
| 6 |
if( $upgrade & USCES_UP07 ) return false; |
| 7 |
|
| 8 |
global $wpdb; |
| 9 |
$rets = array(); |
| 10 |
|
| 11 |
$tableName = $wpdb->prefix . "postmeta"; |
| 12 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'iopt_', '_iopt_') WHERE meta_key LIKE 'iopt_%'"; |
| 13 |
if( $wpdb->query( $mquery ) ) |
| 14 |
$rets[] = 1; |
| 15 |
|
| 16 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'isku_', '_isku_') WHERE meta_key LIKE 'isku_%'"; |
| 17 |
if( $wpdb->query( $mquery ) ) |
| 18 |
$rets[] = 1; |
| 19 |
|
| 20 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemCode', '_itemCode') WHERE meta_key LIKE 'itemCode'"; |
| 21 |
if( $wpdb->query( $mquery ) ) |
| 22 |
$rets[] = 1; |
| 23 |
|
| 24 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemName', '_itemName') WHERE meta_key LIKE 'itemName'"; |
| 25 |
if( $wpdb->query( $mquery ) ) |
| 26 |
$rets[] = 1; |
| 27 |
|
| 28 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemRestriction', '_itemRestriction') WHERE meta_key LIKE 'itemRestriction'"; |
| 29 |
if( $wpdb->query( $mquery ) ) |
| 30 |
$rets[] = 1; |
| 31 |
|
| 32 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemPointrate', '_itemPointrate') WHERE meta_key LIKE 'itemPointrate'"; |
| 33 |
if( $wpdb->query( $mquery ) ) |
| 34 |
$rets[] = 1; |
| 35 |
|
| 36 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpNum1', '_itemGpNum1') WHERE meta_key LIKE 'itemGpNum1'"; |
| 37 |
if( $wpdb->query( $mquery ) ) |
| 38 |
$rets[] = 1; |
| 39 |
|
| 40 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpDis1', '_itemGpDis1') WHERE meta_key LIKE 'itemGpDis1'"; |
| 41 |
if( $wpdb->query( $mquery ) ) |
| 42 |
$rets[] = 1; |
| 43 |
|
| 44 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpNum2', '_itemGpNum2') WHERE meta_key LIKE 'itemGpNum2'"; |
| 45 |
if( $wpdb->query( $mquery ) ) |
| 46 |
$rets[] = 1; |
| 47 |
|
| 48 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpDis2', '_itemGpDis2') WHERE meta_key LIKE 'itemGpDis2'"; |
| 49 |
if( $wpdb->query( $mquery ) ) |
| 50 |
$rets[] = 1; |
| 51 |
|
| 52 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpDis3', '_itemGpDis3') WHERE meta_key LIKE 'itemGpDis3'"; |
| 53 |
if( $wpdb->query( $mquery ) ) |
| 54 |
$rets[] = 1; |
| 55 |
|
| 56 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemGpNum3', '_itemGpNum3') WHERE meta_key LIKE 'itemGpNum3'"; |
| 57 |
if( $wpdb->query( $mquery ) ) |
| 58 |
$rets[] = 1; |
| 59 |
|
| 60 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemShipping', '_itemShipping') WHERE meta_key LIKE 'itemShipping'"; |
| 61 |
if( $wpdb->query( $mquery ) ) |
| 62 |
$rets[] = 1; |
| 63 |
|
| 64 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemDeliveryMethod', '_itemDeliveryMethod') WHERE meta_key LIKE 'itemDeliveryMethod'"; |
| 65 |
if( $wpdb->query( $mquery ) ) |
| 66 |
$rets[] = 1; |
| 67 |
|
| 68 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemShippingCharge', '_itemShippingCharge') WHERE meta_key LIKE 'itemShippingCharge'"; |
| 69 |
if( $wpdb->query( $mquery ) ) |
| 70 |
$rets[] = 1; |
| 71 |
|
| 72 |
$mquery = "UPDATE $tableName SET meta_key = REPLACE(meta_key, 'itemIndividualSCharge', '_itemIndividualSCharge') WHERE meta_key LIKE 'itemIndividualSCharge'"; |
| 73 |
if( $wpdb->query( $mquery ) ) |
| 74 |
$rets[] = 1; |
| 75 |
|
| 76 |
usces_log('USCES_UP07 : '.print_r($rets,true), 'database_error.log'); |
| 77 |
$upgrade += USCES_UP07; |
| 78 |
update_option('usces_upgrade', $upgrade); |
| 79 |
return $rets; |
| 80 |
} |
| 81 |
|
| 82 |
function usces_upgrade_11(){ |
| 83 |
$options = get_option('usces'); |
| 84 |
$upgrade = (int)get_option('usces_upgrade'); |
| 85 |
|
| 86 |
if( $upgrade & USCES_UP11 ) return false; |
| 87 |
|
| 88 |
global $wpdb; |
| 89 |
$rets = array(); |
| 90 |
|
| 91 |
/* ITEM SKU DATA */ |
| 92 |
$sort = (int)$options['system']['orderby_itemsku']; |
| 93 |
if( $sort ){ |
| 94 |
$query = "SELECT * FROM $wpdb->postmeta WHERE meta_key <> '_isku_' AND meta_key LIKE '_isku_%' ORDER BY post_id, meta_key"; |
| 95 |
}else{ |
| 96 |
$query = "SELECT * FROM $wpdb->postmeta WHERE meta_key <> '_isku_' AND meta_key LIKE '_isku_%' ORDER BY post_id, meta_id"; |
| 97 |
} |
| 98 |
$res = $wpdb->get_results($query, ARRAY_A); |
| 99 |
|
| 100 |
$conclusion = true; |
| 101 |
$pre_post_id = 0; |
| 102 |
$sort_id = 0; |
| 103 |
$check_code = array(); |
| 104 |
$dep_num = array(); |
| 105 |
foreach( (array)$res as $metarow ){ |
| 106 |
$meta_value = unserialize($metarow['meta_value']); |
| 107 |
$newvalue = array(); |
| 108 |
$newvalue['code'] = substr($metarow['meta_key'], 6); |
| 109 |
if( $pre_post_id == $metarow['post_id'] ){ |
| 110 |
if( in_array( $newvalue['code'], $check_code ) ){ |
| 111 |
$newvalue['code'] .= 'dupricate_' . (int)$dep_num[$newvalue['code']]; |
| 112 |
$dep_num[$newvalue['code']]++; |
| 113 |
} |
| 114 |
}else{ |
| 115 |
$check_code = array(); |
| 116 |
$dep_num = array(); |
| 117 |
$sort_id = 0; |
| 118 |
} |
| 119 |
foreach( (array)$meta_value as $k => $v ){ |
| 120 |
switch ( $k ){ |
| 121 |
case 'disp': |
| 122 |
$newvalue['name'] = $v; |
| 123 |
break; |
| 124 |
case 'cprice': |
| 125 |
$newvalue['cprice'] = $v; |
| 126 |
break; |
| 127 |
case 'price': |
| 128 |
$newvalue['price'] = $v; |
| 129 |
break; |
| 130 |
case 'unit': |
| 131 |
$newvalue['unit'] = $v; |
| 132 |
break; |
| 133 |
case 'zaikonum': |
| 134 |
$newvalue['stocknum'] = $v; |
| 135 |
break; |
| 136 |
case 'zaiko': |
| 137 |
$newvalue['stock'] = $v; |
| 138 |
break; |
| 139 |
case 'gptekiyo': |
| 140 |
$newvalue['gp'] = $v; |
| 141 |
break; |
| 142 |
case 'charging_type': |
| 143 |
break; |
| 144 |
default: |
| 145 |
$newvalue[$k] = $v; |
| 146 |
} |
| 147 |
} |
| 148 |
$newvalue['sort'] = $sort_id; |
| 149 |
|
| 150 |
$id = usces_add_sku($metarow['post_id'], $newvalue, false); |
| 151 |
$pre_post_id = $metarow['post_id']; |
| 152 |
$check_code[] = $newvalue['code']; |
| 153 |
$sort_id++; |
| 154 |
|
| 155 |
$res_key = $metarow['post_id'] . '_' . $newvalue['code']; |
| 156 |
if( $id ) { |
| 157 |
delete_post_meta($metarow['post_id'], $metarow['meta_key']); |
| 158 |
$rets['sku'][$res_key] = 1; |
| 159 |
}else{ |
| 160 |
$rets['sku'][$res_key] = 0; |
| 161 |
usces_log('meta_id ' . $metarow['meta_id'] . ' : ' . __('This SKU-data has not been rebuilt.', 'usces'), 'database_error.log'); |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
/* ITEM OPTION DATA */ |
| 166 |
$sort = (int)$options['system']['orderby_itemopt']; |
| 167 |
if( $sort ){ |
| 168 |
$query = "SELECT * FROM $wpdb->postmeta WHERE meta_key <> '_iopt_' AND meta_key LIKE '_iopt_%' ORDER BY post_id, meta_key"; |
| 169 |
}else{ |
| 170 |
$query = "SELECT * FROM $wpdb->postmeta WHERE meta_key <> '_iopt_' AND meta_key LIKE '_iopt_%' ORDER BY post_id, meta_id"; |
| 171 |
} |
| 172 |
$res = $wpdb->get_results($query, ARRAY_A); |
| 173 |
|
| 174 |
$conclusion = true; |
| 175 |
$pre_post_id = 0; |
| 176 |
$sort_id = 0; |
| 177 |
$check_code = array(); |
| 178 |
$dep_num = array(); |
| 179 |
foreach( (array)$res as $metarow ){ |
| 180 |
$meta_value = unserialize($metarow['meta_value']); |
| 181 |
$newvalue = array(); |
| 182 |
$newvalue['name'] = substr($metarow['meta_key'], 6); |
| 183 |
if( $pre_post_id == $metarow['post_id'] ){ |
| 184 |
if( in_array( $newvalue['name'], $check_code ) ){ |
| 185 |
$newvalue['name'] .= 'dupricate_' . (int)$dep_num[$newvalue['name']]; |
| 186 |
$dep_num[$newvalue['name']]++; |
| 187 |
} |
| 188 |
}else{ |
| 189 |
$check_code = array(); |
| 190 |
$dep_num = array(); |
| 191 |
$sort_id = 0; |
| 192 |
} |
| 193 |
foreach( (array)$meta_value as $k => $v ){ |
| 194 |
switch ( $k ){ |
| 195 |
case 'means': |
| 196 |
$newvalue['means'] = $v; |
| 197 |
break; |
| 198 |
case 'essential': |
| 199 |
$newvalue['essential'] = $v; |
| 200 |
break; |
| 201 |
case 'value': |
| 202 |
if( is_array($v) ){ |
| 203 |
$nov = ''; |
| 204 |
foreach((array)$v as $vs){ |
| 205 |
if( !WCUtils::is_blank($vs) ) |
| 206 |
//$nov .= str_replace('\\', '¥', trim( $vs )) . "\n"; |
| 207 |
$nov .= $vs . "\n"; |
| 208 |
} |
| 209 |
$newvalue['value'] = trim($nov); |
| 210 |
}else{ |
| 211 |
$newvalue['value'] = trim($v); |
| 212 |
} |
| 213 |
break; |
| 214 |
default: |
| 215 |
$newvalue[$k] = trim($v); |
| 216 |
} |
| 217 |
} |
| 218 |
$newvalue['sort'] = $sort_id; |
| 219 |
|
| 220 |
$id = usces_add_opt($metarow['post_id'], $newvalue, false); |
| 221 |
$pre_post_id = $metarow['post_id']; |
| 222 |
$check_code[] = $newvalue['name']; |
| 223 |
$sort_id++; |
| 224 |
|
| 225 |
$res_key = $metarow['post_id'] . '_' . $newvalue['name']; |
| 226 |
if( $id ) { |
| 227 |
delete_post_meta($metarow['post_id'], $metarow['meta_key']); |
| 228 |
$rets['opt'][$res_key] = 1; |
| 229 |
}else{ |
| 230 |
$rets['opt'][$res_key] = 0; |
| 231 |
usces_log('meta_id ' . $metarow['meta_id'] . ' : ' . __('This Item-Option-data has not been rebuilt.', 'usces'), 'database_error.log'); |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
/* PAYMENT METHOD DATA */ |
| 236 |
$payment = get_option('usces_payment_method'); |
| 237 |
//usces_log('payment : ' . print_r($payment,true), 'database_error.log'); |
| 238 |
if( empty($payment) ) { |
| 239 |
|
| 240 |
$options = get_option('usces'); |
| 241 |
$old_payment = isset($options['payment_method']) ? $options['payment_method'] : ''; |
| 242 |
usces_log('old_payment : ' . print_r($old_payment,true), 'database_error.log'); |
| 243 |
if( !empty($old_payment) && is_array($old_payment) ) { |
| 244 |
foreach( $old_payment as $key => $value ){ |
| 245 |
$res_key = $key . '_' . $value['name']; |
| 246 |
$id = usces_add_system_option( 'usces_payment_method', $value ); |
| 247 |
if( $id ) { |
| 248 |
$rets['payment'][$res_key] = 1; |
| 249 |
}else{ |
| 250 |
$rets['payment'][$res_key] = 0; |
| 251 |
usces_log('payment_method ' . $value['name'] . ' : ' . __('This Payment-Method-data has not been rebuilt.', 'usces'), 'database_error.log'); |
| 252 |
} |
| 253 |
} |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
usces_log('USCES_UP11 : ' . print_r($rets,true), 'database_error.log'); |
| 258 |
|
| 259 |
// $upgrade += USCES_UP11; |
| 260 |
// update_option('usces_upgrade', $upgrade); |
| 261 |
return $rets; |
| 262 |
} |
| 263 |
|
| 264 |
function usces_log($log, $file){ |
| 265 |
global $usces; |
| 266 |
|
| 267 |
$log = date('[Y-m-d H:i:s]', current_time('timestamp')) . "\t" . $log . "\n"; |
| 268 |
$file_path = USCES_PLUGIN_DIR . '/logs/' . $file; |
| 269 |
if( is_dir($file_path) ) |
| 270 |
return; |
| 271 |
|
| 272 |
$fp = fopen($file_path, 'a'); |
| 273 |
if( false !== $fp ){ |
| 274 |
fwrite($fp, $log); |
| 275 |
fclose($fp); |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
function usces_filter_delivery_secure_check( $mes ){ |
| 281 |
global $usces; |
| 282 |
$usces_secure_link = get_option('usces_secure_link'); |
| 283 |
$paymod_id = ''; |
| 284 |
$settlement = ''; |
| 285 |
$payments = usces_get_system_option( 'usces_payment_method', 'sort' ); |
| 286 |
|
| 287 |
foreach ( (array)$payments as $id => $value ) { |
| 288 |
if( isset($_POST['offer']['payment_name']) && $value['name'] == $_POST['offer']['payment_name']){ |
| 289 |
$settlement = $value['settlement']; |
| 290 |
break; |
| 291 |
} |
| 292 |
} |
| 293 |
switch( $settlement ){ |
| 294 |
case 'acting_zeus_card': |
| 295 |
$cnum1 = trim($_POST["cnum1"]); |
| 296 |
$securecode = (isset($_POST["securecode"])) ? trim($_POST["securecode"]) : ''; |
| 297 |
if ( !is_numeric($cnum1) ) |
| 298 |
$mes .= __('カード番号が不正です', 'usces') . "<br />"; |
| 299 |
|
| 300 |
if ( isset($_POST["securecode"]) && !is_numeric($securecode) ) |
| 301 |
$mes .= __('セキュリティコードが不正です', 'usces') . "<br />"; |
| 302 |
|
| 303 |
if ( WCUtils::is_blank($_POST["expyy"]) ) |
| 304 |
$mes .= __('カードの有効年を選択してください', 'usces') . "<br />"; |
| 305 |
|
| 306 |
if ( WCUtils::is_blank($_POST["expmm"]) ) |
| 307 |
$mes .= __('カードの有効月を選択してください', 'usces') . "<br />"; |
| 308 |
|
| 309 |
if ( WCUtils::is_blank($_POST["username"]) ) |
| 310 |
$mes .= __('カード名義を� |
| 311 |
�力してください', 'usces') . "<br />"; |
| 312 |
|
| 313 |
if ( isset($_POST["howpay"]) && 0 == $_POST["howpay"] && WCUtils::is_blank($_POST["cbrand"]) ) |
| 314 |
$mes .= __('カードブランドを選択してください', 'usces') . "<br />"; |
| 315 |
|
| 316 |
if ( 'zeus' != $_POST['acting'] ) |
| 317 |
$mes .= __('カード決済データが不正です!', 'usces'); |
| 318 |
|
| 319 |
break; |
| 320 |
} |
| 321 |
|
| 322 |
return $mes; |
| 323 |
} |
| 324 |
|
| 325 |
function usces_get_conv_name($code){ |
| 326 |
switch($code){ |
| 327 |
case 'D001': |
| 328 |
case '010'://20101018ysk |
| 329 |
$name = 'セブンイレブン'; |
| 330 |
break; |
| 331 |
case 'D002': |
| 332 |
case '020'://20101018ysk |
| 333 |
$name = 'ローソン'; |
| 334 |
break; |
| 335 |
case 'D015': |
| 336 |
case '760'://20101018ysk |
| 337 |
$name = 'セイコーマート'; |
| 338 |
break; |
| 339 |
case 'D405': |
| 340 |
$name = 'ペイジー'; |
| 341 |
break; |
| 342 |
case 'D003': |
| 343 |
$name = 'サンクス'; |
| 344 |
break; |
| 345 |
case 'D004': |
| 346 |
$name = 'サークルK'; |
| 347 |
break; |
| 348 |
case 'D005': |
| 349 |
case '080'://20101018ysk |
| 350 |
$name = 'ミニストップ'; |
| 351 |
break; |
| 352 |
case 'D010': |
| 353 |
$name = 'デイリーヤマザキ'; |
| 354 |
break; |
| 355 |
case 'D011': |
| 356 |
$name = 'ヤマザキデイリーストア'; |
| 357 |
break; |
| 358 |
case 'D030': |
| 359 |
case '030'://20101018ysk |
| 360 |
$name = 'ファミリーマート'; |
| 361 |
break; |
| 362 |
case 'D401': |
| 363 |
$name = 'CyberEdy'; |
| 364 |
break; |
| 365 |
case 'D404': |
| 366 |
$name = '楽天銀行'; |
| 367 |
break; |
| 368 |
case 'D406': |
| 369 |
$name = 'ジャパネット銀行'; |
| 370 |
break; |
| 371 |
case 'D451': |
| 372 |
$name = 'ウェブマネー'; |
| 373 |
break; |
| 374 |
case 'D452': |
| 375 |
$name = 'ビットキャッシュ'; |
| 376 |
break; |
| 377 |
case 'P901': |
| 378 |
$name = 'コンビニ払込票'; |
| 379 |
break; |
| 380 |
case 'P902': |
| 381 |
$name = 'コンビニ払込票(郵便振替対応)'; |
| 382 |
break; |
| 383 |
//20101018ysk start |
| 384 |
case '050': |
| 385 |
$name = 'デイリーヤマザキ・ヤマザキデイリーストア・タイムリー'; |
| 386 |
break; |
| 387 |
case '060': |
| 388 |
$name = 'サークルK・サンクス'; |
| 389 |
break; |
| 390 |
case '110': |
| 391 |
$name = 'am/pm'; |
| 392 |
break; |
| 393 |
//20101018ysk end |
| 394 |
default: |
| 395 |
$name = ''; |
| 396 |
} |
| 397 |
return $name; |
| 398 |
} |
| 399 |
|
| 400 |
function usces_get_remise_conv_return($code){ |
| 401 |
switch($code){ |
| 402 |
case 'D001': //セブンイレブン |
| 403 |
$html = '<tr><th>' . __('払込番号','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 404 |
$html .= '<tr><th>'.__('払込票のURL', 'usces').'</th><td><a href="'.esc_html($_REQUEST["X-PAY_NO2"]).'" target="_blank">'.esc_html($_REQUEST["X-PAY_NO2"])."</a></td></tr>\n"; |
| 405 |
break; |
| 406 |
case 'D002': //ローソン |
| 407 |
case 'D015': //セイコーマート |
| 408 |
case 'D405': //ペイジー |
| 409 |
$html = '<tr><th>' . __('受付番号','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 410 |
$html .= '<tr><th>'.__('支払方法案� |
| 411 |
URL', 'usces').'</th><td><a href="'.esc_html($_REQUEST["X-PAY_NO2"]).'" target="_blank">'.esc_html($_REQUEST["X-PAY_NO2"])."</a></td></tr>\n"; |
| 412 |
break; |
| 413 |
case 'D003': //サンクス |
| 414 |
case 'D004': //サークルK |
| 415 |
case 'D005': //ミニストップ |
| 416 |
case 'D010': //デイリーヤマザキ |
| 417 |
case 'D011': //ヤマザキデイリーストア |
| 418 |
$html = '<tr><th>' . __('決済番号','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 419 |
$html .= '<tr><th>'.__('支払方法案� |
| 420 |
URL', 'usces').'</th><td><a href="'.esc_html($_REQUEST["X-PAY_NO2"]).'" target="_blank">'.esc_html($_REQUEST["X-PAY_NO2"])."</a></td></tr>\n"; |
| 421 |
break; |
| 422 |
case 'D030': //ファミリーマート |
| 423 |
$html = '<tr><th>' . __('コード','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 424 |
$html .= '<tr><th>'.__('注文番号', 'usces').'</th><td>'.esc_html($_REQUEST["X-PAY_NO2"])."</td></tr>\n"; |
| 425 |
break; |
| 426 |
case 'D401': //CyberEdy |
| 427 |
case 'D404': //楽天銀行 |
| 428 |
case 'D406': //ジャパネット銀行 |
| 429 |
case 'D451': //ウェブマネー |
| 430 |
case 'D452': //ビットキャッシュ |
| 431 |
$html = '<tr><th>' . __('受付番号','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 432 |
$html .= '<tr><th>'.__('支払手続URL', 'usces').'</th><td><a href="'.esc_html($_REQUEST["X-PAY_NO2"]).'" target="_blank">'.esc_html($_REQUEST["X-PAY_NO2"])."</a></td></tr>\n"; |
| 433 |
break; |
| 434 |
case 'P901': //コンビニ払込票 |
| 435 |
case 'P902': //コンビニ払込票(郵便振替対応) |
| 436 |
$html = '<tr><th>' . __('受付番号','usces') . '</th><td>' . esc_html($_REQUEST["X-PAY_NO1"]) . "</td></tr>\n"; |
| 437 |
break; |
| 438 |
default: |
| 439 |
$html = ''; |
| 440 |
} |
| 441 |
return $html; |
| 442 |
} |
| 443 |
|
| 444 |
function usces_payment_detail($usces_entries){ |
| 445 |
$payments = usces_get_payments_by_name( $usces_entries['order']['payment_name'] ); |
| 446 |
$acting_flag = ( 'acting' == $payments['settlement'] ) ? $payments['module'] : $payments['settlement']; |
| 447 |
$str = ''; |
| 448 |
switch( $acting_flag ){ |
| 449 |
case 'paypal.php': |
| 450 |
break; |
| 451 |
|
| 452 |
case 'epsilon.php': |
| 453 |
break; |
| 454 |
|
| 455 |
case 'acting_zeus_card': |
| 456 |
if( !isset($_REQUEST['cbrand']) || (isset($_REQUEST['howpay']) && '1' === $_REQUEST['howpay']) ){ |
| 457 |
$str = ' 一括払い'; |
| 458 |
}else{ |
| 459 |
$div_name = 'div_' . $_REQUEST['cbrand']; |
| 460 |
switch($_REQUEST[$div_name]){ |
| 461 |
case '01': |
| 462 |
$str = ' 一括払い'; |
| 463 |
break; |
| 464 |
case '99': |
| 465 |
$str = ' 分割(リボ払い)'; |
| 466 |
break; |
| 467 |
case '03': |
| 468 |
$str = ' 分割(3回)'; |
| 469 |
break; |
| 470 |
case '05': |
| 471 |
$str = ' 分割(5回)'; |
| 472 |
break; |
| 473 |
case '06': |
| 474 |
$str = ' 分割(6回)'; |
| 475 |
break; |
| 476 |
case '10': |
| 477 |
$str = ' 分割(10回)'; |
| 478 |
break; |
| 479 |
case '12': |
| 480 |
$str = ' 分割(12回)'; |
| 481 |
break; |
| 482 |
case '15': |
| 483 |
$str = ' 分割(15回)'; |
| 484 |
break; |
| 485 |
case '18': |
| 486 |
$str = ' 分割(18回)'; |
| 487 |
break; |
| 488 |
case '20': |
| 489 |
$str = ' 分割(20回)'; |
| 490 |
break; |
| 491 |
case '24': |
| 492 |
$str = ' 分割(24回)'; |
| 493 |
break; |
| 494 |
} |
| 495 |
} |
| 496 |
break; |
| 497 |
|
| 498 |
case 'acting_zeus_bank': |
| 499 |
break; |
| 500 |
|
| 501 |
case 'acting_remise_card': |
| 502 |
if( isset( $_POST['div'] ) ){ |
| 503 |
switch($_POST['div']){ |
| 504 |
case '0': |
| 505 |
$str = ' 一括払い'; |
| 506 |
break; |
| 507 |
case '1': |
| 508 |
$str = ' 分割(2回)'; |
| 509 |
break; |
| 510 |
case '2': |
| 511 |
$str = ' 分割(リボ払い)'; |
| 512 |
break; |
| 513 |
} |
| 514 |
} |
| 515 |
break; |
| 516 |
|
| 517 |
case 'acting_remise_conv': |
| 518 |
break; |
| 519 |
} |
| 520 |
|
| 521 |
$str = apply_filters('usces_filter_payment_detail', $str, $usces_entries); |
| 522 |
return $str; |
| 523 |
} |
| 524 |
|
| 525 |
//20100818ysk start |
| 526 |
function usces_filter_delivery_check_custom_order( $mes ) { |
| 527 |
global $usces; |
| 528 |
|
| 529 |
$meta = usces_has_custom_field_meta('order'); |
| 530 |
foreach($meta as $key => $entry) { |
| 531 |
$essential = $entry['essential']; |
| 532 |
if($essential == 1) { |
| 533 |
$name = $entry['name']; |
| 534 |
$means = $entry['means']; |
| 535 |
if($means == 2) {//Text |
| 536 |
if( WCUtils::is_blank($_POST['custom_order'][$key]) ) |
| 537 |
$mes .= __($name.'を� |
| 538 |
�力してください。', 'usces')."<br />"; |
| 539 |
} else { |
| 540 |
if(!isset($_POST['custom_order'][$key]) or $_POST['custom_order'][$key] == "#NONE#") |
| 541 |
$mes .= __($name.'を選択してください。', 'usces')."<br />"; |
| 542 |
} |
| 543 |
} |
| 544 |
} |
| 545 |
|
| 546 |
return $mes; |
| 547 |
} |
| 548 |
|
| 549 |
function usces_filter_customer_check_custom_customer( $mes ) { |
| 550 |
global $usces; |
| 551 |
|
| 552 |
$meta = usces_has_custom_field_meta('customer'); |
| 553 |
foreach($meta as $key => $entry) { |
| 554 |
$essential = $entry['essential']; |
| 555 |
if($essential == 1) { |
| 556 |
$name = $entry['name']; |
| 557 |
$means = $entry['means']; |
| 558 |
if($means == 2) {//Text |
| 559 |
if( WCUtils::is_blank($_POST['custom_customer'][$key]) ) |
| 560 |
$mes .= __($name.'を� |
| 561 |
�力してください。', 'usces')."<br />"; |
| 562 |
} else { |
| 563 |
if(!isset($_POST['custom_customer'][$key]) or $_POST['custom_customer'][$key] == "#NONE#") |
| 564 |
$mes .= __($name.'を選択してください。', 'usces')."<br />"; |
| 565 |
} |
| 566 |
} |
| 567 |
} |
| 568 |
|
| 569 |
return $mes; |
| 570 |
} |
| 571 |
|
| 572 |
function usces_filter_delivery_check_custom_delivery( $mes ) { |
| 573 |
global $usces; |
| 574 |
|
| 575 |
if( isset($_POST['delivery']['delivery_flag']) && $_POST['delivery']['delivery_flag'] == '1' ) { |
| 576 |
$meta = usces_has_custom_field_meta('delivery'); |
| 577 |
foreach($meta as $key => $entry) { |
| 578 |
$essential = $entry['essential']; |
| 579 |
if($essential == 1) { |
| 580 |
$name = $entry['name']; |
| 581 |
$means = $entry['means']; |
| 582 |
if($means == 2) {//Text |
| 583 |
if( WCUtils::is_blank($_POST['custom_delivery'][$key]) ) |
| 584 |
$mes .= __($name.'を� |
| 585 |
�力してください。', 'usces')."<br />"; |
| 586 |
} else { |
| 587 |
if(!isset($_POST['custom_delivery'][$key]) or $_POST['custom_delivery'][$key] == "#NONE#") |
| 588 |
$mes .= __($name.'を選択してください。', 'usces')."<br />"; |
| 589 |
} |
| 590 |
} |
| 591 |
} |
| 592 |
} |
| 593 |
|
| 594 |
return $mes; |
| 595 |
} |
| 596 |
|
| 597 |
function usces_filter_member_check_custom_member( $mes ) { |
| 598 |
global $usces; |
| 599 |
|
| 600 |
unset($_SESSION['usces_member']['custom_member']); |
| 601 |
if(isset($_POST['custom_member'])) { |
| 602 |
foreach( $_POST['custom_member'] as $key => $value ) |
| 603 |
if( is_array($value) ) { |
| 604 |
foreach( $value as $k => $v ) |
| 605 |
$_SESSION['usces_member']['custom_member'][$key][trim($v)] = trim($v); |
| 606 |
} else { |
| 607 |
$_SESSION['usces_member']['custom_member'][$key] = trim($value); |
| 608 |
} |
| 609 |
} |
| 610 |
|
| 611 |
$meta = usces_has_custom_field_meta('member'); |
| 612 |
foreach($meta as $key => $entry) { |
| 613 |
$essential = $entry['essential']; |
| 614 |
if($essential == 1) { |
| 615 |
$name = $entry['name']; |
| 616 |
$means = $entry['means']; |
| 617 |
if($means == 2) {//Text |
| 618 |
if( WCUtils::is_blank($_POST['custom_member'][$key]) ) |
| 619 |
$mes .= __($name.'を� |
| 620 |
�力してください。', 'usces')."<br />"; |
| 621 |
} else { |
| 622 |
if(!isset($_POST['custom_member'][$key]) or $_POST['custom_member'][$key] == "#NONE#") |
| 623 |
$mes .= __($name.'を選択してください。', 'usces')."<br />"; |
| 624 |
} |
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
return $mes; |
| 629 |
} |
| 630 |
//20100818ysk end |
| 631 |
function usces_dashboard_setup() { |
| 632 |
wp_add_dashboard_widget( 'usces_db_widget' , 'Welcart Information' , 'usces_db_widget'); |
| 633 |
} |
| 634 |
|
| 635 |
function usces_admin_login_head() { |
| 636 |
?> |
| 637 |
<script type='text/javascript'> |
| 638 |
(function($) { |
| 639 |
usces = { |
| 640 |
settings: { |
| 641 |
url: 'http://www.welcart.com/varch/varch.php', |
| 642 |
type: 'POST', |
| 643 |
cache: false, |
| 644 |
success: function(data, dataType){ |
| 645 |
}, |
| 646 |
error: function(msg){ |
| 647 |
} |
| 648 |
}, |
| 649 |
varch : function() { |
| 650 |
var s = usces.settings; |
| 651 |
s.data = "action=varch_ajax&ID=usces_varch&ver=" + <?php echo $_SERVER['HTTP_HOST']; ?>; |
| 652 |
$.ajax( s ); |
| 653 |
return false; |
| 654 |
} |
| 655 |
}; |
| 656 |
usces.varch(); |
| 657 |
})(jQuery); |
| 658 |
</script> |
| 659 |
<?php |
| 660 |
} |
| 661 |
|
| 662 |
//20100908ysk start |
| 663 |
// member list download |
| 664 |
function usces_download_member_list() { |
| 665 |
require_once( USCES_PLUGIN_DIR . "/classes/dataList.class.php" ); |
| 666 |
global $wpdb, $usces; |
| 667 |
//20110411ysk start |
| 668 |
global $usces_settings; |
| 669 |
//20110411ysk end |
| 670 |
|
| 671 |
$ext = $_REQUEST['ftype']; |
| 672 |
/* if($ext == 'xls') {//HTML |
| 673 |
$table_h = "<table>"; |
| 674 |
$table_f = "</table>"; |
| 675 |
$tr_h = "<tr>"; |
| 676 |
$tr_f = "</tr>"; |
| 677 |
$th_h1 = "<th>"; |
| 678 |
$th_h = "<th>"; |
| 679 |
$th_f = "</th>"; |
| 680 |
$td_h1 = "<td>"; |
| 681 |
$td_h = "<td>"; |
| 682 |
$td_f = "</td>"; |
| 683 |
$lf = "\n"; |
| 684 |
*/ if($ext == 'xls') {//TSV |
| 685 |
$table_h = ""; |
| 686 |
$table_f = ""; |
| 687 |
$tr_h = ""; |
| 688 |
$tr_f = ""; |
| 689 |
$th_h1 = '"'; |
| 690 |
$th_h = "\t".'"'; |
| 691 |
$th_f = '"'; |
| 692 |
$td_h1 = '"'; |
| 693 |
$td_h = "\t".'"'; |
| 694 |
$td_f = '"'; |
| 695 |
$lf = "\n"; |
| 696 |
} elseif($ext == 'csv') {//CSV |
| 697 |
$table_h = ""; |
| 698 |
$table_f = ""; |
| 699 |
$tr_h = ""; |
| 700 |
$tr_f = ""; |
| 701 |
//20110201ysk start |
| 702 |
//$th_h1 = ""; |
| 703 |
$th_h1 = '"'; |
| 704 |
//$th_h = ","; |
| 705 |
$th_h = ',"'; |
| 706 |
//$th_f = ""; |
| 707 |
$th_f = '"'; |
| 708 |
//$td_h1 = ""; |
| 709 |
$td_h1 = '"'; |
| 710 |
//$td_h = ","; |
| 711 |
$td_h = ',"'; |
| 712 |
//$td_f = ""; |
| 713 |
$td_f = '"'; |
| 714 |
//20110201ysk end |
| 715 |
$lf = "\n"; |
| 716 |
} else { |
| 717 |
exit(); |
| 718 |
} |
| 719 |
$csmb_meta = usces_has_custom_field_meta('member'); |
| 720 |
//20110411ysk start |
| 721 |
$applyform = usces_get_apply_addressform($usces->options['system']['addressform']); |
| 722 |
//20110411ysk end |
| 723 |
|
| 724 |
//========================================================================== |
| 725 |
$usces_opt_member = get_option('usces_opt_member'); |
| 726 |
if(!is_array($usces_opt_member)){ |
| 727 |
$usces_opt_member = array(); |
| 728 |
} |
| 729 |
$usces_opt_member['ftype_mem'] = $ext; |
| 730 |
$chk_mem = array(); |
| 731 |
$chk_mem['ID'] = 1; |
| 732 |
$chk_mem['email'] = (isset($_REQUEST['check']['email'])) ? 1 : 0; |
| 733 |
if(!empty($csmb_meta)) { |
| 734 |
foreach($csmb_meta as $key => $entry) { |
| 735 |
if($entry['position'] == 'name_pre') { |
| 736 |
$name = $entry['name']; |
| 737 |
//20110208ysk start |
| 738 |
$csmb_key = 'csmb_'.$key; |
| 739 |
//$chk_mem[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 740 |
$chk_mem[$csmb_key] = (isset($_REQUEST['check'][$csmb_key])) ? 1 : 0; |
| 741 |
//20110208ysk end |
| 742 |
} |
| 743 |
} |
| 744 |
} |
| 745 |
$chk_mem['name'] = 1; |
| 746 |
//20110411ysk start |
| 747 |
if($applyform == 'JP') { |
| 748 |
$chk_mem['kana'] = (isset($_REQUEST['check']['kana'])) ? 1 : 0; |
| 749 |
} |
| 750 |
//20110411ysk end |
| 751 |
if(!empty($csmb_meta)) { |
| 752 |
foreach($csmb_meta as $key => $entry) { |
| 753 |
if($entry['position'] == 'name_after') { |
| 754 |
$name = $entry['name']; |
| 755 |
//20110208ysk start |
| 756 |
$csmb_key = 'csmb_'.$key; |
| 757 |
//$chk_mem[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 758 |
$chk_mem[$csmb_key] = (isset($_REQUEST['check'][$csmb_key])) ? 1 : 0; |
| 759 |
//20110208ysk end |
| 760 |
} |
| 761 |
} |
| 762 |
} |
| 763 |
$chk_mem['zip'] = (isset($_REQUEST['check']['zip'])) ? 1 : 0; |
| 764 |
//20110411ysk start |
| 765 |
$chk_mem['country'] = 1; |
| 766 |
//20110411ysk end |
| 767 |
$chk_mem['pref'] = 1; |
| 768 |
$chk_mem['address1'] = 1; |
| 769 |
$chk_mem['address2'] = 1; |
| 770 |
$chk_mem['address3'] = 1; |
| 771 |
$chk_mem['tel'] = (isset($_REQUEST['check']['tel'])) ? 1 : 0; |
| 772 |
$chk_mem['fax'] = (isset($_REQUEST['check']['fax'])) ? 1 : 0; |
| 773 |
if(!empty($csmb_meta)) { |
| 774 |
foreach($csmb_meta as $key => $entry) { |
| 775 |
if($entry['position'] == 'fax_after') { |
| 776 |
$name = $entry['name']; |
| 777 |
//20110208ysk start |
| 778 |
$csmb_key = 'csmb_'.$key; |
| 779 |
//$chk_mem[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 780 |
$chk_mem[$csmb_key] = (isset($_REQUEST['check'][$csmb_key])) ? 1 : 0; |
| 781 |
//20110208ysk end |
| 782 |
} |
| 783 |
} |
| 784 |
} |
| 785 |
$chk_mem['date'] = (isset($_REQUEST['check']['date'])) ? 1 : 0; |
| 786 |
$chk_mem['point'] = (isset($_REQUEST['check']['point'])) ? 1 : 0; |
| 787 |
$chk_mem['rank'] = (isset($_REQUEST['check']['rank'])) ? 1 : 0; |
| 788 |
$usces_opt_member['chk_mem'] = $chk_mem; |
| 789 |
update_option('usces_opt_member', $usces_opt_member); |
| 790 |
//========================================================================== |
| 791 |
|
| 792 |
$_REQUEST['searchIn'] = "searchIn"; |
| 793 |
$tableName = $wpdb->prefix."usces_member"; |
| 794 |
$arr_column = array( |
| 795 |
__('membership number', 'usces') => 'ID', |
| 796 |
__('name', 'usces') => 'name', |
| 797 |
__('Address', 'usces') => 'address', |
| 798 |
__('Phone number', 'usces') => 'tel', |
| 799 |
__('e-mail', 'usces') => 'email', |
| 800 |
__('Strated date', 'usces') => 'date', |
| 801 |
__('current point', 'usces') => 'point'); |
| 802 |
$DT = new dataList($tableName, $arr_column); |
| 803 |
//20101202ysk start |
| 804 |
$DT->pageLimit = 'off'; |
| 805 |
//20101202ysk end |
| 806 |
$res = $DT->MakeTable(); |
| 807 |
$rows = $DT->rows; |
| 808 |
|
| 809 |
//========================================================================== |
| 810 |
$line = $table_h; |
| 811 |
$line .= $tr_h; |
| 812 |
$line .= $th_h1.__('membership number', 'usces').$th_f; |
| 813 |
if(isset($_REQUEST['check']['email'])) $line .= $th_h.__('e-mail', 'usces').$th_f; |
| 814 |
if(!empty($csmb_meta)) { |
| 815 |
foreach($csmb_meta as $key => $entry) { |
| 816 |
if($entry['position'] == 'name_pre') { |
| 817 |
$name = $entry['name']; |
| 818 |
//20110208ysk start |
| 819 |
$csmb_key = 'csmb_'.$key; |
| 820 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 821 |
if(isset($_REQUEST['check'][$csmb_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 822 |
//20110208ysk end |
| 823 |
} |
| 824 |
} |
| 825 |
} |
| 826 |
$line .= $th_h.__('name', 'usces').$th_f; |
| 827 |
//20110411ysk start |
| 828 |
if($applyform == 'JP') { |
| 829 |
if(isset($_REQUEST['check']['kana'])) $line .= $th_h.__('furigana', 'usces').$th_f; |
| 830 |
} |
| 831 |
//20110411ysk end |
| 832 |
if(!empty($csmb_meta)) { |
| 833 |
foreach($csmb_meta as $key => $entry) { |
| 834 |
if($entry['position'] == 'name_after') { |
| 835 |
$name = $entry['name']; |
| 836 |
//20110208ysk start |
| 837 |
$csmb_key = 'csmb_'.$key; |
| 838 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 839 |
if(isset($_REQUEST['check'][$csmb_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 840 |
//20110208ysk end |
| 841 |
} |
| 842 |
} |
| 843 |
} |
| 844 |
//20110411ysk start |
| 845 |
switch($applyform) { |
| 846 |
case 'JP': |
| 847 |
if(isset($_REQUEST['check']['zip'])) $line .= $th_h.__('Zip/Postal Code', 'usces').$th_f; |
| 848 |
$line .= $th_h.__('Country', 'usces').$th_f; |
| 849 |
$line .= $th_h.__('Province', 'usces').$th_f; |
| 850 |
$line .= $th_h.__('city', 'usces').$th_f; |
| 851 |
$line .= $th_h.__('numbers', 'usces').$th_f; |
| 852 |
$line .= $th_h.__('building name', 'usces').$th_f; |
| 853 |
if(isset($_REQUEST['check']['tel'])) $line .= $th_h.__('Phone number', 'usces').$th_f; |
| 854 |
if(isset($_REQUEST['check']['fax'])) $line .= $th_h.__('FAX number', 'usces').$th_f; |
| 855 |
break; |
| 856 |
case 'US': |
| 857 |
default: |
| 858 |
$line .= $th_h.__('Address Line1', 'usces').$th_f; |
| 859 |
$line .= $th_h.__('Address Line2', 'usces').$th_f; |
| 860 |
$line .= $th_h.__('city', 'usces').$th_f; |
| 861 |
$line .= $th_h.__('State', 'usces').$th_f; |
| 862 |
$line .= $th_h.__('Country', 'usces').$th_f; |
| 863 |
if(isset($_REQUEST['check']['zip'])) $line .= $th_h.__('Zip', 'usces').$th_f; |
| 864 |
if(isset($_REQUEST['check']['tel'])) $line .= $th_h.__('Phone number', 'usces').$th_f; |
| 865 |
if(isset($_REQUEST['check']['fax'])) $line .= $th_h.__('FAX number', 'usces').$th_f; |
| 866 |
break; |
| 867 |
} |
| 868 |
//20110411ysk end |
| 869 |
if(!empty($csmb_meta)) { |
| 870 |
foreach($csmb_meta as $key => $entry) { |
| 871 |
if($entry['position'] == 'fax_after') { |
| 872 |
$name = $entry['name']; |
| 873 |
//20110208ysk start |
| 874 |
$csmb_key = 'csmb_'.$key; |
| 875 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 876 |
if(isset($_REQUEST['check'][$csmb_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 877 |
//20110208ysk end |
| 878 |
} |
| 879 |
} |
| 880 |
} |
| 881 |
if(isset($_REQUEST['check']['date'])) $line .= $th_h.__('Strated date', 'usces').$th_f; |
| 882 |
if(isset($_REQUEST['check']['point'])) $line .= $th_h.__('current point', 'usces').$th_f; |
| 883 |
if(isset($_REQUEST['check']['rank'])) $line .= $th_h.__('Rank', 'usces').$th_f; |
| 884 |
$line .= $tr_f.$lf; |
| 885 |
//========================================================================== |
| 886 |
foreach((array)$rows as $array) { |
| 887 |
$member_id = $array['ID']; |
| 888 |
$query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $member_id); |
| 889 |
$data = $wpdb->get_row( $query, ARRAY_A ); |
| 890 |
|
| 891 |
$line .= $tr_h; |
| 892 |
$line .= $td_h1.$member_id.$td_f; |
| 893 |
if(isset($_REQUEST['check']['email'])) $line .= $td_h.usces_entity_decode($array['email'], $ext).$td_f; |
| 894 |
if(!empty($csmb_meta)) { |
| 895 |
foreach($csmb_meta as $key => $entry) { |
| 896 |
if($entry['position'] == 'name_pre') { |
| 897 |
$name = $entry['name']; |
| 898 |
$csmb_key = 'csmb_'.$key; |
| 899 |
//20110208ysk start |
| 900 |
//if(isset($_REQUEST['check'][$name])) { |
| 901 |
if(isset($_REQUEST['check'][$csmb_key])) { |
| 902 |
//20110208ysk end |
| 903 |
$value = maybe_unserialize($usces->get_member_meta_value($csmb_key, $member_id)); |
| 904 |
if(empty($value)) { |
| 905 |
$value = ''; |
| 906 |
} elseif(is_array($value)) { |
| 907 |
$concatval = ''; |
| 908 |
$c = ''; |
| 909 |
foreach($value as $v) { |
| 910 |
$concatval .= $c.$v; |
| 911 |
$c = ' '; |
| 912 |
} |
| 913 |
$value = $concatval; |
| 914 |
} |
| 915 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 916 |
} |
| 917 |
} |
| 918 |
} |
| 919 |
} |
| 920 |
//20110411ysk start |
| 921 |
switch($applyform) { |
| 922 |
case 'JP': |
| 923 |
$line .= $td_h.usces_entity_decode($data['mem_name1'].' '.$data['mem_name2'], $ext).$td_f; |
| 924 |
if(isset($_REQUEST['check']['kana'])) $line .= $td_h.usces_entity_decode($data['mem_name3'].' '.$data['mem_name4'], $ext).$td_f; |
| 925 |
break; |
| 926 |
case 'US': |
| 927 |
default: |
| 928 |
$line .= $td_h.usces_entity_decode($data['mem_name2'].' '.$data['mem_name1'], $ext).$td_f; |
| 929 |
break; |
| 930 |
} |
| 931 |
//20110411ysk end |
| 932 |
if(!empty($csmb_meta)) { |
| 933 |
foreach($csmb_meta as $key => $entry) { |
| 934 |
if($entry['position'] == 'name_after') { |
| 935 |
$name = $entry['name']; |
| 936 |
$csmb_key = 'csmb_'.$key; |
| 937 |
//20110208ysk start |
| 938 |
//if(isset($_REQUEST['check'][$name])) { |
| 939 |
if(isset($_REQUEST['check'][$csmb_key])) { |
| 940 |
//20110208ysk end |
| 941 |
$value = maybe_unserialize($usces->get_member_meta_value($csmb_key, $member_id)); |
| 942 |
if(empty($value)) { |
| 943 |
$value = ''; |
| 944 |
} elseif(is_array($value)) { |
| 945 |
$concatval = ''; |
| 946 |
$c = ''; |
| 947 |
foreach($value as $v) { |
| 948 |
$concatval .= $c.$v; |
| 949 |
$c = ' '; |
| 950 |
} |
| 951 |
$value = $concatval; |
| 952 |
} |
| 953 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 954 |
} |
| 955 |
} |
| 956 |
} |
| 957 |
} |
| 958 |
//20110411ysk start |
| 959 |
$address_info = ''; |
| 960 |
switch($applyform) { |
| 961 |
case 'JP': |
| 962 |
if(isset($_REQUEST['check']['zip'])) $address_info .= $td_h.usces_entity_decode($data['mem_zip'], $ext).$td_f; |
| 963 |
$address_info .= $td_h.$usces_settings['country'][$usces->get_member_meta_value('customer_country', $member_id)].$td_f; |
| 964 |
$address_info .= $td_h.usces_entity_decode($data['mem_pref'], $ext).$td_f; |
| 965 |
$address_info .= $td_h.usces_entity_decode($data['mem_address1'], $ext).$td_f; |
| 966 |
$address_info .= $td_h.usces_entity_decode($data['mem_address2'], $ext).$td_f; |
| 967 |
$address_info .= $td_h.usces_entity_decode($data['mem_address3'], $ext).$td_f; |
| 968 |
if(isset($_REQUEST['check']['tel'])) $address_info .= $td_h.usces_entity_decode($data['mem_tel'], $ext).$td_f; |
| 969 |
if(isset($_REQUEST['check']['fax'])) $address_info .= $td_h.usces_entity_decode($data['mem_fax'], $ext).$td_f; |
| 970 |
break; |
| 971 |
case 'US': |
| 972 |
default: |
| 973 |
$address_info .= $td_h.usces_entity_decode($data['mem_address2'], $ext).$td_f; |
| 974 |
$address_info .= $td_h.usces_entity_decode($data['mem_address3'], $ext).$td_f; |
| 975 |
$address_info .= $td_h.usces_entity_decode($data['mem_address1'], $ext).$td_f; |
| 976 |
$address_info .= $td_h.usces_entity_decode($data['mem_pref'], $ext).$td_f; |
| 977 |
$address_info .= $td_h.$usces_settings['country'][$usces->get_member_meta_value('customer_country', $member_id)].$td_f; |
| 978 |
if(isset($_REQUEST['check']['zip'])) $address_info .= $td_h.usces_entity_decode($data['mem_zip'], $ext).$td_f; |
| 979 |
if(isset($_REQUEST['check']['tel'])) $address_info .= $td_h.usces_entity_decode($data['mem_tel'], $ext).$td_f; |
| 980 |
if(isset($_REQUEST['check']['fax'])) $address_info .= $td_h.usces_entity_decode($data['mem_fax'], $ext).$td_f; |
| 981 |
break; |
| 982 |
} |
| 983 |
$address_info_args = compact( 'td_h', 'td_f', 'ext', 'member_id', 'applyform' ); |
| 984 |
$line .= apply_filters( 'usces_filter_mem_csv_address_info', $address_info, $data, $address_info_args ); |
| 985 |
//20110411ysk end |
| 986 |
if(!empty($csmb_meta)) { |
| 987 |
foreach($csmb_meta as $key => $entry) { |
| 988 |
if($entry['position'] == 'fax_after') { |
| 989 |
$name = $entry['name']; |
| 990 |
$csmb_key = 'csmb_'.$key; |
| 991 |
//20110208ysk start |
| 992 |
//if(isset($_REQUEST['check'][$name])) { |
| 993 |
if(isset($_REQUEST['check'][$csmb_key])) { |
| 994 |
//20110208ysk end |
| 995 |
$value = maybe_unserialize($usces->get_member_meta_value($csmb_key, $member_id)); |
| 996 |
if(empty($value)) { |
| 997 |
$value = ''; |
| 998 |
} elseif(is_array($value)) { |
| 999 |
$concatval = ''; |
| 1000 |
$c = ''; |
| 1001 |
foreach($value as $v) { |
| 1002 |
$concatval .= $c.$v; |
| 1003 |
$c = ' '; |
| 1004 |
} |
| 1005 |
$value = $concatval; |
| 1006 |
} |
| 1007 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1008 |
} |
| 1009 |
} |
| 1010 |
} |
| 1011 |
} |
| 1012 |
if(isset($_REQUEST['check']['date'])) $line .= $td_h.$data['mem_registered'].$td_f; |
| 1013 |
if(isset($_REQUEST['check']['point'])) $line .= $td_h.$data['mem_point'].$td_f; |
| 1014 |
if(isset($_REQUEST['check']['rank'])) { |
| 1015 |
$rank = ''; |
| 1016 |
foreach((array)$usces->member_status as $rk => $rv) { |
| 1017 |
if($rk == $data['mem_status']) { |
| 1018 |
$rank = $rv; |
| 1019 |
break; |
| 1020 |
} |
| 1021 |
} |
| 1022 |
$line .= $td_h.$rank.$td_f; |
| 1023 |
} |
| 1024 |
$line .= $tr_f.$lf; |
| 1025 |
} |
| 1026 |
$line .= $table_f.$lf; |
| 1027 |
//========================================================================== |
| 1028 |
|
| 1029 |
if($ext == 'xls') { |
| 1030 |
header("Content-Type: application/vnd.ms-excel; charset=Shift-JIS"); |
| 1031 |
} elseif($ext == 'csv') { |
| 1032 |
header("Content-Type: application/octet-stream"); |
| 1033 |
} |
| 1034 |
header("Content-Disposition: attachment; filename=usces_member_list.".$ext); |
| 1035 |
mb_http_output('pass'); |
| 1036 |
print(mb_convert_encoding($line, "SJIS-win", "UTF-8")); |
| 1037 |
exit(); |
| 1038 |
} |
| 1039 |
|
| 1040 |
// product list download |
| 1041 |
function usces_download_product_list() { |
| 1042 |
require_once( USCES_PLUGIN_DIR . "/classes/orderList.class.php" ); |
| 1043 |
global $wpdb, $usces; |
| 1044 |
|
| 1045 |
$ext = $_REQUEST['ftype']; |
| 1046 |
/* if($ext == 'xls') {//HTML |
| 1047 |
$table_h = "<table>"; |
| 1048 |
$table_f = "</table>"; |
| 1049 |
$tr_h = "<tr>"; |
| 1050 |
$tr_f = "</tr>"; |
| 1051 |
$th_h1 = "<th>"; |
| 1052 |
$th_h = "<th>"; |
| 1053 |
$th_f = "</th>"; |
| 1054 |
$td_h1 = "<td>"; |
| 1055 |
$td_h = "<td>"; |
| 1056 |
$td_f = "</td>"; |
| 1057 |
$sp = ":"; |
| 1058 |
$nb = " "; |
| 1059 |
$lf = "\n"; |
| 1060 |
*/ if($ext == 'xls') {//TSV |
| 1061 |
$table_h = ""; |
| 1062 |
$table_f = ""; |
| 1063 |
$tr_h = ""; |
| 1064 |
$tr_f = ""; |
| 1065 |
$th_h1 = '"'; |
| 1066 |
$th_h = "\t".'"'; |
| 1067 |
$th_f = '"'; |
| 1068 |
$td_h1 = '"'; |
| 1069 |
$td_h = "\t".'"'; |
| 1070 |
$td_f = '"'; |
| 1071 |
$sp = ":"; |
| 1072 |
$nb = "\n"; |
| 1073 |
$lf = "\n"; |
| 1074 |
} elseif($ext == 'csv') {//CSV |
| 1075 |
$table_h = ""; |
| 1076 |
$table_f = ""; |
| 1077 |
$tr_h = ""; |
| 1078 |
$tr_f = ""; |
| 1079 |
//20110201ysk start |
| 1080 |
//$th_h1 = ""; |
| 1081 |
$th_h1 = '"'; |
| 1082 |
//$th_h = ","; |
| 1083 |
$th_h = ',"'; |
| 1084 |
//$th_f = ""; |
| 1085 |
$th_f = '"'; |
| 1086 |
//$td_h1 = ""; |
| 1087 |
$td_h1 = '"'; |
| 1088 |
//$td_h = ","; |
| 1089 |
$td_h = ',"'; |
| 1090 |
//$td_f = ""; |
| 1091 |
$td_f = '"'; |
| 1092 |
//20110201ysk end |
| 1093 |
$sp = ":"; |
| 1094 |
$nb = " "; |
| 1095 |
$lf = "\n"; |
| 1096 |
} else { |
| 1097 |
exit(); |
| 1098 |
} |
| 1099 |
|
| 1100 |
//========================================================================== |
| 1101 |
$usces_opt_order = get_option('usces_opt_order'); |
| 1102 |
if(!is_array($usces_opt_order)){ |
| 1103 |
$usces_opt_order = array(); |
| 1104 |
} |
| 1105 |
$usces_opt_order['ftype_pro'] = $ext; |
| 1106 |
$chk_pro = array(); |
| 1107 |
$chk_pro['ID'] = 1; |
| 1108 |
$chk_pro['deco_id'] = 1; |
| 1109 |
$chk_pro['date'] = (isset($_REQUEST['check']['date'])) ? 1 : 0; |
| 1110 |
$chk_pro['mem_id'] = (isset($_REQUEST['check']['mem_id'])) ? 1 : 0; |
| 1111 |
$chk_pro['name'] = (isset($_REQUEST['check']['name'])) ? 1 : 0; |
| 1112 |
$chk_pro['delivery_method'] = (isset($_REQUEST['check']['delivery_method'])) ? 1 : 0; |
| 1113 |
$chk_pro['shipping_date'] = (isset($_REQUEST['check']['shipping_date'])) ? 1 : 0; |
| 1114 |
$chk_pro['item_code'] = 1; |
| 1115 |
$chk_pro['sku_code'] = 1; |
| 1116 |
$chk_pro['item_name'] = (isset($_REQUEST['check']['item_name'])) ? 1 : 0; |
| 1117 |
$chk_pro['sku_name'] = (isset($_REQUEST['check']['sku_name'])) ? 1 : 0; |
| 1118 |
$chk_pro['options'] = (isset($_REQUEST['check']['options'])) ? 1 : 0; |
| 1119 |
$chk_pro['quantity'] = 1; |
| 1120 |
$chk_pro['price'] = 1; |
| 1121 |
$chk_pro['unit'] = (isset($_REQUEST['check']['unit'])) ? 1 : 0; |
| 1122 |
$usces_opt_order['chk_pro'] = apply_filters( 'usces_filter_chk_pro', $chk_pro ); |
| 1123 |
update_option('usces_opt_order', $usces_opt_order); |
| 1124 |
//========================================================================== |
| 1125 |
|
| 1126 |
$_REQUEST['searchIn'] = "searchIn"; |
| 1127 |
$tableName = $wpdb->prefix."usces_order"; |
| 1128 |
$arr_column = array( |
| 1129 |
__('ID', 'usces') => 'ID', |
| 1130 |
__('Order number', 'usces') => 'deco_id', |
| 1131 |
__('date', 'usces') => 'date', |
| 1132 |
__('membership number', 'usces') => 'mem_id', |
| 1133 |
__('name', 'usces') => 'name', |
| 1134 |
__('Region', 'usces') => 'pref', |
| 1135 |
__('shipping option', 'usces') => 'delivery_method', |
| 1136 |
__('Amount', 'usces') => 'total_price', |
| 1137 |
__('payment method', 'usces') => 'payment_name', |
| 1138 |
__('transfer statement', 'usces') => 'receipt_status', |
| 1139 |
__('Processing', 'usces') => 'order_status', |
| 1140 |
__('shpping date', 'usces') => 'order_modified'); |
| 1141 |
$DT = new dataList($tableName, $arr_column); |
| 1142 |
//20101202ysk start |
| 1143 |
$DT->pageLimit = 'off'; |
| 1144 |
//20101202ysk end |
| 1145 |
$res = $DT->MakeTable(); |
| 1146 |
$rows = $DT->rows; |
| 1147 |
|
| 1148 |
//========================================================================== |
| 1149 |
$line = $table_h; |
| 1150 |
$line .= $tr_h; |
| 1151 |
$line .= $th_h1.__('ID', 'usces').$th_f; |
| 1152 |
$line .= $th_h.__('Order number', 'usces').$th_f; |
| 1153 |
if(isset($_REQUEST['check']['date'])) $line .= $th_h.__('order date', 'usces').$th_f; |
| 1154 |
if(isset($_REQUEST['check']['mem_id'])) $line .= $th_h.__('membership number', 'usces').$th_f; |
| 1155 |
if(isset($_REQUEST['check']['name'])) $line .= $th_h.__('name', 'usces').$th_f; |
| 1156 |
if(isset($_REQUEST['check']['delivery_method'])) $line .= $th_h.__('shipping option', 'usces').$th_f; |
| 1157 |
if(isset($_REQUEST['check']['shipping_date'])) $line .= $th_h.__('shpping date', 'usces').$th_f; |
| 1158 |
$line .= apply_filters( 'usces_filter_chk_pro_label_head', NULL, $usces_opt_order, $rows); |
| 1159 |
$line .= $th_h.__('item code', 'usces').$th_f; |
| 1160 |
$line .= $th_h.__('SKU code', 'usces').$th_f; |
| 1161 |
if(isset($_REQUEST['check']['item_name'])) $line .= $th_h.__('item name', 'usces').$th_f; |
| 1162 |
if(isset($_REQUEST['check']['sku_name'])) $line .= $th_h.__('SKU display name ', 'usces').$th_f; |
| 1163 |
if(isset($_REQUEST['check']['options'])) $line .= $th_h.__('options for items', 'usces').$th_f; |
| 1164 |
$line .= $th_h.__('Quantity', 'usces').$th_f; |
| 1165 |
$line .= $th_h.__('Unit price', 'usces').$th_f; |
| 1166 |
if(isset($_REQUEST['check']['unit'])) $line .= $th_h.__('unit', 'usces').$th_f; |
| 1167 |
$line .= apply_filters( 'usces_filter_chk_pro_label_detail', NULL, $usces_opt_order, $rows); |
| 1168 |
$line .= $tr_f.$lf; |
| 1169 |
//========================================================================== |
| 1170 |
foreach((array)$rows as $array) { |
| 1171 |
$order_id = $array['ID']; |
| 1172 |
$query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $order_id); |
| 1173 |
$data = $wpdb->get_row( $query, ARRAY_A ); |
| 1174 |
//$cart = stripslashes_deep(unserialize($data['order_cart'])); |
| 1175 |
$cart = unserialize($data['order_cart']); |
| 1176 |
//if(!empty($data)) { |
| 1177 |
// $data = stripslashes_deep($data); |
| 1178 |
//} |
| 1179 |
for($i = 0; $i < count($cart); $i++) { |
| 1180 |
$cart_row = $cart[$i]; |
| 1181 |
$post_id = $cart_row['post_id']; |
| 1182 |
$sku = urldecode($cart_row['sku']); |
| 1183 |
|
| 1184 |
$line .= $tr_h; |
| 1185 |
$line .= $td_h1.$order_id.$td_f; |
| 1186 |
$line .= $td_h.$array['deco_id'].$td_f; |
| 1187 |
if(isset($_REQUEST['check']['date'])) $line .= $td_h.$array['date'].$td_f; |
| 1188 |
if(isset($_REQUEST['check']['mem_id'])) $line .= $td_h.$array['mem_id'].$td_f; |
| 1189 |
if(isset($_REQUEST['check']['name'])) $line .= $td_h.usces_entity_decode($data['order_name1'].$data['order_name2'], $ext).$td_f; |
| 1190 |
if(isset($_REQUEST['check']['delivery_method'])) { |
| 1191 |
$delivery_method = ''; |
| 1192 |
if(strtoupper($data['order_delivery_method']) == '#NONE#') { |
| 1193 |
$delivery_method = __('No preference', 'usces'); |
| 1194 |
} else { |
| 1195 |
foreach((array)$usces->options['delivery_method'] as $dkey => $delivery) { |
| 1196 |
if($delivery['id'] == $data['order_delivery_method']) { |
| 1197 |
$delivery_method = $delivery['name']; |
| 1198 |
break; |
| 1199 |
} |
| 1200 |
} |
| 1201 |
} |
| 1202 |
$line .= $td_h.$delivery_method.$td_f; |
| 1203 |
} |
| 1204 |
if(isset($_REQUEST['check']['shipping_date'])) $line .= $td_h.$data['order_modified'].$td_f; |
| 1205 |
$line .= apply_filters( 'usces_filter_chk_pro_data_head', NULL, $usces_opt_order, $data, $cart_row); |
| 1206 |
|
| 1207 |
$line .= $td_h.$usces->getItemCode($post_id).$td_f; |
| 1208 |
$line .= $td_h.$sku.$td_f; |
| 1209 |
if(isset($_REQUEST['check']['item_name'])) $line .= $td_h.usces_entity_decode($usces->getItemName($post_id), $ext).$td_f; |
| 1210 |
if(isset($_REQUEST['check']['sku_name'])) $line .= $td_h.usces_entity_decode($usces->getItemSkuDisp($post_id, $sku), $ext).$td_f; |
| 1211 |
if(isset($_REQUEST['check']['options'])) { |
| 1212 |
$options = $cart_row['options']; |
| 1213 |
$optstr = ''; |
| 1214 |
if(is_array($options) && count($options) > 0) { |
| 1215 |
foreach((array)$options as $key => $value) { |
| 1216 |
if(!empty($key)) { |
| 1217 |
if(is_array($value)) { |
| 1218 |
foreach($value as $v) { |
| 1219 |
$optstr .= usces_entity_decode(urldecode($key), $ext).$sp; |
| 1220 |
foreach($value as $v) { |
| 1221 |
$optstr .= usces_entity_decode(urldecode($v), $ext).$nb; |
| 1222 |
} |
| 1223 |
} |
| 1224 |
} else { |
| 1225 |
//$optstr .= usces_entity_decode($key, $ext).$sp.usces_entity_decode($value, $ext).$nb; |
| 1226 |
$optstr .= usces_entity_decode(urldecode($key).$sp.urldecode($value), $ext).$nb; |
| 1227 |
} |
| 1228 |
} |
| 1229 |
} |
| 1230 |
} |
| 1231 |
$line .= $td_h.$optstr.$td_f; |
| 1232 |
} |
| 1233 |
$line .= $td_h.$cart_row['quantity'].$td_f; |
| 1234 |
$line .= $td_h.usces_crform($cart_row['price'], false, false, 'return', false).$td_f; |
| 1235 |
if(isset($_REQUEST['check']['unit'])) $line .= $td_h.usces_entity_decode($usces->getItemSkuUnit($post_id, $sku), $ext).$td_f; |
| 1236 |
$line .= apply_filters( 'usces_filter_chk_pro_data_detail', NULL, $usces_opt_order, $data, $cart_row); |
| 1237 |
$line .= $tr_f.$lf; |
| 1238 |
} |
| 1239 |
} |
| 1240 |
$line .= $table_f.$lf; |
| 1241 |
//========================================================================== |
| 1242 |
|
| 1243 |
if($ext == 'xls') { |
| 1244 |
header("Content-Type: application/vnd.ms-excel; charset=Shift-JIS"); |
| 1245 |
} elseif($ext == 'csv') { |
| 1246 |
header("Content-Type: application/octet-stream"); |
| 1247 |
} |
| 1248 |
header("Content-Disposition: attachment; filename=usces_product_list.".$ext); |
| 1249 |
mb_http_output('pass'); |
| 1250 |
print(mb_convert_encoding($line, "SJIS-win", "UTF-8")); |
| 1251 |
exit(); |
| 1252 |
} |
| 1253 |
|
| 1254 |
// order list download |
| 1255 |
function usces_download_order_list() { |
| 1256 |
require_once( USCES_PLUGIN_DIR . "/classes/orderList.class.php" ); |
| 1257 |
global $wpdb, $usces; |
| 1258 |
//20110411ysk start |
| 1259 |
global $usces_settings; |
| 1260 |
//20110411ysk end |
| 1261 |
|
| 1262 |
$ext = $_REQUEST['ftype']; |
| 1263 |
/* if($ext == 'xls') {//HTML |
| 1264 |
$table_h = "<table>"; |
| 1265 |
$table_f = "</table>"; |
| 1266 |
$tr_h = "<tr>"; |
| 1267 |
$tr_f = "</tr>"; |
| 1268 |
$th_h1 = "<th>"; |
| 1269 |
$th_h = "<th>"; |
| 1270 |
$th_f = "</th>"; |
| 1271 |
$td_h1 = "<td>"; |
| 1272 |
$td_h = "<td>"; |
| 1273 |
$td_f = "</td>"; |
| 1274 |
$sp = ":"; |
| 1275 |
$lf = "\n"; |
| 1276 |
*/ if($ext == 'xls') {//TSV |
| 1277 |
$table_h = ""; |
| 1278 |
$table_f = ""; |
| 1279 |
$tr_h = ""; |
| 1280 |
$tr_f = ""; |
| 1281 |
$th_h1 = '"'; |
| 1282 |
$th_h = "\t".'"'; |
| 1283 |
$th_f = '"'; |
| 1284 |
$td_h1 = '"'; |
| 1285 |
$td_h = "\t".'"'; |
| 1286 |
$td_f = '"'; |
| 1287 |
$sp = ":"; |
| 1288 |
$lf = "\n"; |
| 1289 |
} elseif($ext == 'csv') {//CSV |
| 1290 |
$table_h = ""; |
| 1291 |
$table_f = ""; |
| 1292 |
$tr_h = ""; |
| 1293 |
$tr_f = ""; |
| 1294 |
//20110201ysk start |
| 1295 |
//$th_h1 = ""; |
| 1296 |
$th_h1 = '"'; |
| 1297 |
//$th_h = ","; |
| 1298 |
$th_h = ',"'; |
| 1299 |
//$th_f = ""; |
| 1300 |
$th_f = '"'; |
| 1301 |
//$td_h1 = ""; |
| 1302 |
$td_h1 = '"'; |
| 1303 |
//$td_h = ","; |
| 1304 |
$td_h = ',"'; |
| 1305 |
//$td_f = ""; |
| 1306 |
$td_f = '"'; |
| 1307 |
//20110201ysk end |
| 1308 |
$sp = ":"; |
| 1309 |
$lf = "\n"; |
| 1310 |
} else { |
| 1311 |
exit(); |
| 1312 |
} |
| 1313 |
$csod_meta = usces_has_custom_field_meta('order'); |
| 1314 |
$cscs_meta = usces_has_custom_field_meta('customer'); |
| 1315 |
$csde_meta = usces_has_custom_field_meta('delivery'); |
| 1316 |
//20110411ysk start |
| 1317 |
$applyform = usces_get_apply_addressform($usces->options['system']['addressform']); |
| 1318 |
//20110411ysk end |
| 1319 |
|
| 1320 |
//========================================================================== |
| 1321 |
$usces_opt_order = get_option('usces_opt_order'); |
| 1322 |
if(!is_array($usces_opt_order)){ |
| 1323 |
$usces_opt_order = array(); |
| 1324 |
} |
| 1325 |
$usces_opt_order['ftype_ord'] = $ext; |
| 1326 |
$chk_ord = array(); |
| 1327 |
$chk_ord['ID'] = 1; |
| 1328 |
$chk_ord['deco_id'] = 1; |
| 1329 |
$chk_ord['date'] = 1; |
| 1330 |
$chk_ord['mem_id'] = (isset($_REQUEST['check']['mem_id'])) ? 1 : 0; |
| 1331 |
$chk_ord['email'] = (isset($_REQUEST['check']['email'])) ? 1 : 0; |
| 1332 |
if(!empty($cscs_meta)) { |
| 1333 |
foreach($cscs_meta as $key => $entry) { |
| 1334 |
if($entry['position'] == 'name_pre') { |
| 1335 |
$name = $entry['name']; |
| 1336 |
//20110208ysk start |
| 1337 |
$cscs_key = 'cscs_'.$key; |
| 1338 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1339 |
$chk_ord[$cscs_key] = (isset($_REQUEST['check'][$cscs_key])) ? 1 : 0; |
| 1340 |
//20110208ysk end |
| 1341 |
} |
| 1342 |
} |
| 1343 |
} |
| 1344 |
$chk_ord['name'] = 1; |
| 1345 |
//20110411ysk start |
| 1346 |
if($applyform == 'JP') { |
| 1347 |
$chk_ord['kana'] = (isset($_REQUEST['check']['kana'])) ? 1 : 0; |
| 1348 |
} |
| 1349 |
//20110411ysk end |
| 1350 |
if(!empty($cscs_meta)) { |
| 1351 |
foreach($cscs_meta as $key => $entry) { |
| 1352 |
if($entry['position'] == 'name_after') { |
| 1353 |
$name = $entry['name']; |
| 1354 |
//20110208ysk start |
| 1355 |
$cscs_key = 'cscs_'.$key; |
| 1356 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1357 |
$chk_ord[$cscs_key] = (isset($_REQUEST['check'][$cscs_key])) ? 1 : 0; |
| 1358 |
//20110208ysk end |
| 1359 |
} |
| 1360 |
} |
| 1361 |
} |
| 1362 |
$chk_ord['zip'] = (isset($_REQUEST['check']['zip'])) ? 1 : 0; |
| 1363 |
//20110411ysk start |
| 1364 |
$chk_ord['country'] = (isset($_REQUEST['check']['country'])) ? 1 : 0; |
| 1365 |
//20110411ysk end |
| 1366 |
$chk_ord['pref'] = (isset($_REQUEST['check']['pref'])) ? 1 : 0; |
| 1367 |
$chk_ord['address1'] = (isset($_REQUEST['check']['address1'])) ? 1 : 0; |
| 1368 |
$chk_ord['address2'] = (isset($_REQUEST['check']['address2'])) ? 1 : 0; |
| 1369 |
$chk_ord['address3'] = (isset($_REQUEST['check']['address3'])) ? 1 : 0; |
| 1370 |
$chk_ord['tel'] = (isset($_REQUEST['check']['tel'])) ? 1 : 0; |
| 1371 |
$chk_ord['fax'] = (isset($_REQUEST['check']['fax'])) ? 1 : 0; |
| 1372 |
if(!empty($cscs_meta)) { |
| 1373 |
foreach($cscs_meta as $key => $entry) { |
| 1374 |
if($entry['position'] == 'fax_after') { |
| 1375 |
$name = $entry['name']; |
| 1376 |
//20110208ysk start |
| 1377 |
$cscs_key = 'cscs_'.$key; |
| 1378 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1379 |
$chk_ord[$cscs_key] = (isset($_REQUEST['check'][$cscs_key])) ? 1 : 0; |
| 1380 |
//20110208ysk end |
| 1381 |
} |
| 1382 |
} |
| 1383 |
} |
| 1384 |
//-------------------------------------------------------------------------- |
| 1385 |
if(!empty($csde_meta)) { |
| 1386 |
foreach($csde_meta as $key => $entry) { |
| 1387 |
if($entry['position'] == 'name_pre') { |
| 1388 |
$name = $entry['name']; |
| 1389 |
//20110208ysk start |
| 1390 |
$csde_key = 'csde_'.$key; |
| 1391 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1392 |
$chk_ord[$csde_key] = (isset($_REQUEST['check'][$csde_key])) ? 1 : 0; |
| 1393 |
//20110208ysk end |
| 1394 |
} |
| 1395 |
} |
| 1396 |
} |
| 1397 |
$chk_ord['delivery_name'] = (isset($_REQUEST['check']['delivery_name'])) ? 1 : 0; |
| 1398 |
//20110411ysk start |
| 1399 |
if($applyform == 'JP') { |
| 1400 |
$chk_ord['delivery_kana'] = (isset($_REQUEST['check']['delivery_kana'])) ? 1 : 0; |
| 1401 |
} |
| 1402 |
//20110411ysk end |
| 1403 |
if(!empty($csde_meta)) { |
| 1404 |
foreach($csde_meta as $key => $entry) { |
| 1405 |
if($entry['position'] == 'name_after') { |
| 1406 |
$name = $entry['name']; |
| 1407 |
//20110208ysk start |
| 1408 |
$csde_key = 'csde_'.$key; |
| 1409 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1410 |
$chk_ord[$csde_key] = (isset($_REQUEST['check'][$csde_key])) ? 1 : 0; |
| 1411 |
//20110208ysk end |
| 1412 |
} |
| 1413 |
} |
| 1414 |
} |
| 1415 |
$chk_ord['delivery_zip'] = (isset($_REQUEST['check']['delivery_zip'])) ? 1 : 0; |
| 1416 |
//20110411ysk start |
| 1417 |
$chk_ord['delivery_country'] = (isset($_REQUEST['check']['delivery_country'])) ? 1 : 0; |
| 1418 |
//20110411ysk end |
| 1419 |
$chk_ord['delivery_pref'] = (isset($_REQUEST['check']['delivery_pref'])) ? 1 : 0; |
| 1420 |
$chk_ord['delivery_address1'] = (isset($_REQUEST['check']['delivery_address1'])) ? 1 : 0; |
| 1421 |
$chk_ord['delivery_address2'] = (isset($_REQUEST['check']['delivery_address2'])) ? 1 : 0; |
| 1422 |
$chk_ord['delivery_address3'] = (isset($_REQUEST['check']['delivery_address3'])) ? 1 : 0; |
| 1423 |
$chk_ord['delivery_tel'] = (isset($_REQUEST['check']['delivery_tel'])) ? 1 : 0; |
| 1424 |
$chk_ord['delivery_fax'] = (isset($_REQUEST['check']['delivery_fax'])) ? 1 : 0; |
| 1425 |
if(!empty($csde_meta)) { |
| 1426 |
foreach($csde_meta as $key => $entry) { |
| 1427 |
if($entry['position'] == 'fax_after') { |
| 1428 |
$name = $entry['name']; |
| 1429 |
//20110208ysk start |
| 1430 |
$csde_key = 'csde_'.$key; |
| 1431 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1432 |
$chk_ord[$csde_key] = (isset($_REQUEST['check'][$csde_key])) ? 1 : 0; |
| 1433 |
//20110208ysk end |
| 1434 |
} |
| 1435 |
} |
| 1436 |
} |
| 1437 |
//-------------------------------------------------------------------------- |
| 1438 |
$chk_ord['shipping_date'] = (isset($_REQUEST['check']['shipping_date'])) ? 1 : 0; |
| 1439 |
$chk_ord['peyment_method'] = (isset($_REQUEST['check']['peyment_method'])) ? 1 : 0; |
| 1440 |
$chk_ord['delivery_method'] = (isset($_REQUEST['check']['delivery_method'])) ? 1 : 0; |
| 1441 |
//20101208ysk start |
| 1442 |
$chk_ord['delivery_date'] = (isset($_REQUEST['check']['delivery_date'])) ? 1 : 0; |
| 1443 |
//20101208ysk end |
| 1444 |
$chk_ord['delivery_time'] = (isset($_REQUEST['check']['delivery_time'])) ? 1 : 0; |
| 1445 |
$chk_ord['delidue_date'] = (isset($_REQUEST['check']['delidue_date'])) ? 1 : 0; |
| 1446 |
$chk_ord['status'] = (isset($_REQUEST['check']['status'])) ? 1 : 0; |
| 1447 |
$chk_ord['total_amount'] = 1; |
| 1448 |
$chk_ord['usedpoint'] = (isset($_REQUEST['check']['usedpoint'])) ? 1 : 0; |
| 1449 |
$chk_ord['discount'] = 1; |
| 1450 |
$chk_ord['shipping_charge'] = 1; |
| 1451 |
$chk_ord['cod_fee'] = 1; |
| 1452 |
$chk_ord['tax'] = 1; |
| 1453 |
$chk_ord['note'] = (isset($_REQUEST['check']['note'])) ? 1 : 0; |
| 1454 |
if(!empty($csod_meta)) { |
| 1455 |
foreach($csod_meta as $key => $entry) { |
| 1456 |
$name = $entry['name']; |
| 1457 |
//20110208ysk start |
| 1458 |
$csod_key = 'csod_'.$key; |
| 1459 |
//$chk_ord[$name] = (isset($_REQUEST['check'][$name])) ? 1 : 0; |
| 1460 |
$chk_ord[$csod_key] = (isset($_REQUEST['check'][$csod_key])) ? 1 : 0; |
| 1461 |
//20110208ysk end |
| 1462 |
} |
| 1463 |
} |
| 1464 |
$usces_opt_order['chk_ord'] = apply_filters( 'usces_filter_chk_ord', $chk_ord ); |
| 1465 |
update_option('usces_opt_order', $usces_opt_order); |
| 1466 |
//========================================================================== |
| 1467 |
|
| 1468 |
if(isset($_REQUEST['check']['status'])) { |
| 1469 |
//$usces_management_status = get_option('usces_management_status'); |
| 1470 |
$usces_management_status = apply_filters( 'usces_filter_management_status', get_option('usces_management_status') );//0000530 |
| 1471 |
$usces_management_status['new'] = __('new order', 'usces'); |
| 1472 |
} |
| 1473 |
|
| 1474 |
$_REQUEST['searchIn'] = "searchIn"; |
| 1475 |
$tableName = $wpdb->prefix."usces_order"; |
| 1476 |
$arr_column = array( |
| 1477 |
__('ID', 'usces') => 'ID', |
| 1478 |
__('Order number', 'usces') => 'deco_id', |
| 1479 |
__('date', 'usces') => 'date', |
| 1480 |
__('membership number', 'usces') => 'mem_id', |
| 1481 |
__('name', 'usces') => 'name', |
| 1482 |
__('Region', 'usces') => 'pref', |
| 1483 |
__('shipping option', 'usces') => 'delivery_method', |
| 1484 |
__('Amount', 'usces') => 'total_price', |
| 1485 |
__('payment method', 'usces') => 'payment_name', |
| 1486 |
__('transfer statement', 'usces') => 'receipt_status', |
| 1487 |
__('Processing', 'usces') => 'order_status', |
| 1488 |
__('shpping date', 'usces') => 'order_modified'); |
| 1489 |
$DT = new dataList($tableName, $arr_column); |
| 1490 |
//20101202ysk start |
| 1491 |
$DT->pageLimit = 'off'; |
| 1492 |
//20101202ysk end |
| 1493 |
$res = $DT->MakeTable(); |
| 1494 |
$rows = $DT->rows; |
| 1495 |
|
| 1496 |
//========================================================================== |
| 1497 |
$line = $table_h; |
| 1498 |
$line .= $tr_h; |
| 1499 |
$line .= $th_h1.__('ID', 'usces').$th_f; |
| 1500 |
$line .= $th_h.__('Order number', 'usces').$th_f; |
| 1501 |
$line .= $th_h.__('order date', 'usces').$th_f; |
| 1502 |
if(isset($_REQUEST['check']['mem_id'])) $line .= $th_h.__('membership number', 'usces').$th_f; |
| 1503 |
if(isset($_REQUEST['check']['email'])) $line .= $th_h.__('e-mail', 'usces').$th_f; |
| 1504 |
if(!empty($cscs_meta)) { |
| 1505 |
foreach($cscs_meta as $key => $entry) { |
| 1506 |
if($entry['position'] == 'name_pre') { |
| 1507 |
$name = $entry['name']; |
| 1508 |
//20110208ysk start |
| 1509 |
$cscs_key = 'cscs_'.$key; |
| 1510 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1511 |
if(isset($_REQUEST['check'][$cscs_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1512 |
//20110208ysk end |
| 1513 |
} |
| 1514 |
} |
| 1515 |
} |
| 1516 |
$line .= $th_h.__('name', 'usces').$th_f; |
| 1517 |
//20110411ysk start |
| 1518 |
if($applyform == 'JP') { |
| 1519 |
if(isset($_REQUEST['check']['kana'])) $line .= $th_h.__('furigana', 'usces').$th_f; |
| 1520 |
} |
| 1521 |
//20110411ysk end |
| 1522 |
if(!empty($cscs_meta)) { |
| 1523 |
foreach($cscs_meta as $key => $entry) { |
| 1524 |
if($entry['position'] == 'name_after') { |
| 1525 |
$name = $entry['name']; |
| 1526 |
//20110208ysk start |
| 1527 |
$cscs_key = 'cscs_'.$key; |
| 1528 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1529 |
if(isset($_REQUEST['check'][$cscs_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1530 |
//20110208ysk end |
| 1531 |
} |
| 1532 |
} |
| 1533 |
} |
| 1534 |
//20110411ysk start |
| 1535 |
switch($applyform) { |
| 1536 |
case 'JP': |
| 1537 |
if(isset($_REQUEST['check']['zip'])) $line .= $th_h.__('Zip/Postal Code', 'usces').$th_f; |
| 1538 |
if(isset($_REQUEST['check']['country'])) $line .= $th_h.__('Country', 'usces').$th_f; |
| 1539 |
if(isset($_REQUEST['check']['pref'])) $line .= $th_h.__('Province', 'usces').$th_f; |
| 1540 |
if(isset($_REQUEST['check']['address1'])) $line .= $th_h.__('city', 'usces').$th_f; |
| 1541 |
if(isset($_REQUEST['check']['address2'])) $line .= $th_h.__('numbers', 'usces').$th_f; |
| 1542 |
if(isset($_REQUEST['check']['address3'])) $line .= $th_h.__('building name', 'usces').$th_f; |
| 1543 |
if(isset($_REQUEST['check']['tel'])) $line .= $th_h.__('Phone number', 'usces').$th_f; |
| 1544 |
if(isset($_REQUEST['check']['fax'])) $line .= $th_h.__('FAX number', 'usces').$th_f; |
| 1545 |
break; |
| 1546 |
case 'US': |
| 1547 |
default: |
| 1548 |
if(isset($_REQUEST['check']['address2'])) $line .= $th_h.__('Address Line1', 'usces').$th_f; |
| 1549 |
if(isset($_REQUEST['check']['address3'])) $line .= $th_h.__('Address Line2', 'usces').$th_f; |
| 1550 |
if(isset($_REQUEST['check']['address1'])) $line .= $th_h.__('city', 'usces').$th_f; |
| 1551 |
if(isset($_REQUEST['check']['pref'])) $line .= $th_h.__('State', 'usces').$th_f; |
| 1552 |
if(isset($_REQUEST['check']['country'])) $line .= $th_h.__('Country', 'usces').$th_f; |
| 1553 |
if(isset($_REQUEST['check']['zip'])) $line .= $th_h.__('Zip', 'usces').$th_f; |
| 1554 |
if(isset($_REQUEST['check']['tel'])) $line .= $th_h.__('Phone number', 'usces').$th_f; |
| 1555 |
if(isset($_REQUEST['check']['fax'])) $line .= $th_h.__('FAX number', 'usces').$th_f; |
| 1556 |
break; |
| 1557 |
} |
| 1558 |
//20110411ysk end |
| 1559 |
if(!empty($cscs_meta)) { |
| 1560 |
foreach($cscs_meta as $key => $entry) { |
| 1561 |
if($entry['position'] == 'fax_after') { |
| 1562 |
$name = $entry['name']; |
| 1563 |
//20110208ysk start |
| 1564 |
$cscs_key = 'cscs_'.$key; |
| 1565 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1566 |
if(isset($_REQUEST['check'][$cscs_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1567 |
//20110208ysk end |
| 1568 |
} |
| 1569 |
} |
| 1570 |
} |
| 1571 |
$line .= apply_filters( 'usces_filter_chk_ord_label_customer', NULL, $usces_opt_order, $rows ); |
| 1572 |
|
| 1573 |
//-------------------------------------------------------------------------- |
| 1574 |
if(!empty($csde_meta)) { |
| 1575 |
foreach($csde_meta as $key => $entry) { |
| 1576 |
if($entry['position'] == 'name_pre') { |
| 1577 |
$name = $entry['name']; |
| 1578 |
//20110208ysk start |
| 1579 |
$csde_key = 'csde_'.$key; |
| 1580 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1581 |
if(isset($_REQUEST['check'][$csde_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1582 |
//20110208ysk end |
| 1583 |
} |
| 1584 |
} |
| 1585 |
} |
| 1586 |
if(isset($_REQUEST['check']['delivery_name'])) $line .= $th_h.__('Shipping Name', 'usces').$th_f; |
| 1587 |
//20110411ysk start |
| 1588 |
if($applyform == 'JP') { |
| 1589 |
if(isset($_REQUEST['check']['delivery_kana'])) $line .= $th_h.__('Shipping Furigana', 'usces').$th_f; |
| 1590 |
} |
| 1591 |
//20110411ysk end |
| 1592 |
if(!empty($csde_meta)) { |
| 1593 |
foreach($csde_meta as $key => $entry) { |
| 1594 |
if($entry['position'] == 'name_after') { |
| 1595 |
$name = $entry['name']; |
| 1596 |
//20110208ysk start |
| 1597 |
$csde_key = 'csde_'.$key; |
| 1598 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1599 |
if(isset($_REQUEST['check'][$csde_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1600 |
//20110208ysk end |
| 1601 |
} |
| 1602 |
} |
| 1603 |
} |
| 1604 |
//20110411ysk start |
| 1605 |
switch($applyform) { |
| 1606 |
case 'JP': |
| 1607 |
if(isset($_REQUEST['check']['delivery_zip'])) $line .= $th_h.__('Shipping Zip', 'usces').$th_f; |
| 1608 |
if(isset($_REQUEST['check']['delivery_country'])) $line .= $th_h.__('Shipping Country', 'usces').$th_f; |
| 1609 |
if(isset($_REQUEST['check']['delivery_pref'])) $line .= $th_h.__('Shipping State', 'usces').$th_f; |
| 1610 |
if(isset($_REQUEST['check']['delivery_address1'])) $line .= $th_h.__('Shipping City', 'usces').$th_f; |
| 1611 |
if(isset($_REQUEST['check']['delivery_address2'])) $line .= $th_h.__('Shipping Address1', 'usces').$th_f; |
| 1612 |
if(isset($_REQUEST['check']['delivery_address3'])) $line .= $th_h.__('Shipping Address2', 'usces').$th_f; |
| 1613 |
if(isset($_REQUEST['check']['delivery_tel'])) $line .= $th_h.__('Shipping Phone', 'usces').$th_f; |
| 1614 |
if(isset($_REQUEST['check']['delivery_fax'])) $line .= $th_h.__('Shipping FAX', 'usces').$th_f; |
| 1615 |
break; |
| 1616 |
case 'US': |
| 1617 |
default: |
| 1618 |
if(isset($_REQUEST['check']['delivery_address2'])) $line .= $th_h.__('Shipping Address1', 'usces').$th_f; |
| 1619 |
if(isset($_REQUEST['check']['delivery_address3'])) $line .= $th_h.__('Shipping Address2', 'usces').$th_f; |
| 1620 |
if(isset($_REQUEST['check']['delivery_address1'])) $line .= $th_h.__('Shipping City', 'usces').$th_f; |
| 1621 |
if(isset($_REQUEST['check']['delivery_pref'])) $line .= $th_h.__('Shipping State', 'usces').$th_f; |
| 1622 |
if(isset($_REQUEST['check']['delivery_country'])) $line .= $th_h.__('Shipping Country', 'usces').$th_f; |
| 1623 |
if(isset($_REQUEST['check']['delivery_zip'])) $line .= $th_h.__('Shipping Zip', 'usces').$th_f; |
| 1624 |
if(isset($_REQUEST['check']['delivery_tel'])) $line .= $th_h.__('Shipping Phone', 'usces').$th_f; |
| 1625 |
if(isset($_REQUEST['check']['delivery_fax'])) $line .= $th_h.__('Shipping FAX', 'usces').$th_f; |
| 1626 |
break; |
| 1627 |
} |
| 1628 |
//20110411ysk end |
| 1629 |
if(!empty($csde_meta)) { |
| 1630 |
foreach($csde_meta as $key => $entry) { |
| 1631 |
if($entry['position'] == 'fax_after') { |
| 1632 |
$name = $entry['name']; |
| 1633 |
//20110208ysk start |
| 1634 |
$csde_key = 'csde_'.$key; |
| 1635 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1636 |
if(isset($_REQUEST['check'][$csde_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1637 |
//20110208ysk end |
| 1638 |
} |
| 1639 |
} |
| 1640 |
} |
| 1641 |
$line .= apply_filters( 'usces_filter_chk_ord_label_delivery', NULL, $usces_opt_order, $rows ); |
| 1642 |
//-------------------------------------------------------------------------- |
| 1643 |
if(isset($_REQUEST['check']['shipping_date'])) $line .= $th_h.__('shpping date', 'usces').$th_f; |
| 1644 |
if(isset($_REQUEST['check']['peyment_method'])) $line .= $th_h.__('payment method', 'usces').$th_f; |
| 1645 |
if(isset($_REQUEST['check']['delivery_method'])) $line .= $th_h.__('shipping option', 'usces').$th_f; |
| 1646 |
//20101208ysk start |
| 1647 |
if(isset($_REQUEST['check']['delivery_date'])) $line .= $th_h.__('Delivery date', 'usces').$th_f; |
| 1648 |
//20101208ysk end |
| 1649 |
if(isset($_REQUEST['check']['delivery_time'])) $line .= $th_h.__('delivery time', 'usces').$th_f; |
| 1650 |
if(isset($_REQUEST['check']['delidue_date'])) $line .= $th_h.__('Shipping date', 'usces').$th_f; |
| 1651 |
if(isset($_REQUEST['check']['status'])) $line .= $th_h.__('Status', 'usces').$th_f; |
| 1652 |
$line .= $th_h.__('Total Amount', 'usces').$th_f; |
| 1653 |
if(isset($_REQUEST['check']['usedpoint'])) $line .= $th_h.__('Used points', 'usces').$th_f; |
| 1654 |
$line .= $th_h.__('Disnount', 'usces').$th_f; |
| 1655 |
$line .= $th_h.__('Shipping', 'usces').$th_f; |
| 1656 |
$line .= $th_h.apply_filters('usces_filter_cod_label', __('COD fee', 'usces')).$th_f; |
| 1657 |
$line .= $th_h.__('consumption tax', 'usces').$th_f; |
| 1658 |
if(isset($_REQUEST['check']['note'])) $line .= $th_h.__('Notes', 'usces').$th_f; |
| 1659 |
if(!empty($csod_meta)) { |
| 1660 |
foreach($csod_meta as $key => $entry) { |
| 1661 |
$name = $entry['name']; |
| 1662 |
//20110208ysk start |
| 1663 |
$csod_key = 'csod_'.$key; |
| 1664 |
//if(isset($_REQUEST['check'][$name])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1665 |
if(isset($_REQUEST['check'][$csod_key])) $line .= $th_h.usces_entity_decode($name, $ext).$th_f; |
| 1666 |
//20110208ysk end |
| 1667 |
} |
| 1668 |
} |
| 1669 |
$line .= apply_filters( 'usces_filter_chk_ord_label_order', NULL, $usces_opt_order, $rows ); |
| 1670 |
$line .= $tr_f.$lf; |
| 1671 |
//========================================================================== |
| 1672 |
foreach((array)$rows as $array) { |
| 1673 |
$order_id = $array['ID']; |
| 1674 |
$query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $order_id); |
| 1675 |
$data = $wpdb->get_row( $query, ARRAY_A ); |
| 1676 |
//$deli = stripslashes_deep(unserialize($data['order_delivery'])); |
| 1677 |
$deli = unserialize($data['order_delivery']); |
| 1678 |
//if(!empty($data)) { |
| 1679 |
// $data = stripslashes_deep($data); |
| 1680 |
//} |
| 1681 |
|
| 1682 |
$line .= $tr_h; |
| 1683 |
$line .= $td_h1.$order_id.$td_f; |
| 1684 |
$line .= $td_h.usces_get_deco_order_id( $order_id ).$td_f; |
| 1685 |
$line .= $td_h.$data['order_date'].$td_f; |
| 1686 |
if(isset($_REQUEST['check']['mem_id'])) $line .= $td_h.$data['mem_id'].$td_f; |
| 1687 |
if(isset($_REQUEST['check']['email'])) $line .= $td_h.usces_entity_decode($data['order_email'], $ext).$td_f; |
| 1688 |
if(!empty($cscs_meta)) { |
| 1689 |
foreach($cscs_meta as $key => $entry) { |
| 1690 |
if($entry['position'] == 'name_pre') { |
| 1691 |
$name = $entry['name']; |
| 1692 |
$cscs_key = 'cscs_'.$key; |
| 1693 |
//20110208ysk start |
| 1694 |
//if(isset($_REQUEST['check'][$name])) { |
| 1695 |
if(isset($_REQUEST['check'][$cscs_key])) { |
| 1696 |
//20110208ysk end |
| 1697 |
$value = maybe_unserialize($usces->get_order_meta_value($cscs_key, $order_id)); |
| 1698 |
if(empty($value)) { |
| 1699 |
$value = ''; |
| 1700 |
} elseif(is_array($value)) { |
| 1701 |
$concatval = ''; |
| 1702 |
$c = ''; |
| 1703 |
foreach($value as $v) { |
| 1704 |
$concatval .= $c.$v; |
| 1705 |
$c = ' '; |
| 1706 |
} |
| 1707 |
$value = $concatval; |
| 1708 |
} |
| 1709 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1710 |
} |
| 1711 |
} |
| 1712 |
} |
| 1713 |
} |
| 1714 |
//20110411ysk start |
| 1715 |
switch($applyform) { |
| 1716 |
case 'JP': |
| 1717 |
$line .= $td_h.usces_entity_decode($data['order_name1'].' '.$data['order_name2'], $ext).$td_f; |
| 1718 |
if(isset($_REQUEST['check']['kana'])) $line .= $td_h.usces_entity_decode($data['order_name3'].' '.$data['order_name4'], $ext).$td_f; |
| 1719 |
break; |
| 1720 |
case 'US': |
| 1721 |
default: |
| 1722 |
$line .= $td_h.usces_entity_decode($data['order_name2'].' '.$data['order_name1'], $ext).$td_f; |
| 1723 |
break; |
| 1724 |
} |
| 1725 |
//20110411ysk end |
| 1726 |
if(!empty($cscs_meta)) { |
| 1727 |
foreach($cscs_meta as $key => $entry) { |
| 1728 |
if($entry['position'] == 'name_after') { |
| 1729 |
$name = $entry['name']; |
| 1730 |
$cscs_key = 'cscs_'.$key; |
| 1731 |
//20110208ysk start |
| 1732 |
//if(isset($_REQUEST['check'][$name])) { |
| 1733 |
if(isset($_REQUEST['check'][$cscs_key])) { |
| 1734 |
//20110208ysk end |
| 1735 |
$value = maybe_unserialize($usces->get_order_meta_value($cscs_key, $order_id)); |
| 1736 |
if(empty($value)) { |
| 1737 |
$value = ''; |
| 1738 |
} elseif(is_array($value)) { |
| 1739 |
$concatval = ''; |
| 1740 |
$c = ''; |
| 1741 |
foreach($value as $v) { |
| 1742 |
$concatval .= $c.$v; |
| 1743 |
$c = ' '; |
| 1744 |
} |
| 1745 |
$value = $concatval; |
| 1746 |
} |
| 1747 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1748 |
} |
| 1749 |
} |
| 1750 |
} |
| 1751 |
} |
| 1752 |
//20110411ysk start |
| 1753 |
$address_info = ''; |
| 1754 |
switch($applyform) { |
| 1755 |
case 'JP': |
| 1756 |
if(isset($_REQUEST['check']['zip'])) $address_info .= $td_h.usces_entity_decode($data['order_zip'], $ext).$td_f; |
| 1757 |
if(isset($_REQUEST['check']['country'])) $address_info .= $td_h.$usces_settings['country'][$usces->get_order_meta_value('customer_country', $order_id)].$td_f; |
| 1758 |
if(isset($_REQUEST['check']['pref'])) $address_info .= $td_h.usces_entity_decode($data['order_pref'], $ext).$td_f; |
| 1759 |
if(isset($_REQUEST['check']['address1'])) $address_info .= $td_h.usces_entity_decode($data['order_address1'], $ext).$td_f; |
| 1760 |
if(isset($_REQUEST['check']['address2'])) $address_info .= $td_h.usces_entity_decode($data['order_address2'], $ext).$td_f; |
| 1761 |
if(isset($_REQUEST['check']['address3'])) $address_info .= $td_h.usces_entity_decode($data['order_address3'], $ext).$td_f; |
| 1762 |
if(isset($_REQUEST['check']['tel'])) $address_info .= $td_h.usces_entity_decode($data['order_tel'], $ext).$td_f; |
| 1763 |
if(isset($_REQUEST['check']['fax'])) $address_info .= $td_h.usces_entity_decode($data['order_fax'], $ext).$td_f; |
| 1764 |
break; |
| 1765 |
case 'US': |
| 1766 |
default: |
| 1767 |
if(isset($_REQUEST['check']['address2'])) $address_info .= $td_h.usces_entity_decode($data['order_address2'], $ext).$td_f; |
| 1768 |
if(isset($_REQUEST['check']['address3'])) $address_info .= $td_h.usces_entity_decode($data['order_address3'], $ext).$td_f; |
| 1769 |
if(isset($_REQUEST['check']['address1'])) $address_info .= $td_h.usces_entity_decode($data['order_address1'], $ext).$td_f; |
| 1770 |
if(isset($_REQUEST['check']['pref'])) $address_info .= $td_h.usces_entity_decode($data['order_pref'], $ext).$td_f; |
| 1771 |
if(isset($_REQUEST['check']['country'])) $address_info .= $td_h.$usces_settings['country'][$usces->get_order_meta_value('customer_country', $order_id)].$td_f; |
| 1772 |
if(isset($_REQUEST['check']['zip'])) $address_info .= $td_h.usces_entity_decode($data['order_zip'], $ext).$td_f; |
| 1773 |
if(isset($_REQUEST['check']['tel'])) $address_info .= $td_h.usces_entity_decode($data['order_tel'], $ext).$td_f; |
| 1774 |
if(isset($_REQUEST['check']['fax'])) $address_info .= $td_h.usces_entity_decode($data['order_fax'], $ext).$td_f; |
| 1775 |
break; |
| 1776 |
} |
| 1777 |
$address_info_args = compact( 'td_h', 'td_f', 'ext', 'order_id', 'applyform' ); |
| 1778 |
$line .= apply_filters( 'usces_filter_ord_csv_address_info', $address_info, $data, $address_info_args ); |
| 1779 |
//20110411ysk end |
| 1780 |
if(!empty($cscs_meta)) { |
| 1781 |
foreach($cscs_meta as $key => $entry) { |
| 1782 |
if($entry['position'] == 'fax_after') { |
| 1783 |
$name = $entry['name']; |
| 1784 |
$cscs_key = 'cscs_'.$key; |
| 1785 |
//20110208ysk start |
| 1786 |
//if(isset($_REQUEST['check'][$name])) { |
| 1787 |
if(isset($_REQUEST['check'][$cscs_key])) { |
| 1788 |
//20110208ysk end |
| 1789 |
$value = maybe_unserialize($usces->get_order_meta_value($cscs_key, $order_id)); |
| 1790 |
if(empty($value)) { |
| 1791 |
$value = ''; |
| 1792 |
} elseif(is_array($value)) { |
| 1793 |
$concatval = ''; |
| 1794 |
$c = ''; |
| 1795 |
foreach($value as $v) { |
| 1796 |
$concatval .= $c.$v; |
| 1797 |
$c = ' '; |
| 1798 |
} |
| 1799 |
$value = $concatval; |
| 1800 |
} |
| 1801 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1802 |
} |
| 1803 |
} |
| 1804 |
} |
| 1805 |
} |
| 1806 |
$line .= apply_filters( 'usces_filter_chk_ord_data_customer', NULL, $usces_opt_order, $order_id, $data ); |
| 1807 |
//---------------------------------------------------------------------- |
| 1808 |
if(!empty($csde_meta)) { |
| 1809 |
foreach($csde_meta as $key => $entry) { |
| 1810 |
if($entry['position'] == 'name_pre') { |
| 1811 |
$name = $entry['name']; |
| 1812 |
$csde_key = 'csde_'.$key; |
| 1813 |
//20110208ysk start |
| 1814 |
//if(isset($_REQUEST['check'][$name])) { |
| 1815 |
if(isset($_REQUEST['check'][$csde_key])) { |
| 1816 |
//20110208ysk end |
| 1817 |
$value = maybe_unserialize($usces->get_order_meta_value($csde_key, $order_id)); |
| 1818 |
if(empty($value)) { |
| 1819 |
$value = ''; |
| 1820 |
} elseif(is_array($value)) { |
| 1821 |
$concatval = ''; |
| 1822 |
$c = ''; |
| 1823 |
foreach($value as $v) { |
| 1824 |
$concatval .= $c.$v; |
| 1825 |
$c = ' '; |
| 1826 |
} |
| 1827 |
$value = $concatval; |
| 1828 |
} |
| 1829 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1830 |
} |
| 1831 |
} |
| 1832 |
} |
| 1833 |
} |
| 1834 |
//20110411ysk start |
| 1835 |
switch($applyform) { |
| 1836 |
case 'JP': |
| 1837 |
if(isset($_REQUEST['check']['delivery_name'])) $line .= $td_h.usces_entity_decode($deli['name1'].' '.$deli['name2'], $ext).$td_f; |
| 1838 |
if(isset($_REQUEST['check']['delivery_kana'])) $line .= $td_h.usces_entity_decode($deli['name3'].' '.$deli['name4'], $ext).$td_f; |
| 1839 |
break; |
| 1840 |
case 'US': |
| 1841 |
default: |
| 1842 |
if(isset($_REQUEST['check']['delivery_name'])) $line .= $td_h.usces_entity_decode($deli['name2'].' '.$deli['name1'], $ext).$td_f; |
| 1843 |
break; |
| 1844 |
} |
| 1845 |
//20110411ysk end |
| 1846 |
if(!empty($csde_meta)) { |
| 1847 |
foreach($csde_meta as $key => $entry) { |
| 1848 |
if($entry['position'] == 'name_after') { |
| 1849 |
$name = $entry['name']."</td>"; |
| 1850 |
$csde_key = 'csde_'.$key; |
| 1851 |
//20110208ysk start |
| 1852 |
//if(isset($_REQUEST['check'][$name])) { |
| 1853 |
if(isset($_REQUEST['check'][$csde_key])) { |
| 1854 |
//20110208ysk end |
| 1855 |
$value = maybe_unserialize($usces->get_order_meta_value($csde_key, $order_id)); |
| 1856 |
if(empty($value)) { |
| 1857 |
$value = ''; |
| 1858 |
} elseif(is_array($value)) { |
| 1859 |
$concatval = ''; |
| 1860 |
$c = ''; |
| 1861 |
foreach($value as $v) { |
| 1862 |
$concatval .= $c.$v; |
| 1863 |
$c = ' '; |
| 1864 |
} |
| 1865 |
$value = $concatval; |
| 1866 |
} |
| 1867 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1868 |
} |
| 1869 |
} |
| 1870 |
} |
| 1871 |
} |
| 1872 |
//20110411ysk start |
| 1873 |
$address_info = ''; |
| 1874 |
switch($applyform) { |
| 1875 |
case 'JP': |
| 1876 |
if(isset($_REQUEST['check']['delivery_zip'])) $address_info .= $td_h.usces_entity_decode($deli['zipcode'], $ext).$td_f; |
| 1877 |
if(isset($_REQUEST['check']['delivery_country'])) $address_info .= $td_h.$usces_settings['country'][$deli['country']].$td_f; |
| 1878 |
if(isset($_REQUEST['check']['delivery_pref'])) $address_info .= $td_h.usces_entity_decode($deli['pref'], $ext).$td_f; |
| 1879 |
if(isset($_REQUEST['check']['delivery_address1'])) $address_info .= $td_h.usces_entity_decode($deli['address1'], $ext).$td_f; |
| 1880 |
if(isset($_REQUEST['check']['delivery_address2'])) $address_info .= $td_h.usces_entity_decode($deli['address2'], $ext).$td_f; |
| 1881 |
if(isset($_REQUEST['check']['delivery_address3'])) $address_info .= $td_h.usces_entity_decode($deli['address3'], $ext).$td_f; |
| 1882 |
if(isset($_REQUEST['check']['delivery_tel'])) $address_info .= $td_h.usces_entity_decode($deli['tel'], $ext).$td_f; |
| 1883 |
if(isset($_REQUEST['check']['delivery_fax'])) $address_info .= $td_h.usces_entity_decode($deli['fax'], $ext).$td_f; |
| 1884 |
break; |
| 1885 |
case 'US': |
| 1886 |
default: |
| 1887 |
if(isset($_REQUEST['check']['delivery_address2'])) $address_info .= $td_h.usces_entity_decode($deli['address2'], $ext).$td_f; |
| 1888 |
if(isset($_REQUEST['check']['delivery_address3'])) $address_info .= $td_h.usces_entity_decode($deli['address3'], $ext).$td_f; |
| 1889 |
if(isset($_REQUEST['check']['delivery_address1'])) $address_info .= $td_h.usces_entity_decode($deli['address1'], $ext).$td_f; |
| 1890 |
if(isset($_REQUEST['check']['delivery_pref'])) $address_info .= $td_h.usces_entity_decode($deli['pref'], $ext).$td_f; |
| 1891 |
if(isset($_REQUEST['check']['delivery_country'])) $address_info .= $td_h.$usces_settings['country'][$deli['country']].$td_f; |
| 1892 |
if(isset($_REQUEST['check']['delivery_zip'])) $address_info .= $td_h.usces_entity_decode($deli['zipcode'], $ext).$td_f; |
| 1893 |
if(isset($_REQUEST['check']['delivery_tel'])) $address_info .= $td_h.usces_entity_decode($deli['tel'], $ext).$td_f; |
| 1894 |
if(isset($_REQUEST['check']['delivery_fax'])) $address_info .= $td_h.usces_entity_decode($deli['fax'], $ext).$td_f; |
| 1895 |
break; |
| 1896 |
} |
| 1897 |
$line .= apply_filters( 'usces_filter_ord_csv_delivery_address_info', $address_info, $deli, $address_info_args ); |
| 1898 |
//20110411ysk end |
| 1899 |
if(!empty($csde_meta)) { |
| 1900 |
foreach($csde_meta as $key => $entry) { |
| 1901 |
if($entry['position'] == 'fax_after') { |
| 1902 |
$name = $entry['name']; |
| 1903 |
$csde_key = 'csde_'.$key; |
| 1904 |
//20110208ysk start |
| 1905 |
//if(isset($_REQUEST['check'][$name])) { |
| 1906 |
if(isset($_REQUEST['check'][$csde_key])) { |
| 1907 |
//20110208ysk end |
| 1908 |
$value = maybe_unserialize($usces->get_order_meta_value($csde_key, $order_id)); |
| 1909 |
if(empty($value)) { |
| 1910 |
$value = ''; |
| 1911 |
} elseif(is_array($value)) { |
| 1912 |
$concatval = ''; |
| 1913 |
$c = ''; |
| 1914 |
foreach($value as $v) { |
| 1915 |
$concatval .= $c.$v; |
| 1916 |
$c = ' '; |
| 1917 |
} |
| 1918 |
$value = $concatval; |
| 1919 |
} |
| 1920 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1921 |
} |
| 1922 |
} |
| 1923 |
} |
| 1924 |
} |
| 1925 |
$line .= apply_filters( 'usces_filter_chk_ord_data_delivery', NULL, $usces_opt_order, $order_id, $deli ); |
| 1926 |
//---------------------------------------------------------------------- |
| 1927 |
if(isset($_REQUEST['check']['shipping_date'])) $line .= $td_h.$data['order_modified'].$td_f; |
| 1928 |
if(isset($_REQUEST['check']['peyment_method'])) $line .= $td_h.$data['order_payment_name'].$td_f; |
| 1929 |
if(isset($_REQUEST['check']['delivery_method'])) { |
| 1930 |
$delivery_method = ''; |
| 1931 |
if(strtoupper($data['order_delivery_method']) == '#NONE#') { |
| 1932 |
$delivery_method = __('No preference', 'usces'); |
| 1933 |
} else { |
| 1934 |
foreach((array)$usces->options['delivery_method'] as $dkey => $delivery) { |
| 1935 |
if($delivery['id'] == $data['order_delivery_method']) { |
| 1936 |
$delivery_method = $delivery['name']; |
| 1937 |
break; |
| 1938 |
} |
| 1939 |
} |
| 1940 |
} |
| 1941 |
$line .= $td_h.$delivery_method.$td_f; |
| 1942 |
} |
| 1943 |
//20101208ysk start |
| 1944 |
if(isset($_REQUEST['check']['delivery_date'])) $line .= $td_h.$data['order_delivery_date'].$td_f; |
| 1945 |
//20101208ysk end |
| 1946 |
if(isset($_REQUEST['check']['delivery_time'])) $line .= $td_h.$data['order_delivery_time'].$td_f; |
| 1947 |
if(isset($_REQUEST['check']['delidue_date'])) { |
| 1948 |
$order_delidue_date = (strtoupper($data['order_delidue_date']) == '#NONE#') ? '' : $data['order_delidue_date']; |
| 1949 |
$line .= $td_h.$order_delidue_date.$td_f; |
| 1950 |
} |
| 1951 |
if(isset($_REQUEST['check']['status'])) { |
| 1952 |
$order_status = explode(',', $data['order_status']); |
| 1953 |
$status = ''; |
| 1954 |
foreach( (array)$order_status as $os) { |
| 1955 |
if( isset($usces_management_status[$os]) ) |
| 1956 |
$status .= $usces_management_status[$os].$sp; |
| 1957 |
} |
| 1958 |
$line .= $td_h.trim($status, $sp).$td_f; |
| 1959 |
} |
| 1960 |
$line .= $td_h.usces_crform($array['total_price'], false, false, 'return', false).$td_f; |
| 1961 |
if(isset($_REQUEST['check']['usedpoint'])) $line .= $td_h.$data['order_usedpoint'].$td_f; |
| 1962 |
$line .= $td_h.$data['order_discount'].$td_f; |
| 1963 |
$line .= $td_h.$data['order_shipping_charge'].$td_f; |
| 1964 |
$line .= $td_h.$data['order_cod_fee'].$td_f; |
| 1965 |
$line .= $td_h.$data['order_tax'].$td_f; |
| 1966 |
if(isset($_REQUEST['check']['note'])) $line .= $td_h.usces_entity_decode($data['order_note'], $ext).$td_f; |
| 1967 |
if(!empty($csod_meta)) { |
| 1968 |
foreach($csod_meta as $key => $entry) { |
| 1969 |
$name = $entry['name']; |
| 1970 |
$csod_key = 'csod_'.$key; |
| 1971 |
//20110208ysk start |
| 1972 |
//if(isset($_REQUEST['check'][$name])) { |
| 1973 |
if(isset($_REQUEST['check'][$csod_key])) { |
| 1974 |
//20110208ysk end |
| 1975 |
$value = maybe_unserialize($usces->get_order_meta_value($csod_key, $order_id)); |
| 1976 |
if(empty($value)) { |
| 1977 |
$value = ''; |
| 1978 |
} elseif(is_array($value)) { |
| 1979 |
$concatval = ''; |
| 1980 |
$c = ''; |
| 1981 |
foreach($value as $v) { |
| 1982 |
$concatval .= $c.$v; |
| 1983 |
$c = ' '; |
| 1984 |
} |
| 1985 |
$value = $concatval; |
| 1986 |
} |
| 1987 |
$line .= $td_h.usces_entity_decode($value, $ext).$td_f; |
| 1988 |
} |
| 1989 |
} |
| 1990 |
} |
| 1991 |
$line .= apply_filters( 'usces_filter_chk_ord_data_order', NULL, $usces_opt_order, $order_id, $data ); |
| 1992 |
$line .= $tr_f.$lf; |
| 1993 |
} |
| 1994 |
$line .= $table_f.$lf; |
| 1995 |
//========================================================================== |
| 1996 |
|
| 1997 |
if($ext == 'xls') { |
| 1998 |
header("Content-Type: application/vnd.ms-excel; charset=Shift-JIS"); |
| 1999 |
} elseif($ext == 'csv') { |
| 2000 |
header("Content-Type: application/octet-stream"); |
| 2001 |
} |
| 2002 |
header("Content-Disposition: attachment; filename=usces_order_list.".$ext); |
| 2003 |
mb_http_output('pass'); |
| 2004 |
print(mb_convert_encoding($line, "SJIS-win", "UTF-8")); |
| 2005 |
exit(); |
| 2006 |
} |
| 2007 |
|
| 2008 |
function usces_entity_decode($str, $ftype) { |
| 2009 |
$pos = strpos($str, '&'); |
| 2010 |
if($pos !== false) |
| 2011 |
$str = htmlspecialchars_decode($str); |
| 2012 |
|
| 2013 |
if($ftype == 'csv') |
| 2014 |
$str = str_replace('"', '""', $str); |
| 2015 |
|
| 2016 |
return $str; |
| 2017 |
} |
| 2018 |
|
| 2019 |
function usces_is_entity($entity){ |
| 2020 |
$temp = substr($entity, 0, 1); |
| 2021 |
$temp .= substr($entity, -1, 1); |
| 2022 |
if ($temp != '&;') |
| 2023 |
return false; |
| 2024 |
else |
| 2025 |
return true; |
| 2026 |
} |
| 2027 |
|
| 2028 |
function usces_p( $var ){ |
| 2029 |
echo '<pre>' . print_r($var, true) . '</pre>'; |
| 2030 |
} |
| 2031 |
|
| 2032 |
function usces_get_key( $digit ){ |
| 2033 |
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
| 2034 |
$max = strlen($chars) - 1; |
| 2035 |
$str = ''; |
| 2036 |
for($i=0; $i<$digit; $i++){ |
| 2037 |
$str .= $chars[mt_rand(0, $max)]; |
| 2038 |
} |
| 2039 |
return $str; |
| 2040 |
} |
| 2041 |
?> |