PluginProbe
Welcart e-Commerce / 1.4.10
Welcart e-Commerce v1.4.10
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / member_edit_form.php

member_edit_form.php in Welcart e-Commerce 1.4.10, at includes/member_edit_form.php

486 lines 17.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $status = $this->action_status;
3 $message = $this->action_message;
4 $this->action_status = 'none';
5 $this->action_message = '';
6
7 //$management_status = get_option('usces_management_status');
8
9 if($member_action == 'new'){
10 $page = 'usces_membernew';
11 $oa = 'newpost';
12 $ID = NULL;
13 $member_metas = array();
14 $data = array(
15 'ID' =>'',
16 'mem_email' => '',
17 'mem_pass' => '',
18 'mem_status' => '',
19 'mem_cookie' => '',
20 'mem_point' => '0',
21 'mem_name1' => '',
22 'mem_name2' => '',
23 'mem_name3' => '',
24 'mem_name4' => '',
25 'mem_zip' => '',
26 'mem_pref' => '',
27 'mem_address1' => '',
28 'mem_address2' => '',
29 'mem_address3' => '',
30 'mem_tel' => '',
31 'mem_fax' => '',
32 'mem_delivery_flag' => '',
33 'mem_delivery' => '',
34 'mem_registered' => '',
35 'mem_nicename' => ''
36 );
37
38 $usces_member_history = array();
39
40 $csmb_meta = usces_has_custom_field_meta('member');
41 if(is_array($csmb_meta)) {
42 $keys = array_keys($csmb_meta);
43 foreach($keys as $key) {
44 $csmb_key = 'csmb_'.$key;
45 $csmb_meta[$key]['data'] = NULL;
46 }
47 }
48 }elseif($member_action == 'newpost'){
49 $page = 'usces_membernew';
50 $oa = 'newpost';
51 $ID = NULL;
52 $member_metas = array();
53 $data = array(
54 'ID' =>'',
55 'mem_email' => $_POST['member']['email'],
56 'mem_pass' => $_POST['member']['password'],
57 'mem_status' => $_POST['member']['status'],
58 'mem_cookie' => '',
59 'mem_point' => $_POST['member']['point'],
60 'mem_name1' => $_POST['member']['name1'],
61 'mem_name2' => $_POST['member']['name2'],
62 'mem_name3' => $_POST['member']['name3'],
63 'mem_name4' => $_POST['member']['name4'],
64 'mem_zip' => $_POST['member']['zipcode'],
65 'mem_pref' => $_POST['member']['pref'],
66 'mem_address1' => $_POST['member']['address1'],
67 'mem_address2' => $_POST['member']['address2'],
68 'mem_address3' => $_POST['member']['address3'],
69 'mem_tel' => $_POST['member']['tel'],
70 'mem_fax' => $_POST['member']['fax'],
71 'mem_delivery_flag' => '',
72 'mem_delivery' => '',
73 'mem_registered' => '',
74 'mem_nicename' => ''
75 );
76
77 $usces_member_history = array();
78
79 $csmb_meta = usces_has_custom_field_meta('member');
80 if(is_array($csmb_meta)) {
81 $keys = array_keys($csmb_meta);
82 foreach($keys as $key) {
83 $csmb_key = 'csmb_'.$key;
84 $csmb_meta[$key]['data'] = $_POST['custom_member'][$key];
85 }
86 }
87 }else{
88 $page = 'usces_memberlist';
89 $oa = 'editpost';
90 $ID = $_REQUEST['member_id'];
91 $member_metas = $this->get_member_meta($ID);
92 ksort($member_metas);
93 global $wpdb;
94
95 $tableName = $wpdb->prefix . "usces_member";
96 $query = $wpdb->prepare("SELECT * FROM $tableName WHERE ID = %d", $ID);
97 $data = $wpdb->get_row( $query, ARRAY_A );
98
99 $usces_member_history = $this->get_member_history($ID);
100 //20100818ysk start
101 $csmb_meta = usces_has_custom_field_meta('member');
102 if(is_array($csmb_meta)) {
103 $keys = array_keys($csmb_meta);
104 foreach($keys as $key) {
105 $csmb_key = 'csmb_'.$key;
106 $csmb_meta[$key]['data'] = maybe_unserialize($this->get_member_meta_value($csmb_key, $ID));
107 }
108 }
109 //20100818ysk end
110 }
111
112 if( usces_is_member_system() ){
113 $colspan = 8;
114 }else{
115 $colspan = 6;
116 }
117
118 $curent_url = urlencode( USCES_ADMIN_URL.'?'.$_SERVER['QUERY_STRING'] );
119 ?>
120 <script type="text/javascript">
121 jQuery(function($){
122 <?php if($status == 'success'){ ?>
123 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
124 <?php }else if($status == 'caution'){ ?>
125 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
126 <?php }else if($status == 'error'){ ?>
127 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
128 <?php } ?>
129 var default_pre = '<?php _e('-- Select --', 'usces'); ?>';
130 $(".num").bind("change", function(){ usces_check_num($(this)); });
131
132 $('form').submit(function() {
133 var error = 0;
134
135 if( "" == $("input[name='member\[email\]']").val() ) {
136 error++;
137 $("input[name='member\[email\]']").css({'background-color': '#FFA'}).click(function() {
138 $(this).css({'background-color': '#FFF'});
139 });
140 }
141 if( "" == $("input[name='member\[password\]']").val() ) {
142 error++;
143 $("input[name='member\[password\]']").css({'background-color': '#FFA'}).click(function() {
144 $(this).css({'background-color': '#FFF'});
145 });
146 }
147 if( "" == $("input[name='member\[name1\]']").val() ) {
148 error++;
149 $("input[name='member\[name1\]']").css({'background-color': '#FFA'}).click(function() {
150 $(this).css({'background-color': '#FFF'});
151 });
152 }
153 if( "" == $("input[name='member\[name2\]']").val() ) {
154 error++;
155 $("input[name='member\[name2\]']").css({'background-color': '#FFA'}).click(function() {
156 $(this).css({'background-color': '#FFF'});
157 });
158 }
159 if( "" == $("input[name='member\[zipcode\]']").val() ) {
160 error++;
161 $("input[name='member\[zipcode\]']").css({'background-color': '#FFA'}).click(function() {
162 $(this).css({'background-color': '#FFF'});
163 });
164 }
165 if( default_pre == $("select[name='member\[pref\]']").val() || "" == $("select[name='member\[pref\]']").val() ) {
166 error++;
167 $("select[name='member\[pref\]']").css({'background-color': '#FFA'}).click(function() {
168 $(this).css({'background-color': '#FFF'});
169 });
170 }
171 if( "" == $("input[name='member\[address1\]']").val() ) {
172 error++;
173 $("input[name='member\[address1\]']").css({'background-color': '#FFA'}).click(function() {
174 $(this).css({'background-color': '#FFF'});
175 });
176 }
177 if( "" == $("input[name='member\[address2\]']").val() ) {
178 error++;
179 $("input[name='member\[address2\]']").css({'background-color': '#FFA'}).click(function() {
180 $(this).css({'background-color': '#FFF'});
181 });
182 }
183 if( "" == $("input[name='member\[tel\]']").val() ) {
184 error++;
185 $("input[name='member\[tel\]']").css({'background-color': '#FFA'}).click(function() {
186 $(this).css({'background-color': '#FFF'});
187 });
188 }
189 if( !checkNum( $("input[name='member\[point\]']").val() ) ) {
190 error++;
191 $("input[name='member\[point\]']").css({'background-color': '#FFA'}).click(function() {
192 $(this).css({'background-color': '#FFF'});
193 });
194 }
195
196 if( 0 < error ) {
197 $("#aniboxStatus").removeClass("none");
198 $("#aniboxStatus").addClass("error");
199 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
200 $("#info_massage").html("データに不備があります");
201 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
202 return false;
203 } else {
204 return true;
205 }
206 });
207 });
208
209 function addComma(str)
210 {
211 cnt = 0;
212 n = "";
213 for (i=str.length-1; i>=0; i--)
214 {
215 n = str.charAt(i) + n;
216 cnt++;
217 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
218 }
219 return n;
220 };
221 </script>
222 <div class="wrap">
223 <div class="usces_admin">
224 <form action="<?php echo USCES_ADMIN_URL.'?page=' . $page . '&member_action='.$oa; ?>" method="post" name="editpost" />
225 <?php if( $member_action == 'new' || $member_action == 'newpost' ) : ?>
226 <h2>Welcart Management <?php _e('New Membership Registration','usces'); ?></h2>
227 <?php else : ?>
228 <h2>Welcart Management <?php _e('Edit membership data','usces'); ?></h2>
229 <?php endif;?>
230
231 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
232 <div id="aniboxStatus" class="<?php echo $status; ?>">
233 <div id="anibox" class="clearfix">
234 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
235 <div class="mes" id="info_massage"><?php echo $message; ?></div>
236 </div>
237 </div>
238 <div class="ordernavi"><input name="upButton" class="upButton" type="submit" value="<?php _e('change decision', 'usces'); ?>" /><?php _e("When you change amount, please click 'Edit' before you finish your process.", 'usces'); ?></div>
239 <div class="info_head">
240 <div class="error_message"><?php echo $this->error_message; ?></div>
241 <table class="mem_wrap">
242 <tr>
243 <td class="label"><?php _e('membership number', 'usces'); ?></td><td class="col1"><div class="rod large short"><?php echo esc_html($data['ID']); ?></div></td>
244 <td colspan="2" rowspan="5" class="mem_col2">
245 <table class="mem_info">
246 <tr>
247 <td class="label">e-mail</td>
248 <td><input name="member[email]" type="text" class="text long" value="<?php echo esc_attr($data['mem_email']); ?>" /></td>
249 </tr>
250 <?php if( $member_action == 'new' || $member_action == 'newpost' ) : ?>
251 <tr>
252 <td class="label"><?php _e('password', 'usces'); ?></td>
253 <td><input name="member[password]" type="text" class="text" value="<?php echo esc_attr($data['mem_pass']); ?>" autocomplete="off" /></td>
254 </tr>
255 <?php endif; ?>
256 <?php echo uesces_get_admin_addressform( 'member', $data, $csmb_meta ); ?>
257 </table>
258 </td>
259 <td colspan="2" rowspan="5" class="mem_col3">
260 <table class="mem_info">
261 <?php
262 if( 0 < count($member_metas) ) :
263 $cardinfo = array( 'zeus'=>array(), 'remise'=>array(), 'digitalcheck'=>array() );
264 foreach( $member_metas as $value ) {
265 if( in_array( $value['meta_key'], array( 'zeus_pcid', 'zeus_partofcard', 'zeus_limitofcard' ) ) ) {
266 $cardinfo['zeus'][$value['meta_key']] = $value['meta_value'];
267 } elseif( in_array( $value['meta_key'], array( 'remise_pcid', 'partofcard', 'limitofcard', 'remise_memid' ) ) ) {
268 $cardinfo['remise'][$value['meta_key']] = $value['meta_value'];
269 } elseif( in_array( $value['meta_key'], array( 'digitalcheck_ip_user_id' ) ) ) {
270 $cardinfo['digitalcheck'][$value['meta_key']] = $value['meta_value'];
271 }
272 }
273 if( 0 < count($cardinfo['zeus']) ) :
274 foreach( $cardinfo['zeus'] as $key => $value ) :
275 if( $key != 'zeus_pcid' ) :
276 if( $key == 'zeus_partofcard' ) $label = __('下4桁','usces');
277 elseif( $key == 'zeus_limitofcard' ) $label = __('有効期限','usces');
278 else $label = $key; ?>
279 <tr>
280 <td class="label"><?php echo esc_html($label); ?></td>
281 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
282 </tr>
283 <?php endif;
284 endforeach;
285 if( array_key_exists( 'zeus_pcid', $cardinfo['zeus'] ) ) : ?>
286 <tr>
287 <td class="label">クイックチャージ</td>
288 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
289 </tr>
290 <?php if( defined('WCEX_AUTO_DELIVERY') and !wcad_have_member_regular_order( $ID ) ) : ?>
291 <tr>
292 <td class="label"><input type="checkbox" name="zeus_pcid" value="delete"></td>
293 <td>クイックチャージを解除する</td>
294 </tr>
295 <?php endif;
296 endif;
297 endif;
298 if( 0 < count($cardinfo['remise']) ) :
299 foreach( $cardinfo['remise'] as $key => $value ) :
300 if( $key != 'remise_pcid' ) :
301 if( $key == 'partofcard' ) $label = __('下4桁','usces');
302 elseif( $key == 'limitofcard' ) $label = __('有効期限','usces');
303 elseif( $key == 'remise_memid' ) $label = __('メンバーID','usces');
304 else $label = $key; ?>
305 <tr>
306 <td class="label"><?php echo esc_html($label); ?></td>
307 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
308 </tr>
309 <?php endif;
310 endforeach;
311 if( array_key_exists( 'remise_pcid', $cardinfo['remise'] ) ) : ?>
312 <tr>
313 <td class="label">ペイクイック</td>
314 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
315 </tr>
316 <tr>
317 <td class="label"><input type="checkbox" name="remise_pcid" value="delete"></td>
318 <td>ペイクイックを解除する</td>
319 </tr>
320 <?php endif;
321 endif;
322 if( 0 < count($cardinfo['digitalcheck']) ) :
323 foreach( $cardinfo['digitalcheck'] as $key => $value ) :
324 if( $key != 'digitalcheck_ip_user_id' ) : ?>
325 <tr>
326 <td class="label"><?php echo esc_html($key); ?></td>
327 <td><div class="rod_left shortm"><?php echo esc_html($value); ?></div></td>
328 </tr>
329 <?php endif;
330 endforeach;
331 if( array_key_exists( 'digitalcheck_ip_user_id', $cardinfo['digitalcheck'] ) ) : ?>
332 <tr>
333 <td class="label">ユーザID決済</td>
334 <td><div class="rod_left shortm"><?php _e('登録あり','usces'); ?></div></td>
335 </tr>
336 <tr>
337 <td class="label"><input type="checkbox" name="digitalcheck_ip_user_id" value="delete"></td>
338 <td>ユーザID決済を解除する</td>
339 </tr>
340 <?php endif;
341 endif;
342 endif;
343 ?>
344 </table>
345
346
347 </td>
348 </tr>
349 <tr>
350 <td class="label"><?php _e('Rank', 'usces'); ?></td><td class="col1"><select name="member[status]">
351 <?php foreach ((array)$this->member_status as $rk => $rv) :
352 $selected = ($rk == $data['mem_status']) ? ' selected="selected"' : ''; ?>
353 <option value="<?php echo esc_attr($rk); ?>"<?php echo $selected; ?>><?php echo esc_html($rv); ?></option>
354 <?php endforeach; ?>
355 </select></td>
356 </tr>
357 <tr>
358 <td class="label"><?php _e('current point', 'usces'); ?></td><td class="col1"><input name="member[point]" type="text" class="text right short num" value="<?php echo esc_html($data['mem_point']); ?>" /></td>
359 </tr>
360 <tr>
361 <td class="label"><?php _e('Strated date', 'usces'); ?></td><td class="col1"><div class="rod shortm"><?php echo esc_html(sprintf(__('%2$s %3$s, %1$s', 'usces'),substr($data['mem_registered'],0,4),substr($data['mem_registered'],5,2),substr($data['mem_registered'],8,2))); ?></div></td>
362 </tr>
363 <tr>
364 <td colspan="2"><?php do_action( 'usces_action_member_edit_form_left_blank', $ID ); ?></td>
365 </tr>
366 </table>
367 </div>
368 <div id="member_history">
369 <table>
370 <?php if ( !count($usces_member_history) ) : ?>
371 <tr>
372 <td><?php _e('There is no purchase history for this moment.', 'usces'); ?></td>
373 </tr>
374 <?php endif; ?>
375 <?php foreach ( (array)$usces_member_history as $umhs ) : $cart = $umhs['cart']; ?>
376 <?php $order_id = $umhs['ID']; ?>
377 <tr>
378 <th class="historyrow"><?php _e('Purchase date', 'usces'); ?></th>
379 <th class="historyrow"><?php _e('Order number', 'usces'); ?></th>
380 <th class="historyrow"><?php _e('Purchase price', 'usces'); ?></th>
381 <th class="historyrow"><?php _e('Used points','usces'); ?></th>
382 <th class="historyrow"><?php echo apply_filters( 'usces_member_discount_label', __('Special Price', 'usces'), $umhs['ID'] ); ?></th>
383 <th class="historyrow"><?php _e('Shipping', 'usces'); ?></th>
384 <th class="historyrow"><?php _e('C.O.D', 'usces'); ?></th>
385 <th class="historyrow"><?php _e('consumption tax', 'usces'); ?></th>
386 <th class="historyrow"><?php _e('Acquired points', 'usces'); ?></th>
387 </tr>
388 <tr>
389 <td><?php echo $umhs['date']; ?></td>
390 <td><a href="<?php echo USCES_ADMIN_URL; ?>?page=usces_orderlist&order_action=edit&order_id=<?php echo $order_id; ?>&usces_referer=<?php echo $curent_url; ?>"><?php echo usces_get_deco_order_id( $order_id ); ?></a></td>
391 <td class="rightnum"><?php usces_crform( $this->get_total_price($cart)-$umhs['usedpoint']+$umhs['discount']+$umhs['shipping_charge']+$umhs['cod_fee']+$umhs['tax'], true, false ); ?></td>
392 <td class="rightnum"><?php echo number_format($umhs['usedpoint']); ?></td>
393 <td class="rightnum"><?php usces_crform( $umhs['discount'], true, false ); ?></td>
394 <td class="rightnum"><?php usces_crform( $umhs['shipping_charge'], true, false ); ?></td>
395 <td class="rightnum"><?php usces_crform( $umhs['cod_fee'], true, false ); ?></td>
396 <td class="rightnum"><?php usces_crform( $umhs['tax'], true, false ); ?></td>
397 <td class="rightnum"><?php echo number_format($umhs['getpoint']); ?></td>
398 </tr>
399 <tr>
400 <td class="retail" colspan="9">
401 <table id="retail_table">
402 <tr>
403 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
404 <th class="thumbnail">&nbsp;</th>
405 <th><?php _e('Items','usces'); ?></th>
406 <th class="price "><?php _e('Unit price','usces'); ?>(<?php usces_crcode(); ?>)</th>
407 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
408 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
409 </tr>
410 <?php
411 for($i=0; $i<count($cart); $i++) {
412 $cart_row = $cart[$i];
413 $ordercart_id = $cart_row['cart_id'];
414 $post_id = $cart_row['post_id'];
415 $sku = urldecode($cart_row['sku']);
416 $quantity = $cart_row['quantity'];
417 $options = $cart_row['options'];
418 //$advance = $this->cart->wc_serialize($cart_row['advance']);
419 $advance = usces_get_ordercart_meta( 'advance', $ordercart_id );
420 // $itemCode = $this->getItemCode($post_id);
421 // $itemName = $this->getItemName($post_id);
422 $itemCode = $cart_row['item_code'];
423 $itemName = $cart_row['item_name'];
424 // $cartItemName = $this->getCartItemName($post_id, $sku);
425 $cartItemName = $this->getCartItemName_byOrder($cart_row);
426 //$skuPrice = $this->getItemPrice($post_id, $sku);
427 $skuPrice = $cart_row['price'];
428 $pictid = (int)$this->get_mainpictid($itemCode);
429 $optstr = '';
430 foreach((array)$options as $key => $value){
431 //20110629ysk start 0000190
432 //if( !empty($key) )
433 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
434 if( !empty($key) ) {
435 $key = urldecode($key);
436 $value = maybe_unserialize($value);
437 if(is_array($value)) {
438 $c = '';
439 $optstr .= esc_html($key) . ' : ';
440 foreach($value as $v) {
441 $optstr .= $c.nl2br(esc_html(urldecode($v)));
442 $c = ', ';
443 }
444 $optstr .= "<br />\n";
445 } else {
446 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
447 }
448 }
449 //20110629ysk end
450 }
451 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'quantity', 'options', 'advance',
452 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid', 'order_id' );
453 $optstr = apply_filters( 'usces_filter_member_edit_form_row', $optstr, $cart, $materials );
454 ?>
455 <tr>
456 <td><?php echo $i + 1; ?></td>
457 <td><?php echo wp_get_attachment_image( $pictid, array(60, 60), true ); ?></td>
458 <td class="aleft"><?php echo esc_html($cartItemName); ?><br /><?php echo $optstr; ?></td>
459 <td class="rightnum"><?php usces_crform( $skuPrice, true, false ); ?></td>
460 <td class="rightnum"><?php echo number_format($cart_row['quantity']); ?></td>
461 <td class="rightnum"><?php usces_crform( $skuPrice * $cart_row['quantity'], true, false ); ?></td>
462 </tr>
463 <?php
464 }
465 ?>
466 </table>
467 </td>
468 </tr>
469 <?php endforeach; ?>
470 </table>
471 </div>
472 <input name="member_action" type="hidden" value="<?php echo $oa; ?>" />
473 <input name="member_id" id="member_id" type="hidden" value="<?php echo $data['ID']; ?>" />
474
475
476 <div id="mailSendAlert" title="">
477 <div id="order-response"></div>
478 <fieldset>
479 </fieldset>
480 </div>
481 <?php wp_nonce_field( 'post_member', 'wc_nonce' ); ?>
482 </form>
483
484 </div><!--usces_admin-->
485 </div><!--wrap-->
486