| 1 |
<?php |
| 2 |
// member list download |
| 3 |
function usces_download_member_list() { |
| 4 |
|
| 5 |
if ( ! usces_admin_user_can_download_list() ) { |
| 6 |
exit(); |
| 7 |
} |
| 8 |
|
| 9 |
require_once( USCES_PLUGIN_DIR."/classes/dataList.class.php" ); |
| 10 |
global $wpdb, $usces; |
| 11 |
global $usces_settings; |
| 12 |
|
| 13 |
$ext = $_REQUEST['ftype']; |
| 14 |
if( $ext == 'csv' ) {//CSV |
| 15 |
$table_h = ""; |
| 16 |
$table_f = ""; |
| 17 |
$tr_h = ""; |
| 18 |
$tr_f = ""; |
| 19 |
$th_h1 = '"'; |
| 20 |
$th_h = ',"'; |
| 21 |
$th_f = '"'; |
| 22 |
$td_h1 = '"'; |
| 23 |
$td_h = ',"'; |
| 24 |
$td_f = '"'; |
| 25 |
$lf = "\n"; |
| 26 |
} else { |
| 27 |
exit(); |
| 28 |
} |
| 29 |
|
| 30 |
$csmb_meta = usces_has_custom_field_meta( 'member' ); |
| 31 |
$applyform = usces_get_apply_addressform( $usces->options['system']['addressform'] ); |
| 32 |
|
| 33 |
//========================================================================== |
| 34 |
|
| 35 |
$usces_opt_member = get_option( 'usces_opt_member' ); |
| 36 |
if( !is_array( $usces_opt_member ) ) { |
| 37 |
$usces_opt_member = array(); |
| 38 |
} |
| 39 |
$usces_opt_member['ftype_mem'] = $ext; |
| 40 |
$chk_mem = array(); |
| 41 |
$chk_mem['ID'] = 1; |
| 42 |
$chk_mem['email'] = ( isset( $_REQUEST['check']['email'] ) ) ? 1 : 0; |
| 43 |
if( !empty( $csmb_meta ) ) { |
| 44 |
foreach( $csmb_meta as $key => $entry ) { |
| 45 |
if( $entry['position'] == 'name_pre' ) { |
| 46 |
$name = $entry['name']; |
| 47 |
$csmb_key = 'csmb_'.$key; |
| 48 |
$chk_mem[$csmb_key] = ( isset( $_REQUEST['check'][$csmb_key] ) ) ? 1 : 0; |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
$chk_mem['name'] = 1; |
| 53 |
if( $applyform == 'JP' ) { |
| 54 |
$chk_mem['kana'] = ( isset( $_REQUEST['check']['kana'] ) ) ? 1 : 0; |
| 55 |
} |
| 56 |
if( !empty( $csmb_meta ) ) { |
| 57 |
foreach( $csmb_meta as $key => $entry ) { |
| 58 |
if( $entry['position'] == 'name_after' ) { |
| 59 |
$name = $entry['name']; |
| 60 |
$csmb_key = 'csmb_'.$key; |
| 61 |
$chk_mem[$csmb_key] = ( isset( $_REQUEST['check'][$csmb_key] ) ) ? 1 : 0; |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
$chk_mem['zip'] = ( isset( $_REQUEST['check']['zip'] ) ) ? 1 : 0; |
| 66 |
$chk_mem['country'] = ( isset( $_REQUEST['check']['country'] ) ) ? 1 : 0; |
| 67 |
$chk_mem['pref'] = ( isset( $_REQUEST['check']['pref'] ) ) ? 1 : 0; |
| 68 |
$chk_mem['address1'] = ( isset( $_REQUEST['check']['address1'] ) ) ? 1 : 0; |
| 69 |
$chk_mem['address2'] = ( isset( $_REQUEST['check']['address2'] ) ) ? 1 : 0; |
| 70 |
$chk_mem['address3'] = ( isset( $_REQUEST['check']['address3'] ) ) ? 1 : 0; |
| 71 |
$chk_mem['tel'] = ( isset( $_REQUEST['check']['tel'] ) ) ? 1 : 0; |
| 72 |
$chk_mem['fax'] = ( isset( $_REQUEST['check']['fax'] ) ) ? 1 : 0; |
| 73 |
if( !empty( $csmb_meta ) ) { |
| 74 |
foreach( $csmb_meta as $key => $entry ) { |
| 75 |
if( $entry['position'] == 'fax_after' ) { |
| 76 |
$name = $entry['name']; |
| 77 |
$csmb_key = 'csmb_'.$key; |
| 78 |
$chk_mem[$csmb_key] = ( isset( $_REQUEST['check'][$csmb_key] ) ) ? 1 : 0; |
| 79 |
} |
| 80 |
} |
| 81 |
} |
| 82 |
$chk_mem['date'] = ( isset( $_REQUEST['check']['date'] ) ) ? 1 : 0; |
| 83 |
$chk_mem['point'] = ( isset( $_REQUEST['check']['point'] ) ) ? 1 : 0; |
| 84 |
$chk_mem['rank'] = ( isset( $_REQUEST['check']['rank'] ) ) ? 1 : 0; |
| 85 |
$usces_opt_member['chk_mem'] = apply_filters( 'usces_filter_chk_mem', $chk_mem ); |
| 86 |
update_option( 'usces_opt_member', $usces_opt_member ); |
| 87 |
|
| 88 |
//========================================================================== |
| 89 |
|
| 90 |
$_REQUEST['searchIn'] = "searchIn"; |
| 91 |
$usces_member_table = usces_get_tablename( 'usces_member' ); |
| 92 |
$arr_column = array( |
| 93 |
__( 'membership number', 'usces' ) => 'ID', |
| 94 |
__( 'name', 'usces' ) => 'name', |
| 95 |
__( 'Address', 'usces' ) => 'address', |
| 96 |
__( 'Phone number', 'usces' ) => 'tel', |
| 97 |
__( 'e-mail', 'usces' ) => 'email', |
| 98 |
__( 'Strated date', 'usces' ) => 'date', |
| 99 |
__( 'current point', 'usces' ) => 'point' ); |
| 100 |
$DT = new dataList( $usces_member_table, $arr_column ); |
| 101 |
$DT->pageLimit = 'off'; |
| 102 |
$res = $DT->MakeTable(); |
| 103 |
$rows = $DT->rows; |
| 104 |
|
| 105 |
if ( ! empty( $_REQUEST['listcheck'] ) ) { |
| 106 |
$listcheck = ( is_array( $_REQUEST['listcheck'] ) ) ? $_REQUEST['listcheck'] : explode( ',', $_REQUEST['listcheck'] ); |
| 107 |
$rows = array_filter( $rows, function( $row ) use ( $listcheck ) { |
| 108 |
return in_array( (int)$row['ID'], array_map( 'intval', $listcheck ), true ); |
| 109 |
} ); |
| 110 |
} |
| 111 |
|
| 112 |
//========================================================================== |
| 113 |
|
| 114 |
$line = $table_h; |
| 115 |
$line .= $tr_h; |
| 116 |
$line .= $th_h1.__( 'membership number', 'usces' ).$th_f; |
| 117 |
if( isset( $_REQUEST['check']['email'] ) ) $line .= $th_h.__( 'e-mail', 'usces' ).$th_f; |
| 118 |
if( !empty( $csmb_meta ) ) { |
| 119 |
foreach( $csmb_meta as $key => $entry ) { |
| 120 |
if( $entry['position'] == 'name_pre' ) { |
| 121 |
$name = $entry['name']; |
| 122 |
$csmb_key = 'csmb_'.$key; |
| 123 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 124 |
} |
| 125 |
} |
| 126 |
} |
| 127 |
$line .= $th_h.__( 'name', 'usces' ).$th_f; |
| 128 |
if( $applyform == 'JP' ) { |
| 129 |
if( isset( $_REQUEST['check']['kana'] ) ) $line .= $th_h.__( 'furigana', 'usces' ).$th_f; |
| 130 |
} |
| 131 |
if( !empty( $csmb_meta ) ) { |
| 132 |
foreach( $csmb_meta as $key => $entry ) { |
| 133 |
if( $entry['position'] == 'name_after' ) { |
| 134 |
$name = $entry['name']; |
| 135 |
$csmb_key = 'csmb_'.$key; |
| 136 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 137 |
} |
| 138 |
} |
| 139 |
} |
| 140 |
switch( $applyform ) { |
| 141 |
case 'JP': |
| 142 |
if( isset( $_REQUEST['check']['zip'] ) ) $line .= $th_h.__( 'Zip/Postal Code', 'usces' ).$th_f; |
| 143 |
if( isset( $_REQUEST['check']['country'] ) ) $line .= $th_h.__( 'Country', 'usces' ).$th_f; |
| 144 |
if( isset( $_REQUEST['check']['pref'] ) ) $line .= $th_h.__( 'Province', 'usces' ).$th_f; |
| 145 |
if( isset( $_REQUEST['check']['address1'] ) ) $line .= $th_h.__( 'city', 'usces' ).$th_f; |
| 146 |
if( isset( $_REQUEST['check']['address2'] ) ) $line .= $th_h.__( 'numbers', 'usces' ).$th_f; |
| 147 |
if( isset( $_REQUEST['check']['address3'] ) ) $line .= $th_h.__( 'building name', 'usces' ).$th_f; |
| 148 |
if( isset( $_REQUEST['check']['tel'] ) ) $line .= $th_h.__( 'Phone number', 'usces' ).$th_f; |
| 149 |
if( isset( $_REQUEST['check']['fax'] ) ) $line .= $th_h.__( 'FAX number', 'usces' ).$th_f; |
| 150 |
break; |
| 151 |
case 'US': |
| 152 |
default: |
| 153 |
if( isset( $_REQUEST['check']['address2'] ) ) $line .= $th_h.__( 'Address Line1', 'usces' ).$th_f; |
| 154 |
if( isset( $_REQUEST['check']['address3'] ) ) $line .= $th_h.__( 'Address Line2', 'usces' ).$th_f; |
| 155 |
if( isset( $_REQUEST['check']['address1'] ) ) $line .= $th_h.__( 'city', 'usces' ).$th_f; |
| 156 |
if( isset( $_REQUEST['check']['pref'] ) ) $line .= $th_h.__( 'State', 'usces' ).$th_f; |
| 157 |
if( isset( $_REQUEST['check']['country'] ) ) $line .= $th_h.__( 'Country', 'usces' ).$th_f; |
| 158 |
if( isset( $_REQUEST['check']['zip'] ) ) $line .= $th_h.__( 'Zip', 'usces' ).$th_f; |
| 159 |
if( isset( $_REQUEST['check']['tel'] ) ) $line .= $th_h.__( 'Phone number', 'usces' ).$th_f; |
| 160 |
if( isset( $_REQUEST['check']['fax'] ) ) $line .= $th_h.__( 'FAX number', 'usces' ).$th_f; |
| 161 |
break; |
| 162 |
} |
| 163 |
if( !empty( $csmb_meta ) ) { |
| 164 |
foreach( $csmb_meta as $key => $entry ) { |
| 165 |
if( $entry['position'] == 'fax_after' ) { |
| 166 |
$name = $entry['name']; |
| 167 |
$csmb_key = 'csmb_'.$key; |
| 168 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 169 |
} |
| 170 |
} |
| 171 |
} |
| 172 |
if( isset( $_REQUEST['check']['date'] ) ) $line .= $th_h.__( 'Strated date', 'usces' ).$th_f; |
| 173 |
if( isset( $_REQUEST['check']['point'] ) ) $line .= $th_h.__( 'current point', 'usces' ).$th_f; |
| 174 |
if( isset( $_REQUEST['check']['rank'] ) ) $line .= $th_h.__( 'Rank', 'usces' ).$th_f; |
| 175 |
$line .= apply_filters( 'usces_filter_chk_mem_label', NULL, $usces_opt_member, $rows ); |
| 176 |
$line .= $tr_f.$lf; |
| 177 |
|
| 178 |
//========================================================================== |
| 179 |
|
| 180 |
foreach( (array)$rows as $array ) { |
| 181 |
$member_id = $array['ID']; |
| 182 |
$query = $wpdb->prepare( "SELECT * FROM $usces_member_table WHERE ID = %d", $member_id ); |
| 183 |
$data = $wpdb->get_row( $query, ARRAY_A ); |
| 184 |
|
| 185 |
$line .= $tr_h; |
| 186 |
$line .= $td_h1.$member_id.$td_f; |
| 187 |
if( isset( $_REQUEST['check']['email'] ) ) $line .= $td_h.usces_entity_decode( $array['email'], $ext ).$td_f; |
| 188 |
if( !empty( $csmb_meta ) ) { |
| 189 |
foreach( $csmb_meta as $key => $entry ) { |
| 190 |
if( $entry['position'] == 'name_pre' ) { |
| 191 |
$name = $entry['name']; |
| 192 |
$csmb_key = 'csmb_'.$key; |
| 193 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) { |
| 194 |
$value = wel_safe_maybe_unserialize( $usces->get_member_meta_value( $csmb_key, $member_id ) ); |
| 195 |
if( empty( $value ) ) { |
| 196 |
$value = ''; |
| 197 |
} elseif( is_array( $value ) ) { |
| 198 |
$concatval = ''; |
| 199 |
$c = ''; |
| 200 |
foreach( $value as $v ) { |
| 201 |
$concatval .= $c.$v; |
| 202 |
$c = ' '; |
| 203 |
} |
| 204 |
$value = $concatval; |
| 205 |
} |
| 206 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 207 |
} |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
switch( $applyform ) { |
| 213 |
case 'JP': |
| 214 |
$line .= $td_h.usces_entity_decode( $data['mem_name1'].' '.$data['mem_name2'], $ext ).$td_f; |
| 215 |
if( isset( $_REQUEST['check']['kana'] ) ) $line .= $td_h.usces_entity_decode( $data['mem_name3'].' '.$data['mem_name4'], $ext ).$td_f; |
| 216 |
break; |
| 217 |
case 'US': |
| 218 |
default: |
| 219 |
$line .= $td_h.usces_entity_decode( $data['mem_name2'].' '.$data['mem_name1'], $ext ).$td_f; |
| 220 |
break; |
| 221 |
} |
| 222 |
|
| 223 |
if( !empty( $csmb_meta ) ) { |
| 224 |
foreach( $csmb_meta as $key => $entry ) { |
| 225 |
if( $entry['position'] == 'name_after' ) { |
| 226 |
$name = $entry['name']; |
| 227 |
$csmb_key = 'csmb_'.$key; |
| 228 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) { |
| 229 |
$value = wel_safe_maybe_unserialize( $usces->get_member_meta_value( $csmb_key, $member_id ) ); |
| 230 |
if( empty( $value ) ) { |
| 231 |
$value = ''; |
| 232 |
} elseif( is_array( $value ) ) { |
| 233 |
$concatval = ''; |
| 234 |
$c = ''; |
| 235 |
foreach( $value as $v ) { |
| 236 |
$concatval .= $c.$v; |
| 237 |
$c = ' '; |
| 238 |
} |
| 239 |
$value = $concatval; |
| 240 |
} |
| 241 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 242 |
} |
| 243 |
} |
| 244 |
} |
| 245 |
} |
| 246 |
|
| 247 |
$address_info = ''; |
| 248 |
switch( $applyform ) { |
| 249 |
case 'JP': |
| 250 |
if( isset( $_REQUEST['check']['zip'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_zip'], $ext ).$td_f; |
| 251 |
if( isset( $_REQUEST['check']['country'] ) ) $address_info .= $td_h.$usces_settings['country'][$usces->get_member_meta_value( 'customer_country', $member_id )].$td_f; |
| 252 |
if( isset( $_REQUEST['check']['pref'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_pref'], $ext ).$td_f; |
| 253 |
if( isset( $_REQUEST['check']['address1'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address1'], $ext ).$td_f; |
| 254 |
if( isset( $_REQUEST['check']['address2'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address2'], $ext ).$td_f; |
| 255 |
if( isset( $_REQUEST['check']['address3'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address3'], $ext ).$td_f; |
| 256 |
if( isset( $_REQUEST['check']['tel'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_tel'], $ext ).$td_f; |
| 257 |
if( isset( $_REQUEST['check']['fax'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_fax'], $ext ).$td_f; |
| 258 |
break; |
| 259 |
case 'US': |
| 260 |
default: |
| 261 |
if( isset( $_REQUEST['check']['address2'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address2'], $ext ).$td_f; |
| 262 |
if( isset( $_REQUEST['check']['address3'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address3'], $ext ).$td_f; |
| 263 |
if( isset( $_REQUEST['check']['address1'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_address1'], $ext ).$td_f; |
| 264 |
if( isset( $_REQUEST['check']['pref'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_pref'], $ext ).$td_f; |
| 265 |
if( isset( $_REQUEST['check']['country'] ) ) $address_info .= $td_h.$usces_settings['country'][$usces->get_member_meta_value( 'customer_country', $member_id )].$td_f; |
| 266 |
if( isset( $_REQUEST['check']['zip'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_zip'], $ext ).$td_f; |
| 267 |
if( isset( $_REQUEST['check']['tel'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_tel'], $ext ).$td_f; |
| 268 |
if( isset( $_REQUEST['check']['fax'] ) ) $address_info .= $td_h.usces_entity_decode( $data['mem_fax'], $ext ).$td_f; |
| 269 |
break; |
| 270 |
} |
| 271 |
$address_info_args = compact( 'td_h', 'td_f', 'ext', 'member_id', 'applyform' ); |
| 272 |
$line .= apply_filters( 'usces_filter_mem_csv_address_info', $address_info, $data, $address_info_args ); |
| 273 |
|
| 274 |
if( !empty( $csmb_meta ) ) { |
| 275 |
foreach( $csmb_meta as $key => $entry ) { |
| 276 |
if( $entry['position'] == 'fax_after' ) { |
| 277 |
$name = $entry['name']; |
| 278 |
$csmb_key = 'csmb_'.$key; |
| 279 |
if( isset( $_REQUEST['check'][$csmb_key] ) ) { |
| 280 |
$value = wel_safe_maybe_unserialize( $usces->get_member_meta_value( $csmb_key, $member_id ) ); |
| 281 |
if( empty( $value ) ) { |
| 282 |
$value = ''; |
| 283 |
} elseif( is_array( $value ) ) { |
| 284 |
$concatval = ''; |
| 285 |
$c = ''; |
| 286 |
foreach( $value as $v ) { |
| 287 |
$concatval .= $c.$v; |
| 288 |
$c = ' '; |
| 289 |
} |
| 290 |
$value = $concatval; |
| 291 |
} |
| 292 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 293 |
} |
| 294 |
} |
| 295 |
} |
| 296 |
} |
| 297 |
if( isset( $_REQUEST['check']['date'] ) ) $line .= $td_h.$data['mem_registered'].$td_f; |
| 298 |
if( isset( $_REQUEST['check']['point'] ) ) $line .= $td_h.$data['mem_point'].$td_f; |
| 299 |
if( isset( $_REQUEST['check']['rank'] ) ) { |
| 300 |
$rank = ''; |
| 301 |
foreach( (array)$usces->member_status as $rk => $rv ) { |
| 302 |
if( $rk == $data['mem_status'] ) { |
| 303 |
$rank = $rv; |
| 304 |
break; |
| 305 |
} |
| 306 |
} |
| 307 |
$line .= $td_h.$rank.$td_f; |
| 308 |
} |
| 309 |
$line .= apply_filters( 'usces_filter_chk_mem_data', NULL, $usces_opt_member, $member_id, $data ); |
| 310 |
$line .= $tr_f.$lf; |
| 311 |
} |
| 312 |
$line .= $table_f.$lf; |
| 313 |
|
| 314 |
//========================================================================== |
| 315 |
|
| 316 |
header( "Content-Type: application/octet-stream" ); |
| 317 |
header( "Content-Disposition: attachment; filename=usces_member_list.".$ext ); |
| 318 |
mb_http_output( 'pass' ); |
| 319 |
print( mb_convert_encoding( $line, apply_filters( 'usces_filter_output_csv_encode', 'SJIS-win' ), "UTF-8" ) ); |
| 320 |
exit(); |
| 321 |
} |
| 322 |
|
| 323 |
// product list download |
| 324 |
function usces_download_product_list() { |
| 325 |
|
| 326 |
require_once( USCES_PLUGIN_DIR . "/classes/orderList.class.php" ); |
| 327 |
global $wpdb, $usces; |
| 328 |
|
| 329 |
$ext = $_REQUEST['ftype']; |
| 330 |
if( $ext == 'csv' ) {//CSV |
| 331 |
$table_h = ""; |
| 332 |
$table_f = ""; |
| 333 |
$tr_h = ""; |
| 334 |
$tr_f = ""; |
| 335 |
$th_h1 = '"'; |
| 336 |
$th_h = ',"'; |
| 337 |
$th_f = '"'; |
| 338 |
$td_h1 = '"'; |
| 339 |
$td_h = ',"'; |
| 340 |
$td_f = '"'; |
| 341 |
$sp = ":"; |
| 342 |
$nb = " "; |
| 343 |
$lf = "\n"; |
| 344 |
} else { |
| 345 |
exit(); |
| 346 |
} |
| 347 |
|
| 348 |
//========================================================================== |
| 349 |
|
| 350 |
$usces_opt_order = get_option( 'usces_opt_order' ); |
| 351 |
if( !is_array( $usces_opt_order ) ) { |
| 352 |
$usces_opt_order = array(); |
| 353 |
} |
| 354 |
$usces_opt_order['ftype_pro'] = $ext; |
| 355 |
$chk_pro = array(); |
| 356 |
$chk_pro['ID'] = 1; |
| 357 |
$chk_pro['deco_id'] = ( isset( $_REQUEST['check']['deco_id'] ) ) ? 1 : 0; |
| 358 |
$chk_pro['date'] = ( isset( $_REQUEST['check']['date'] ) ) ? 1 : 0; |
| 359 |
$chk_pro['mem_id'] = ( isset( $_REQUEST['check']['mem_id'] ) ) ? 1 : 0; |
| 360 |
$chk_pro['name'] = ( isset( $_REQUEST['check']['name'] ) ) ? 1 : 0; |
| 361 |
$chk_pro['delivery_method'] = ( isset( $_REQUEST['check']['delivery_method'] ) ) ? 1 : 0; |
| 362 |
$chk_pro['shipping_date'] = ( isset( $_REQUEST['check']['shipping_date'] ) ) ? 1 : 0; |
| 363 |
$chk_pro['item_code'] = 1; |
| 364 |
$chk_pro['sku_code'] = 1; |
| 365 |
$chk_pro['item_name'] = ( isset( $_REQUEST['check']['item_name'] ) ) ? 1 : 0; |
| 366 |
$chk_pro['sku_name'] = ( isset( $_REQUEST['check']['sku_name'] ) ) ? 1 : 0; |
| 367 |
$chk_pro['options'] = ( isset( $_REQUEST['check']['options'] ) ) ? 1 : 0; |
| 368 |
$chk_pro['quantity'] = 1; |
| 369 |
$chk_pro['price'] = 1; |
| 370 |
$chk_pro['unit'] = ( isset( $_REQUEST['check']['unit'] ) ) ? 1 : 0; |
| 371 |
$usces_opt_order['chk_pro'] = apply_filters( 'usces_filter_chk_pro', $chk_pro ); |
| 372 |
update_option( 'usces_opt_order', $usces_opt_order ); |
| 373 |
|
| 374 |
//========================================================================== |
| 375 |
|
| 376 |
$_REQUEST['searchIn'] = "searchIn"; |
| 377 |
$usces_order_table = $wpdb->prefix."usces_order"; |
| 378 |
$usces_ordercart_table = $wpdb->prefix."usces_ordercart"; |
| 379 |
$usces_ordercart_meta_table = $wpdb->prefix."usces_ordercart_meta"; |
| 380 |
|
| 381 |
$arr_column = array( |
| 382 |
__( 'ID', 'usces' ) => 'ID', |
| 383 |
__( 'Order number', 'usces' ) => 'deco_id', |
| 384 |
__( 'date', 'usces' ) => 'date', |
| 385 |
__( 'membership number', 'usces' ) => 'mem_id', |
| 386 |
__( 'name', 'usces' ) => 'name', |
| 387 |
__( 'Region', 'usces' ) => 'pref', |
| 388 |
__( 'shipping option', 'usces' ) => 'delivery_method', |
| 389 |
__( 'Amount', 'usces' ) => 'total_price', |
| 390 |
__( 'payment method', 'usces' ) => 'payment_name', |
| 391 |
__( 'transfer statement', 'usces' ) => 'receipt_status', |
| 392 |
__( 'Processing', 'usces' ) => 'order_status', |
| 393 |
__( 'shpping date', 'usces' ) => 'order_modified' ); |
| 394 |
$DT = new dataList( $usces_order_table, $arr_column ); |
| 395 |
$DT->pageLimit = 'off'; |
| 396 |
$res = $DT->MakeTable(); |
| 397 |
$rows = $DT->rows; |
| 398 |
|
| 399 |
if ( ! empty( $_REQUEST['listcheck'] ) ) { |
| 400 |
$listcheck = ( is_array( $_REQUEST['listcheck'] ) ) ? $_REQUEST['listcheck'] : explode( ',', $_REQUEST['listcheck'] ); |
| 401 |
$rows = array_filter( $rows, function( $row ) use ( $listcheck ) { |
| 402 |
return in_array( (int)$row['ID'], array_map( 'intval', $listcheck ), true ); |
| 403 |
} ); |
| 404 |
} |
| 405 |
|
| 406 |
//========================================================================== |
| 407 |
|
| 408 |
$line = $table_h; |
| 409 |
$line .= $tr_h; |
| 410 |
$line .= $th_h1.__( 'ID', 'usces' ).$th_f; |
| 411 |
if( isset( $_REQUEST['check']['deco_id'] ) ) $line .= $th_h.__( 'Order number', 'usces' ).$th_f; |
| 412 |
if( isset( $_REQUEST['check']['date'] ) ) $line .= $th_h.__( 'order date', 'usces' ).$th_f; |
| 413 |
if( isset( $_REQUEST['check']['mem_id'] ) ) $line .= $th_h.__( 'membership number', 'usces' ).$th_f; |
| 414 |
if( isset( $_REQUEST['check']['name'] ) ) $line .= $th_h.__( 'name', 'usces' ).$th_f; |
| 415 |
if( isset( $_REQUEST['check']['delivery_method'] ) ) $line .= $th_h.__( 'shipping option', 'usces' ).$th_f; |
| 416 |
if( isset( $_REQUEST['check']['shipping_date'] ) ) $line .= $th_h.__( 'shpping date', 'usces' ).$th_f; |
| 417 |
$line .= apply_filters( 'usces_filter_chk_pro_label_head', NULL, $usces_opt_order, $rows ); |
| 418 |
$line .= $th_h.__( 'item code', 'usces' ).$th_f; |
| 419 |
$line .= $th_h.__( 'SKU code', 'usces' ).$th_f; |
| 420 |
if( isset( $_REQUEST['check']['item_name'] ) ) $line .= $th_h.__( 'item name', 'usces' ).$th_f; |
| 421 |
if( isset( $_REQUEST['check']['sku_name'] ) ) $line .= $th_h.__( 'SKU display name ', 'usces' ).$th_f; |
| 422 |
if( isset( $_REQUEST['check']['options'] ) ) $line .= $th_h.__( 'options for items', 'usces' ).$th_f; |
| 423 |
$line .= $th_h.__( 'Quantity', 'usces' ).$th_f; |
| 424 |
$line .= $th_h.__( 'Unit price', 'usces' ).$th_f; |
| 425 |
if( isset( $_REQUEST['check']['unit'] ) ) $line .= $th_h.__( 'unit', 'usces' ).$th_f; |
| 426 |
$line .= apply_filters( 'usces_filter_chk_pro_label_detail', NULL, $usces_opt_order, $rows ); |
| 427 |
$line .= $tr_f.$lf; |
| 428 |
|
| 429 |
//========================================================================== |
| 430 |
|
| 431 |
foreach( (array)$rows as $array ) { |
| 432 |
$order_id = $array['ID']; |
| 433 |
$query = $wpdb->prepare( "SELECT * FROM $usces_ordercart_table WHERE order_id = %d", $order_id ); |
| 434 |
$cart = $wpdb->get_results( $query, ARRAY_A ); |
| 435 |
foreach( $cart as $cart_row ) { |
| 436 |
$line .= $tr_h; |
| 437 |
$line .= $td_h1.$order_id.$td_f; |
| 438 |
if( isset( $_REQUEST['check']['deco_id'] ) ) $line .= $td_h.$array['deco_id'].$td_f; |
| 439 |
|
| 440 |
if( isset( $_REQUEST['check']['date'] ) ) $line .= $td_h.$array['date'].$td_f; |
| 441 |
if( isset( $_REQUEST['check']['mem_id'] ) ) $line .= $td_h.$array['mem_id'].$td_f; |
| 442 |
if( isset( $_REQUEST['check']['name'] ) ) $line .= $td_h.usces_entity_decode( $array['name'], $ext ).$td_f; |
| 443 |
if( isset( $_REQUEST['check']['delivery_method'] ) ) { |
| 444 |
$delivery_method = ''; |
| 445 |
if( strtoupper( $array['delivery_method'] ) == '#NONE#' ) { |
| 446 |
$delivery_method = __( 'No preference', 'usces' ); |
| 447 |
} else { |
| 448 |
foreach( (array)$usces->options['delivery_method'] as $dkey => $delivery ) { |
| 449 |
if( $delivery['id'] == $array['delivery_method'] ) { |
| 450 |
$delivery_method = $delivery['name']; |
| 451 |
break; |
| 452 |
} |
| 453 |
} |
| 454 |
} |
| 455 |
$line .= $td_h.$delivery_method.$td_f; |
| 456 |
} |
| 457 |
if( isset( $_REQUEST['check']['shipping_date'] ) ) $line .= $td_h.$array['order_modified'].$td_f; |
| 458 |
$line .= apply_filters( 'usces_filter_chk_pro_data_head', NULL, $usces_opt_order, $array, $cart_row ); |
| 459 |
|
| 460 |
$line .= $td_h.$cart_row['item_code'].$td_f; |
| 461 |
$line .= $td_h.$cart_row['sku_code'].$td_f; |
| 462 |
if( isset( $_REQUEST['check']['item_name'] ) ) $line .= $td_h.usces_entity_decode( $cart_row['item_name'], $ext ).$td_f; |
| 463 |
if( isset( $_REQUEST['check']['sku_name'] ) ) $line .= $td_h.usces_entity_decode( $cart_row['sku_name'], $ext ).$td_f; |
| 464 |
if( isset( $_REQUEST['check']['options'] ) ) { |
| 465 |
$query = $wpdb->prepare( "SELECT * FROM $usces_ordercart_meta_table WHERE cart_id = %d AND meta_type = %s ORDER BY cartmeta_id", $cart_row['cart_id'], 'option' ); |
| 466 |
$options = $wpdb->get_results( $query, ARRAY_A ); |
| 467 |
$optstr = ''; |
| 468 |
if( $options && is_array( $options ) && count( $options ) > 0 ) { |
| 469 |
foreach( (array)$options as $key => $value ) { |
| 470 |
if( !empty( $value['meta_key'] ) ) { |
| 471 |
$meta_value = wel_safe_maybe_unserialize( $value['meta_value'] ); |
| 472 |
if( is_array( $meta_value ) ) { |
| 473 |
$meta_vals = ''; |
| 474 |
foreach( $meta_value as $array_val ) { |
| 475 |
$meta_vals .= $nb.urldecode( $array_val ); |
| 476 |
} |
| 477 |
$optstr .= usces_entity_decode( urldecode( $value['meta_key'] ).$sp.$meta_vals, $ext ).$nb; |
| 478 |
} else { |
| 479 |
$optstr .= usces_entity_decode( urldecode( $value['meta_key'] ).$sp.urldecode( $value['meta_value'] ), $ext ).$nb; |
| 480 |
} |
| 481 |
} |
| 482 |
} |
| 483 |
} |
| 484 |
$line .= $td_h.$optstr.$td_f; |
| 485 |
} |
| 486 |
$line .= $td_h.$cart_row['quantity'].$td_f; |
| 487 |
$line .= $td_h.usces_crform( $cart_row['price'], false, false, 'return', false ).$td_f; |
| 488 |
if( isset( $_REQUEST['check']['unit'] ) ) $line .= $td_h.usces_entity_decode( $cart_row['unit'], $ext ).$td_f; |
| 489 |
$line .= apply_filters( 'usces_filter_chk_pro_data_detail', NULL, $usces_opt_order, $array, $cart_row ); |
| 490 |
$line .= $tr_f.$lf; |
| 491 |
} |
| 492 |
} |
| 493 |
$line .= $table_f.$lf; |
| 494 |
$line = apply_filters( 'wc_filter_chk_pro_data_order', $line ); |
| 495 |
|
| 496 |
//========================================================================== |
| 497 |
|
| 498 |
header( "Content-Type: application/octet-stream" ); |
| 499 |
header( "Content-Disposition: attachment; filename=usces_product_list.".$ext ); |
| 500 |
mb_http_output( 'pass' ); |
| 501 |
print( mb_convert_encoding( $line, apply_filters( 'usces_filter_output_csv_encode', 'SJIS-win' ), "UTF-8" ) ); |
| 502 |
exit(); |
| 503 |
} |
| 504 |
|
| 505 |
// order list download |
| 506 |
function usces_download_order_list() { |
| 507 |
|
| 508 |
if ( ! usces_admin_user_can_download_list() ) { |
| 509 |
exit(); |
| 510 |
} |
| 511 |
|
| 512 |
require_once( USCES_PLUGIN_DIR."/classes/orderList.class.php" ); |
| 513 |
global $wpdb, $usces; |
| 514 |
global $usces_settings; |
| 515 |
|
| 516 |
$ext = $_REQUEST['ftype']; |
| 517 |
if( $ext == 'csv' ) {//CSV |
| 518 |
$table_h = ""; |
| 519 |
$table_f = ""; |
| 520 |
$tr_h = ""; |
| 521 |
$tr_f = ""; |
| 522 |
$th_h1 = '"'; |
| 523 |
$th_h = ',"'; |
| 524 |
$th_f = '"'; |
| 525 |
$td_h1 = '"'; |
| 526 |
$td_h = ',"'; |
| 527 |
$td_f = '"'; |
| 528 |
$sp = ":"; |
| 529 |
$lf = "\n"; |
| 530 |
} else { |
| 531 |
exit(); |
| 532 |
} |
| 533 |
$csod_meta = usces_has_custom_field_meta( 'order' ); |
| 534 |
$cscs_meta = usces_has_custom_field_meta( 'customer' ); |
| 535 |
$csde_meta = usces_has_custom_field_meta( 'delivery' ); |
| 536 |
$applyform = usces_get_apply_addressform( $usces->options['system']['addressform'] ); |
| 537 |
|
| 538 |
//========================================================================== |
| 539 |
|
| 540 |
$usces_opt_order = get_option( 'usces_opt_order' ); |
| 541 |
if( !is_array( $usces_opt_order ) ) { |
| 542 |
$usces_opt_order = array(); |
| 543 |
} |
| 544 |
$usces_opt_order['ftype_ord'] = $ext; |
| 545 |
$chk_ord = array(); |
| 546 |
$chk_ord['ID'] = 1; |
| 547 |
$chk_ord['deco_id'] = ( isset( $_REQUEST['check']['deco_id'] ) ) ? 1 : 0; |
| 548 |
$chk_ord['date'] = ( isset( $_REQUEST['check']['date'] ) ) ? 1 : 0; |
| 549 |
$chk_ord['mem_id'] = ( isset( $_REQUEST['check']['mem_id'] ) ) ? 1 : 0; |
| 550 |
$chk_ord['email'] = ( isset( $_REQUEST['check']['email'] ) ) ? 1 : 0; |
| 551 |
if( !empty( $cscs_meta ) ) { |
| 552 |
foreach( $cscs_meta as $key => $entry ) { |
| 553 |
if( $entry['position'] == 'name_pre' ) { |
| 554 |
$name = $entry['name']; |
| 555 |
$cscs_key = 'cscs_'.$key; |
| 556 |
$chk_ord[$cscs_key] = ( isset( $_REQUEST['check'][$cscs_key] ) ) ? 1 : 0; |
| 557 |
} |
| 558 |
} |
| 559 |
} |
| 560 |
$chk_ord['name'] = 1; |
| 561 |
if( $applyform == 'JP' ) { |
| 562 |
$chk_ord['kana'] = ( isset( $_REQUEST['check']['kana'] ) ) ? 1 : 0; |
| 563 |
} |
| 564 |
if( !empty( $cscs_meta ) ) { |
| 565 |
foreach( $cscs_meta as $key => $entry ) { |
| 566 |
if( $entry['position'] == 'name_after' ) { |
| 567 |
$name = $entry['name']; |
| 568 |
$cscs_key = 'cscs_'.$key; |
| 569 |
$chk_ord[$cscs_key] = ( isset( $_REQUEST['check'][$cscs_key] ) ) ? 1 : 0; |
| 570 |
} |
| 571 |
} |
| 572 |
} |
| 573 |
$chk_ord['zip'] = ( isset( $_REQUEST['check']['zip'] ) ) ? 1 : 0; |
| 574 |
$chk_ord['country'] = ( isset( $_REQUEST['check']['country'] ) ) ? 1 : 0; |
| 575 |
$chk_ord['pref'] = ( isset( $_REQUEST['check']['pref'] ) ) ? 1 : 0; |
| 576 |
$chk_ord['address1'] = ( isset( $_REQUEST['check']['address1'] ) ) ? 1 : 0; |
| 577 |
$chk_ord['address2'] = ( isset( $_REQUEST['check']['address2'] ) ) ? 1 : 0; |
| 578 |
$chk_ord['address3'] = ( isset( $_REQUEST['check']['address3'] ) ) ? 1 : 0; |
| 579 |
$chk_ord['tel'] = ( isset( $_REQUEST['check']['tel'] ) ) ? 1 : 0; |
| 580 |
$chk_ord['fax'] = ( isset( $_REQUEST['check']['fax'] ) ) ? 1 : 0; |
| 581 |
if( !empty( $cscs_meta ) ) { |
| 582 |
foreach( $cscs_meta as $key => $entry ) { |
| 583 |
if( $entry['position'] == 'fax_after' ) { |
| 584 |
$name = $entry['name']; |
| 585 |
$cscs_key = 'cscs_'.$key; |
| 586 |
$chk_ord[$cscs_key] = ( isset( $_REQUEST['check'][$cscs_key] ) ) ? 1 : 0; |
| 587 |
} |
| 588 |
} |
| 589 |
} |
| 590 |
//-------------------------------------------------------------------------- |
| 591 |
if( !empty( $csde_meta ) ) { |
| 592 |
foreach( $csde_meta as $key => $entry ) { |
| 593 |
if( $entry['position'] == 'name_pre' ) { |
| 594 |
$name = $entry['name']; |
| 595 |
$csde_key = 'csde_'.$key; |
| 596 |
$chk_ord[$csde_key] = ( isset( $_REQUEST['check'][$csde_key] ) ) ? 1 : 0; |
| 597 |
} |
| 598 |
} |
| 599 |
} |
| 600 |
$chk_ord['delivery_name'] = ( isset( $_REQUEST['check']['delivery_name'] ) ) ? 1 : 0; |
| 601 |
if( $applyform == 'JP' ) { |
| 602 |
$chk_ord['delivery_kana'] = ( isset( $_REQUEST['check']['delivery_kana'] ) ) ? 1 : 0; |
| 603 |
} |
| 604 |
if( !empty( $csde_meta ) ) { |
| 605 |
foreach( $csde_meta as $key => $entry ) { |
| 606 |
if( $entry['position'] == 'name_after' ) { |
| 607 |
$name = $entry['name']; |
| 608 |
$csde_key = 'csde_'.$key; |
| 609 |
$chk_ord[$csde_key] = ( isset( $_REQUEST['check'][$csde_key] ) ) ? 1 : 0; |
| 610 |
} |
| 611 |
} |
| 612 |
} |
| 613 |
$chk_ord['delivery_zip'] = ( isset( $_REQUEST['check']['delivery_zip'] ) ) ? 1 : 0; |
| 614 |
$chk_ord['delivery_country'] = ( isset( $_REQUEST['check']['delivery_country'] ) ) ? 1 : 0; |
| 615 |
$chk_ord['delivery_pref'] = ( isset( $_REQUEST['check']['delivery_pref'] ) ) ? 1 : 0; |
| 616 |
$chk_ord['delivery_address1'] = ( isset( $_REQUEST['check']['delivery_address1'] ) ) ? 1 : 0; |
| 617 |
$chk_ord['delivery_address2'] = ( isset( $_REQUEST['check']['delivery_address2'] ) ) ? 1 : 0; |
| 618 |
$chk_ord['delivery_address3'] = ( isset( $_REQUEST['check']['delivery_address3'] ) ) ? 1 : 0; |
| 619 |
$chk_ord['delivery_tel'] = ( isset( $_REQUEST['check']['delivery_tel'] ) ) ? 1 : 0; |
| 620 |
$chk_ord['delivery_fax'] = ( isset( $_REQUEST['check']['delivery_fax'] ) ) ? 1 : 0; |
| 621 |
if( !empty( $csde_meta ) ) { |
| 622 |
foreach( $csde_meta as $key => $entry ) { |
| 623 |
if( $entry['position'] == 'fax_after' ) { |
| 624 |
$name = $entry['name']; |
| 625 |
$csde_key = 'csde_'.$key; |
| 626 |
$chk_ord[$csde_key] = ( isset( $_REQUEST['check'][$csde_key] ) ) ? 1 : 0; |
| 627 |
} |
| 628 |
} |
| 629 |
} |
| 630 |
//-------------------------------------------------------------------------- |
| 631 |
$chk_ord['shipping_date'] = ( isset( $_REQUEST['check']['shipping_date'] ) ) ? 1 : 0; |
| 632 |
$chk_ord['peyment_method'] = ( isset( $_REQUEST['check']['peyment_method'] ) ) ? 1 : 0; |
| 633 |
$chk_ord['delivery_method'] = ( isset( $_REQUEST['check']['delivery_method'] ) ) ? 1 : 0; |
| 634 |
$chk_ord['delivery_date'] = ( isset( $_REQUEST['check']['delivery_date'] ) ) ? 1 : 0; |
| 635 |
$chk_ord['delivery_time'] = ( isset( $_REQUEST['check']['delivery_time'] ) ) ? 1 : 0; |
| 636 |
$chk_ord['delidue_date'] = ( isset( $_REQUEST['check']['delidue_date'] ) ) ? 1 : 0; |
| 637 |
$chk_ord['status'] = ( isset( $_REQUEST['check']['status'] ) ) ? 1 : 0; |
| 638 |
$chk_ord['total_amount'] = 1; |
| 639 |
$chk_ord['getpoint'] = ( isset( $_REQUEST['check']['getpoint'] ) ) ? 1 : 0; |
| 640 |
$chk_ord['usedpoint'] = ( isset( $_REQUEST['check']['usedpoint'] ) ) ? 1 : 0; |
| 641 |
$chk_ord['discount'] = 1; |
| 642 |
$chk_ord['shipping_charge'] = 1; |
| 643 |
$chk_ord['cod_fee'] = 1; |
| 644 |
$chk_ord['tax'] = ( usces_is_tax_display() ) ? 1 : 0; |
| 645 |
$chk_ord['note'] = ( isset( $_REQUEST['check']['note'] ) ) ? 1 : 0; |
| 646 |
if( !empty( $csod_meta ) ) { |
| 647 |
foreach( $csod_meta as $key => $entry ) { |
| 648 |
$name = $entry['name']; |
| 649 |
$csod_key = 'csod_'.$key; |
| 650 |
$chk_ord[$csod_key] = ( isset( $_REQUEST['check'][$csod_key] ) ) ? 1 : 0; |
| 651 |
} |
| 652 |
} |
| 653 |
$usces_opt_order['chk_ord'] = apply_filters( 'usces_filter_chk_ord', $chk_ord ); |
| 654 |
update_option( 'usces_opt_order', $usces_opt_order ); |
| 655 |
|
| 656 |
//========================================================================== |
| 657 |
|
| 658 |
if( isset( $_REQUEST['check']['status'] ) ) { |
| 659 |
$usces_management_status = apply_filters( 'usces_filter_management_status', get_option( 'usces_management_status' ) ); |
| 660 |
$usces_management_status['new'] = __( 'new order', 'usces' ); |
| 661 |
} |
| 662 |
|
| 663 |
$_REQUEST['searchIn'] = "searchIn"; |
| 664 |
$usces_order_table = $wpdb->prefix."usces_order"; |
| 665 |
$arr_column = array( |
| 666 |
__( 'ID', 'usces' ) => 'ID', |
| 667 |
__( 'Order number', 'usces' ) => 'deco_id', |
| 668 |
__( 'date', 'usces' ) => 'date', |
| 669 |
__( 'membership number', 'usces' ) => 'mem_id', |
| 670 |
__( 'name', 'usces' ) => 'name', |
| 671 |
__( 'Region', 'usces' ) => 'pref', |
| 672 |
__( 'shipping option', 'usces' ) => 'delivery_method', |
| 673 |
__( 'Amount', 'usces' ) => 'total_price', |
| 674 |
__( 'payment method', 'usces' ) => 'payment_name', |
| 675 |
__( 'transfer statement', 'usces' ) => 'receipt_status', |
| 676 |
__( 'Processing', 'usces' ) => 'order_status', |
| 677 |
__( 'shpping date', 'usces' ) => 'order_modified' ); |
| 678 |
$DT = new dataList( $usces_order_table, $arr_column ); |
| 679 |
$DT->pageLimit = 'off'; |
| 680 |
$res = $DT->MakeTable(); |
| 681 |
$rows = $DT->rows; |
| 682 |
|
| 683 |
if ( ! empty( $_REQUEST['listcheck'] ) ) { |
| 684 |
$listcheck = ( is_array( $_REQUEST['listcheck'] ) ) ? $_REQUEST['listcheck'] : explode( ',', $_REQUEST['listcheck'] ); |
| 685 |
$rows = array_filter( $rows, function( $row ) use ( $listcheck ) { |
| 686 |
return in_array( (int)$row['ID'], array_map( 'intval', $listcheck ), true ); |
| 687 |
} ); |
| 688 |
} |
| 689 |
|
| 690 |
//========================================================================== |
| 691 |
|
| 692 |
$line = $table_h; |
| 693 |
$line .= $tr_h; |
| 694 |
$line .= $th_h1.__( 'ID', 'usces' ).$th_f; |
| 695 |
if( isset( $_REQUEST['check']['deco_id'] ) ) $line .= $th_h.__( 'Order number', 'usces' ).$th_f; |
| 696 |
if( isset( $_REQUEST['check']['date'] ) ) $line .= $th_h.__( 'order date', 'usces' ).$th_f; |
| 697 |
if( isset( $_REQUEST['check']['mem_id'] ) ) $line .= $th_h.__( 'membership number', 'usces' ).$th_f; |
| 698 |
if( isset( $_REQUEST['check']['email'] ) ) $line .= $th_h.__( 'e-mail', 'usces' ).$th_f; |
| 699 |
if( !empty( $cscs_meta ) ) { |
| 700 |
foreach( $cscs_meta as $key => $entry ) { |
| 701 |
if( $entry['position'] == 'name_pre' ) { |
| 702 |
$name = $entry['name']; |
| 703 |
$cscs_key = 'cscs_'.$key; |
| 704 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 705 |
} |
| 706 |
} |
| 707 |
} |
| 708 |
$line .= $th_h.__( 'name', 'usces' ).$th_f; |
| 709 |
if( $applyform == 'JP' ) { |
| 710 |
if( isset( $_REQUEST['check']['kana'] ) ) $line .= $th_h.__( 'furigana', 'usces' ).$th_f; |
| 711 |
} |
| 712 |
if( !empty( $cscs_meta ) ) { |
| 713 |
foreach( $cscs_meta as $key => $entry ) { |
| 714 |
if( $entry['position'] == 'name_after' ) { |
| 715 |
$name = $entry['name']; |
| 716 |
$cscs_key = 'cscs_'.$key; |
| 717 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 718 |
} |
| 719 |
} |
| 720 |
} |
| 721 |
|
| 722 |
switch( $applyform ) { |
| 723 |
case 'JP': |
| 724 |
if( isset( $_REQUEST['check']['zip'] ) ) $line .= $th_h.__( 'Zip/Postal Code', 'usces' ).$th_f; |
| 725 |
if( isset( $_REQUEST['check']['country'] ) ) $line .= $th_h.__( 'Country', 'usces' ).$th_f; |
| 726 |
if( isset( $_REQUEST['check']['pref'] ) ) $line .= $th_h.__( 'Province', 'usces' ).$th_f; |
| 727 |
if( isset( $_REQUEST['check']['address1'] ) ) $line .= $th_h.__( 'city', 'usces' ).$th_f; |
| 728 |
if( isset( $_REQUEST['check']['address2'] ) ) $line .= $th_h.__( 'numbers', 'usces' ).$th_f; |
| 729 |
if( isset( $_REQUEST['check']['address3'] ) ) $line .= $th_h.__( 'building name', 'usces' ).$th_f; |
| 730 |
if( isset( $_REQUEST['check']['tel'] ) ) $line .= $th_h.__( 'Phone number', 'usces' ).$th_f; |
| 731 |
if( isset( $_REQUEST['check']['fax'] ) ) $line .= $th_h.__( 'FAX number', 'usces' ).$th_f; |
| 732 |
break; |
| 733 |
case 'US': |
| 734 |
default: |
| 735 |
if( isset( $_REQUEST['check']['address2'] ) ) $line .= $th_h.__( 'Address Line1', 'usces' ).$th_f; |
| 736 |
if( isset( $_REQUEST['check']['address3'] ) ) $line .= $th_h.__( 'Address Line2', 'usces' ).$th_f; |
| 737 |
if( isset( $_REQUEST['check']['address1'] ) ) $line .= $th_h.__( 'city', 'usces' ).$th_f; |
| 738 |
if( isset( $_REQUEST['check']['pref'] ) ) $line .= $th_h.__( 'State', 'usces' ).$th_f; |
| 739 |
if( isset( $_REQUEST['check']['country'] ) ) $line .= $th_h.__( 'Country', 'usces' ).$th_f; |
| 740 |
if( isset( $_REQUEST['check']['zip'] ) ) $line .= $th_h.__( 'Zip', 'usces' ).$th_f; |
| 741 |
if( isset( $_REQUEST['check']['tel'] ) ) $line .= $th_h.__( 'Phone number', 'usces' ).$th_f; |
| 742 |
if( isset( $_REQUEST['check']['fax'] ) ) $line .= $th_h.__( 'FAX number', 'usces' ).$th_f; |
| 743 |
break; |
| 744 |
} |
| 745 |
|
| 746 |
if( !empty( $cscs_meta ) ) { |
| 747 |
foreach( $cscs_meta as $key => $entry ) { |
| 748 |
if( $entry['position'] == 'fax_after' ) { |
| 749 |
$name = $entry['name']; |
| 750 |
$cscs_key = 'cscs_'.$key; |
| 751 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 752 |
} |
| 753 |
} |
| 754 |
} |
| 755 |
$line .= apply_filters( 'usces_filter_chk_ord_label_customer', NULL, $usces_opt_order, $rows ); |
| 756 |
//-------------------------------------------------------------------------- |
| 757 |
if( !empty( $csde_meta ) ) { |
| 758 |
foreach( $csde_meta as $key => $entry ) { |
| 759 |
if( $entry['position'] == 'name_pre' ) { |
| 760 |
$name = $entry['name']; |
| 761 |
$csde_key = 'csde_'.$key; |
| 762 |
if( isset( $_REQUEST['check'][$csde_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 763 |
} |
| 764 |
} |
| 765 |
} |
| 766 |
if( isset( $_REQUEST['check']['delivery_name'] ) ) $line .= $th_h.__( 'Shipping Name', 'usces' ).$th_f; |
| 767 |
if( $applyform == 'JP' ) { |
| 768 |
if( isset( $_REQUEST['check']['delivery_kana'] ) ) $line .= $th_h.__( 'Shipping Furigana', 'usces' ).$th_f; |
| 769 |
} |
| 770 |
if( !empty( $csde_meta ) ) { |
| 771 |
foreach( $csde_meta as $key => $entry ) { |
| 772 |
if( $entry['position'] == 'name_after' ) { |
| 773 |
$name = $entry['name']; |
| 774 |
$csde_key = 'csde_'.$key; |
| 775 |
if( isset( $_REQUEST['check'][$csde_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 776 |
} |
| 777 |
} |
| 778 |
} |
| 779 |
|
| 780 |
switch( $applyform ) { |
| 781 |
case 'JP': |
| 782 |
if( isset( $_REQUEST['check']['delivery_zip'] ) ) $line .= $th_h.__( 'Shipping Zip', 'usces' ).$th_f; |
| 783 |
if( isset( $_REQUEST['check']['delivery_country'] ) ) $line .= $th_h.__( 'Shipping Country', 'usces' ).$th_f; |
| 784 |
if( isset( $_REQUEST['check']['delivery_pref'] ) ) $line .= $th_h.__( 'Shipping State', 'usces' ).$th_f; |
| 785 |
if( isset( $_REQUEST['check']['delivery_address1'] ) ) $line .= $th_h.__( 'Shipping City', 'usces' ).$th_f; |
| 786 |
if( isset( $_REQUEST['check']['delivery_address2'] ) ) $line .= $th_h.__( 'Shipping Address1', 'usces' ).$th_f; |
| 787 |
if( isset( $_REQUEST['check']['delivery_address3'] ) ) $line .= $th_h.__( 'Shipping Address2', 'usces' ).$th_f; |
| 788 |
if( isset( $_REQUEST['check']['delivery_tel'] ) ) $line .= $th_h.__( 'Shipping Phone', 'usces' ).$th_f; |
| 789 |
if( isset( $_REQUEST['check']['delivery_fax'] ) ) $line .= $th_h.__( 'Shipping FAX', 'usces' ).$th_f; |
| 790 |
break; |
| 791 |
case 'US': |
| 792 |
default: |
| 793 |
if( isset( $_REQUEST['check']['delivery_address2'] ) ) $line .= $th_h.__( 'Shipping Address1', 'usces' ).$th_f; |
| 794 |
if( isset( $_REQUEST['check']['delivery_address3'] ) ) $line .= $th_h.__( 'Shipping Address2', 'usces' ).$th_f; |
| 795 |
if( isset( $_REQUEST['check']['delivery_address1'] ) ) $line .= $th_h.__( 'Shipping City', 'usces' ).$th_f; |
| 796 |
if( isset( $_REQUEST['check']['delivery_pref'] ) ) $line .= $th_h.__( 'Shipping State', 'usces' ).$th_f; |
| 797 |
if( isset( $_REQUEST['check']['delivery_country'] ) ) $line .= $th_h.__( 'Shipping Country', 'usces' ).$th_f; |
| 798 |
if( isset( $_REQUEST['check']['delivery_zip'] ) ) $line .= $th_h.__( 'Shipping Zip', 'usces' ).$th_f; |
| 799 |
if( isset( $_REQUEST['check']['delivery_tel'] ) ) $line .= $th_h.__( 'Shipping Phone', 'usces' ).$th_f; |
| 800 |
if( isset( $_REQUEST['check']['delivery_fax'] ) ) $line .= $th_h.__( 'Shipping FAX', 'usces' ).$th_f; |
| 801 |
break; |
| 802 |
} |
| 803 |
|
| 804 |
if( !empty( $csde_meta ) ) { |
| 805 |
foreach( $csde_meta as $key => $entry ) { |
| 806 |
if( $entry['position'] == 'fax_after' ) { |
| 807 |
$name = $entry['name']; |
| 808 |
$csde_key = 'csde_'.$key; |
| 809 |
if( isset( $_REQUEST['check'][$csde_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 810 |
} |
| 811 |
} |
| 812 |
} |
| 813 |
$line .= apply_filters( 'usces_filter_chk_ord_label_delivery', NULL, $usces_opt_order, $rows ); |
| 814 |
//-------------------------------------------------------------------------- |
| 815 |
if( isset( $_REQUEST['check']['shipping_date'] ) ) $line .= $th_h.__( 'shpping date', 'usces' ).$th_f; |
| 816 |
if( isset( $_REQUEST['check']['peyment_method'] ) ) $line .= $th_h.__( 'payment method', 'usces' ).$th_f; |
| 817 |
if( isset( $_REQUEST['check']['delivery_method'] ) ) $line .= $th_h.__( 'shipping option', 'usces' ).$th_f; |
| 818 |
if( isset( $_REQUEST['check']['delivery_date'] ) ) $line .= $th_h.__( 'Delivery date', 'usces' ).$th_f; |
| 819 |
if( isset( $_REQUEST['check']['delivery_time'] ) ) $line .= $th_h.__( 'delivery time', 'usces' ).$th_f; |
| 820 |
if( isset( $_REQUEST['check']['delidue_date'] ) ) $line .= $th_h.__( 'Shipping date', 'usces' ).$th_f; |
| 821 |
if( isset( $_REQUEST['check']['status'] ) ) $line .= $th_h.__( 'Status', 'usces' ).$th_f; |
| 822 |
$line .= $th_h.__( 'Total Amount', 'usces' ).$th_f; |
| 823 |
if( isset( $_REQUEST['check']['getpoint'] ) ) $line .= $th_h.__( 'granted points', 'usces' ).$th_f; |
| 824 |
if( isset( $_REQUEST['check']['usedpoint'] ) ) $line .= $th_h.__( 'Used points', 'usces' ).$th_f; |
| 825 |
$line .= $th_h.__( 'Discount', 'usces' ).$th_f; |
| 826 |
if( usces_is_tax_display() && 'products' == usces_get_tax_target() ) { |
| 827 |
$line .= $th_h.usces_tax_label( array(), 'return' ).$th_f; |
| 828 |
} |
| 829 |
$line .= $th_h.__( 'Shipping', 'usces' ).$th_f; |
| 830 |
$line .= $th_h.apply_filters( 'usces_filter_cod_label', __( 'COD fee', 'usces' ) ).$th_f; |
| 831 |
if( usces_is_tax_display() && 'all' == usces_get_tax_target() ) { |
| 832 |
$line .= $th_h.usces_tax_label( array(), 'return' ).$th_f; |
| 833 |
} |
| 834 |
if( isset( $_REQUEST['check']['note'] ) ) $line .= $th_h.__( 'Notes', 'usces' ).$th_f; |
| 835 |
if( !empty( $csod_meta ) ) { |
| 836 |
foreach( $csod_meta as $key => $entry ) { |
| 837 |
$name = $entry['name']; |
| 838 |
$csod_key = 'csod_'.$key; |
| 839 |
if( isset( $_REQUEST['check'][$csod_key] ) ) $line .= $th_h.usces_entity_decode( $name, $ext ).$th_f; |
| 840 |
} |
| 841 |
} |
| 842 |
$line .= apply_filters( 'usces_filter_chk_ord_label_order', NULL, $usces_opt_order, $rows ); |
| 843 |
$line .= $tr_f.$lf; |
| 844 |
|
| 845 |
//========================================================================== |
| 846 |
|
| 847 |
foreach( (array)$rows as $array ) { |
| 848 |
$order_id = $array['ID']; |
| 849 |
$query = $wpdb->prepare( "SELECT * FROM $usces_order_table WHERE ID = %d", $order_id ); |
| 850 |
$data = $wpdb->get_row( $query, ARRAY_A ); |
| 851 |
$deli = wel_safe_unserialize( $data['order_delivery'] ); |
| 852 |
|
| 853 |
$line .= $tr_h; |
| 854 |
$line .= $td_h1.$order_id.$td_f; |
| 855 |
$line .= $td_h.usces_get_deco_order_id( $order_id ).$td_f; |
| 856 |
$line .= $td_h.$data['order_date'].$td_f; |
| 857 |
if( isset( $_REQUEST['check']['mem_id'] ) ) $line .= $td_h.$data['mem_id'].$td_f; |
| 858 |
if( isset( $_REQUEST['check']['email'] ) ) $line .= $td_h.usces_entity_decode( $data['order_email'], $ext ).$td_f; |
| 859 |
if( !empty( $cscs_meta ) ) { |
| 860 |
foreach( $cscs_meta as $key => $entry ) { |
| 861 |
if( $entry['position'] == 'name_pre' ) { |
| 862 |
$name = $entry['name']; |
| 863 |
$cscs_key = 'cscs_'.$key; |
| 864 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) { |
| 865 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $cscs_key, $order_id ) ); |
| 866 |
if( empty( $value ) ) { |
| 867 |
$value = ''; |
| 868 |
} elseif( is_array( $value ) ) { |
| 869 |
$concatval = ''; |
| 870 |
$c = ''; |
| 871 |
foreach( $value as $v ) { |
| 872 |
$concatval .= $c.$v; |
| 873 |
$c = ' '; |
| 874 |
} |
| 875 |
$value = $concatval; |
| 876 |
} |
| 877 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 878 |
} |
| 879 |
} |
| 880 |
} |
| 881 |
} |
| 882 |
|
| 883 |
switch( $applyform ) { |
| 884 |
case 'JP': |
| 885 |
$line .= $td_h.usces_entity_decode( $data['order_name1'].' '.$data['order_name2'], $ext ).$td_f; |
| 886 |
if( isset( $_REQUEST['check']['kana'] ) ) $line .= $td_h.usces_entity_decode( $data['order_name3'].' '.$data['order_name4'], $ext ).$td_f; |
| 887 |
break; |
| 888 |
case 'US': |
| 889 |
default: |
| 890 |
$line .= $td_h.usces_entity_decode( $data['order_name2'].' '.$data['order_name1'], $ext ).$td_f; |
| 891 |
break; |
| 892 |
} |
| 893 |
|
| 894 |
if( !empty( $cscs_meta ) ) { |
| 895 |
foreach( $cscs_meta as $key => $entry ) { |
| 896 |
if( $entry['position'] == 'name_after' ) { |
| 897 |
$name = $entry['name']; |
| 898 |
$cscs_key = 'cscs_'.$key; |
| 899 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) { |
| 900 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $cscs_key, $order_id ) ); |
| 901 |
if( empty( $value ) ) { |
| 902 |
$value = ''; |
| 903 |
} elseif( is_array( $value ) ) { |
| 904 |
$concatval = ''; |
| 905 |
$c = ''; |
| 906 |
foreach( $value as $v ) { |
| 907 |
$concatval .= $c.$v; |
| 908 |
$c = ' '; |
| 909 |
} |
| 910 |
$value = $concatval; |
| 911 |
} |
| 912 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 913 |
} |
| 914 |
} |
| 915 |
} |
| 916 |
} |
| 917 |
|
| 918 |
$address_info = ''; |
| 919 |
switch( $applyform ) { |
| 920 |
case 'JP': |
| 921 |
if( isset( $_REQUEST['check']['zip'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_zip'], $ext ).$td_f; |
| 922 |
if( isset( $_REQUEST['check']['country'] ) ) $address_info .= $td_h.$usces_settings['country'][$usces->get_order_meta_value( 'customer_country', $order_id )].$td_f; |
| 923 |
if( isset( $_REQUEST['check']['pref'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_pref'], $ext ).$td_f; |
| 924 |
if( isset( $_REQUEST['check']['address1'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address1'], $ext ).$td_f; |
| 925 |
if( isset( $_REQUEST['check']['address2'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address2'], $ext ).$td_f; |
| 926 |
if( isset( $_REQUEST['check']['address3'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address3'], $ext ).$td_f; |
| 927 |
if( isset( $_REQUEST['check']['tel'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_tel'], $ext ).$td_f; |
| 928 |
if( isset( $_REQUEST['check']['fax'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_fax'], $ext ).$td_f; |
| 929 |
break; |
| 930 |
case 'US': |
| 931 |
default: |
| 932 |
if( isset( $_REQUEST['check']['address2'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address2'], $ext ).$td_f; |
| 933 |
if( isset( $_REQUEST['check']['address3'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address3'], $ext ).$td_f; |
| 934 |
if( isset( $_REQUEST['check']['address1'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_address1'], $ext ).$td_f; |
| 935 |
if( isset( $_REQUEST['check']['pref'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_pref'], $ext ).$td_f; |
| 936 |
if( isset( $_REQUEST['check']['country'] ) ) $address_info .= $td_h.$usces_settings['country'][$usces->get_order_meta_value( 'customer_country', $order_id )].$td_f; |
| 937 |
if( isset( $_REQUEST['check']['zip'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_zip'], $ext ).$td_f; |
| 938 |
if( isset( $_REQUEST['check']['tel'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_tel'], $ext ).$td_f; |
| 939 |
if( isset( $_REQUEST['check']['fax'] ) ) $address_info .= $td_h.usces_entity_decode( $data['order_fax'], $ext ).$td_f; |
| 940 |
break; |
| 941 |
} |
| 942 |
$address_info_args = compact( 'td_h', 'td_f', 'ext', 'order_id', 'applyform' ); |
| 943 |
$line .= apply_filters( 'usces_filter_ord_csv_address_info', $address_info, $data, $address_info_args ); |
| 944 |
|
| 945 |
if( !empty( $cscs_meta ) ) { |
| 946 |
foreach( $cscs_meta as $key => $entry ) { |
| 947 |
if( $entry['position'] == 'fax_after' ) { |
| 948 |
$name = $entry['name']; |
| 949 |
$cscs_key = 'cscs_'.$key; |
| 950 |
if( isset( $_REQUEST['check'][$cscs_key] ) ) { |
| 951 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $cscs_key, $order_id ) ); |
| 952 |
if( empty( $value ) ) { |
| 953 |
$value = ''; |
| 954 |
} elseif( is_array( $value ) ) { |
| 955 |
$concatval = ''; |
| 956 |
$c = ''; |
| 957 |
foreach( $value as $v ) { |
| 958 |
$concatval .= $c.$v; |
| 959 |
$c = ' '; |
| 960 |
} |
| 961 |
$value = $concatval; |
| 962 |
} |
| 963 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 964 |
} |
| 965 |
} |
| 966 |
} |
| 967 |
} |
| 968 |
$line .= apply_filters( 'usces_filter_chk_ord_data_customer', NULL, $usces_opt_order, $order_id, $data ); |
| 969 |
//---------------------------------------------------------------------- |
| 970 |
if( !empty( $csde_meta ) ) { |
| 971 |
foreach( $csde_meta as $key => $entry ) { |
| 972 |
if( $entry['position'] == 'name_pre' ) { |
| 973 |
$name = $entry['name']; |
| 974 |
$csde_key = 'csde_'.$key; |
| 975 |
if( isset( $_REQUEST['check'][$csde_key] ) ) { |
| 976 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $csde_key, $order_id ) ); |
| 977 |
if( empty( $value ) ) { |
| 978 |
$value = ''; |
| 979 |
} elseif( is_array( $value ) ) { |
| 980 |
$concatval = ''; |
| 981 |
$c = ''; |
| 982 |
foreach( $value as $v ) { |
| 983 |
$concatval .= $c.$v; |
| 984 |
$c = ' '; |
| 985 |
} |
| 986 |
$value = $concatval; |
| 987 |
} |
| 988 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 989 |
} |
| 990 |
} |
| 991 |
} |
| 992 |
} |
| 993 |
|
| 994 |
switch( $applyform ) { |
| 995 |
case 'JP': |
| 996 |
if( isset( $_REQUEST['check']['delivery_name'] ) ) $line .= $td_h.usces_entity_decode( $deli['name1'].' '.$deli['name2'], $ext ).$td_f; |
| 997 |
if( isset( $_REQUEST['check']['delivery_kana'] ) ) $line .= $td_h.usces_entity_decode( $deli['name3'].' '.$deli['name4'], $ext ).$td_f; |
| 998 |
break; |
| 999 |
case 'US': |
| 1000 |
default: |
| 1001 |
if( isset( $_REQUEST['check']['delivery_name'] ) ) $line .= $td_h.usces_entity_decode( $deli['name2'].' '.$deli['name1'], $ext ).$td_f; |
| 1002 |
break; |
| 1003 |
} |
| 1004 |
|
| 1005 |
if( !empty( $csde_meta ) ) { |
| 1006 |
foreach( $csde_meta as $key => $entry ) { |
| 1007 |
if( $entry['position'] == 'name_after' ) { |
| 1008 |
$name = $entry['name']."</td>"; |
| 1009 |
$csde_key = 'csde_'.$key; |
| 1010 |
if( isset( $_REQUEST['check'][$csde_key] ) ) { |
| 1011 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $csde_key, $order_id ) ); |
| 1012 |
if( empty( $value ) ) { |
| 1013 |
$value = ''; |
| 1014 |
} elseif( is_array( $value ) ) { |
| 1015 |
$concatval = ''; |
| 1016 |
$c = ''; |
| 1017 |
foreach( $value as $v ) { |
| 1018 |
$concatval .= $c.$v; |
| 1019 |
$c = ' '; |
| 1020 |
} |
| 1021 |
$value = $concatval; |
| 1022 |
} |
| 1023 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 1024 |
} |
| 1025 |
} |
| 1026 |
} |
| 1027 |
} |
| 1028 |
|
| 1029 |
$address_info = ''; |
| 1030 |
switch( $applyform ) { |
| 1031 |
case 'JP': |
| 1032 |
if( isset( $_REQUEST['check']['delivery_zip'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['zipcode'], $ext ).$td_f; |
| 1033 |
if( isset( $_REQUEST['check']['delivery_country'] ) ) $address_info .= $td_h.$usces_settings['country'][$deli['country']].$td_f; |
| 1034 |
if( isset( $_REQUEST['check']['delivery_pref'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['pref'], $ext ).$td_f; |
| 1035 |
if( isset( $_REQUEST['check']['delivery_address1'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address1'], $ext ).$td_f; |
| 1036 |
if( isset( $_REQUEST['check']['delivery_address2'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address2'], $ext ).$td_f; |
| 1037 |
if( isset( $_REQUEST['check']['delivery_address3'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address3'], $ext ).$td_f; |
| 1038 |
if( isset( $_REQUEST['check']['delivery_tel'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['tel'], $ext ).$td_f; |
| 1039 |
if( isset( $_REQUEST['check']['delivery_fax'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['fax'], $ext ).$td_f; |
| 1040 |
break; |
| 1041 |
case 'US': |
| 1042 |
default: |
| 1043 |
if( isset( $_REQUEST['check']['delivery_address2'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address2'], $ext ).$td_f; |
| 1044 |
if( isset( $_REQUEST['check']['delivery_address3'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address3'], $ext ).$td_f; |
| 1045 |
if( isset( $_REQUEST['check']['delivery_address1'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['address1'], $ext ).$td_f; |
| 1046 |
if( isset( $_REQUEST['check']['delivery_pref'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['pref'], $ext ).$td_f; |
| 1047 |
if( isset( $_REQUEST['check']['delivery_country'] ) ) $address_info .= $td_h.$usces_settings['country'][$deli['country']].$td_f; |
| 1048 |
if( isset( $_REQUEST['check']['delivery_zip'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['zipcode'], $ext ).$td_f; |
| 1049 |
if( isset( $_REQUEST['check']['delivery_tel'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['tel'], $ext ).$td_f; |
| 1050 |
if( isset( $_REQUEST['check']['delivery_fax'] ) ) $address_info .= $td_h.usces_entity_decode( $deli['fax'], $ext ).$td_f; |
| 1051 |
break; |
| 1052 |
} |
| 1053 |
$line .= apply_filters( 'usces_filter_ord_csv_delivery_address_info', $address_info, $deli, $address_info_args ); |
| 1054 |
|
| 1055 |
if( !empty( $csde_meta ) ) { |
| 1056 |
foreach( $csde_meta as $key => $entry ) { |
| 1057 |
if( $entry['position'] == 'fax_after' ) { |
| 1058 |
$name = $entry['name']; |
| 1059 |
$csde_key = 'csde_'.$key; |
| 1060 |
if( isset( $_REQUEST['check'][$csde_key] ) ) { |
| 1061 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $csde_key, $order_id ) ); |
| 1062 |
if( empty( $value ) ) { |
| 1063 |
$value = ''; |
| 1064 |
} elseif( is_array( $value ) ) { |
| 1065 |
$concatval = ''; |
| 1066 |
$c = ''; |
| 1067 |
foreach( $value as $v ) { |
| 1068 |
$concatval .= $c.$v; |
| 1069 |
$c = ' '; |
| 1070 |
} |
| 1071 |
$value = $concatval; |
| 1072 |
} |
| 1073 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 1074 |
} |
| 1075 |
} |
| 1076 |
} |
| 1077 |
} |
| 1078 |
$line .= apply_filters( 'usces_filter_chk_ord_data_delivery', NULL, $usces_opt_order, $order_id, $deli ); |
| 1079 |
//---------------------------------------------------------------------- |
| 1080 |
if( isset( $_REQUEST['check']['shipping_date'] ) ) $line .= $td_h.$data['order_modified'].$td_f; |
| 1081 |
if( isset( $_REQUEST['check']['peyment_method'] ) ) $line .= $td_h.$data['order_payment_name'].$td_f; |
| 1082 |
if( isset( $_REQUEST['check']['delivery_method'] ) ) { |
| 1083 |
$delivery_method = ''; |
| 1084 |
if( strtoupper( $data['order_delivery_method'] ) == '#NONE#' ) { |
| 1085 |
$delivery_method = __( 'No preference', 'usces' ); |
| 1086 |
} else { |
| 1087 |
foreach( (array)$usces->options['delivery_method'] as $dkey => $delivery ) { |
| 1088 |
if( $delivery['id'] == $data['order_delivery_method'] ) { |
| 1089 |
$delivery_method = $delivery['name']; |
| 1090 |
break; |
| 1091 |
} |
| 1092 |
} |
| 1093 |
} |
| 1094 |
$line .= $td_h.$delivery_method.$td_f; |
| 1095 |
} |
| 1096 |
if( isset( $_REQUEST['check']['delivery_date'] ) ) $line .= $td_h.$data['order_delivery_date'].$td_f; |
| 1097 |
if( isset( $_REQUEST['check']['delivery_time'] ) ) $line .= $td_h.$data['order_delivery_time'].$td_f; |
| 1098 |
if( isset( $_REQUEST['check']['delidue_date'] ) ) { |
| 1099 |
$order_delidue_date = ( strtoupper( $data['order_delidue_date'] ) == '#NONE#' ) ? '' : $data['order_delidue_date']; |
| 1100 |
$line .= $td_h.$order_delidue_date.$td_f; |
| 1101 |
} |
| 1102 |
if( isset( $_REQUEST['check']['status'] ) ) { |
| 1103 |
$order_status = explode( ',', $data['order_status'] ); |
| 1104 |
$status = ''; |
| 1105 |
foreach( (array)$order_status as $os ) { |
| 1106 |
if( isset( $usces_management_status[$os] ) ) { |
| 1107 |
$status .= $usces_management_status[$os].$sp; |
| 1108 |
} |
| 1109 |
} |
| 1110 |
$line .= $td_h.trim( $status, $sp ).$td_f; |
| 1111 |
} |
| 1112 |
$total_price = ( 0 < $array['total_price'] ) ? $array['total_price'] : 0; |
| 1113 |
$line .= $td_h.usces_crform( $total_price, false, false, 'return', false ).$td_f; |
| 1114 |
if( isset( $_REQUEST['check']['getpoint'] ) ) $line .= $td_h.$data['order_getpoint'].$td_f; |
| 1115 |
if( isset( $_REQUEST['check']['usedpoint'] ) ) $line .= $td_h.$data['order_usedpoint'].$td_f; |
| 1116 |
$line .= $td_h.usces_crform( $data['order_discount'], false, false, 'return', false ).$td_f; |
| 1117 |
if( usces_is_tax_display() && 'products' == usces_get_tax_target() ) { |
| 1118 |
$line .= $td_h.usces_crform( $data['order_tax'], false, false, 'return', false ).$td_f; |
| 1119 |
} |
| 1120 |
$line .= $td_h.usces_crform( $data['order_shipping_charge'], false, false, 'return', false ).$td_f; |
| 1121 |
$line .= $td_h.usces_crform( $data['order_cod_fee'], false, false, 'return', false ).$td_f; |
| 1122 |
if( usces_is_tax_display() && 'all' == usces_get_tax_target() ) { |
| 1123 |
$line .= $td_h.usces_crform( $data['order_tax'], false, false, 'return', false ).$td_f; |
| 1124 |
} |
| 1125 |
if( isset( $_REQUEST['check']['note'] ) ) $line .= $td_h.usces_entity_decode( $data['order_note'], $ext ).$td_f; |
| 1126 |
if( !empty( $csod_meta ) ) { |
| 1127 |
foreach( $csod_meta as $key => $entry ) { |
| 1128 |
$name = $entry['name']; |
| 1129 |
$csod_key = 'csod_'.$key; |
| 1130 |
if( isset( $_REQUEST['check'][$csod_key] ) ) { |
| 1131 |
$value = wel_safe_maybe_unserialize( $usces->get_order_meta_value( $csod_key, $order_id ) ); |
| 1132 |
if( empty( $value ) ) { |
| 1133 |
$value = ''; |
| 1134 |
} elseif( is_array( $value ) ) { |
| 1135 |
$concatval = ''; |
| 1136 |
$c = ''; |
| 1137 |
foreach( $value as $v ) { |
| 1138 |
$concatval .= $c.$v; |
| 1139 |
$c = ' '; |
| 1140 |
} |
| 1141 |
$value = $concatval; |
| 1142 |
} |
| 1143 |
$line .= $td_h.usces_entity_decode( $value, $ext ).$td_f; |
| 1144 |
} |
| 1145 |
} |
| 1146 |
} |
| 1147 |
$line .= apply_filters( 'usces_filter_chk_ord_data_order', NULL, $usces_opt_order, $order_id, $data ); |
| 1148 |
$line .= $tr_f.$lf; |
| 1149 |
} |
| 1150 |
$line .= $table_f.$lf; |
| 1151 |
$line = apply_filters( 'wc_filter_chk_ord_data_order', $line ); |
| 1152 |
|
| 1153 |
//========================================================================== |
| 1154 |
|
| 1155 |
header( "Content-Type: application/octet-stream" ); |
| 1156 |
header( "Content-Disposition: attachment; filename=usces_order_list.".$ext ); |
| 1157 |
mb_http_output( 'pass' ); |
| 1158 |
print( mb_convert_encoding( $line, apply_filters( 'usces_filter_output_csv_encode', 'SJIS-win' ), "UTF-8" ) ); |
| 1159 |
exit(); |
| 1160 |
} |
| 1161 |
|