PluginProbe
Welcart e-Commerce / 1.4.1
Welcart e-Commerce v1.4.1
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.1, at includes/member_edit_form.php

444 lines 15.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 //$deli = unserialize($data['order_delivery']);
119 //$cart = unserialize($data['order_cart']);
120 //$condition = unserialize($data['order_condition']);
121 //$ordercheck = unserialize($data['order_check']);
122 //if( !is_array($ordercheck) ) $ordercheck = array();
123 //
124 //if($this->is_status('duringorder', $data['order_status']))
125 // $taio = 'duringorder';
126 //else if($this->is_status('cancel', $data['order_status']))
127 // $taio = 'cancel';
128 //else if($this->is_status('completion', $data['order_status']))
129 // $taio = 'completion';
130 //else
131 // $taio = 'new';
132 //
133 //if($this->is_status('estimate', $data['order_status']))
134 // $admin = 'estimate';
135 //else if($this->is_status('adminorder', $data['order_status']))
136 // $admin = 'adminorder';
137 //else
138 // $admin = '';
139 //
140 //if($this->is_status('noreceipt', $data['order_status']))
141 // $receipt = 'noreceipt';
142 //else if($this->is_status('receipted', $data['order_status']))
143 // $receipt = 'receipted';
144 //else
145 // $receipt = '';
146 $curent_url = urlencode( USCES_ADMIN_URL.'?'.$_SERVER['QUERY_STRING'] );
147 ?>
148 <script type="text/javascript">
149 jQuery(function($){
150 <?php if($status == 'success'){ ?>
151 $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
152 <?php }else if($status == 'caution'){ ?>
153 $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
154 <?php }else if($status == 'error'){ ?>
155 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
156 <?php } ?>
157 var default_pre = '<?php _e('-- Select --', 'usces'); ?>';
158 $(".num").bind("change", function(){ usces_check_num($(this)); });
159
160 $('form').submit(function() {
161 var error = 0;
162
163 if( "" == $("input[name='member\[email\]']").val() ) {
164 error++;
165 $("input[name='member\[email\]']").css({'background-color': '#FFA'}).click(function() {
166 $(this).css({'background-color': '#FFF'});
167 });
168 }
169 if( "" == $("input[name='member\[password\]']").val() ) {
170 error++;
171 $("input[name='member\[password\]']").css({'background-color': '#FFA'}).click(function() {
172 $(this).css({'background-color': '#FFF'});
173 });
174 }
175 if( "" == $("input[name='member\[name1\]']").val() ) {
176 error++;
177 $("input[name='member\[name1\]']").css({'background-color': '#FFA'}).click(function() {
178 $(this).css({'background-color': '#FFF'});
179 });
180 }
181 if( "" == $("input[name='member\[name2\]']").val() ) {
182 error++;
183 $("input[name='member\[name2\]']").css({'background-color': '#FFA'}).click(function() {
184 $(this).css({'background-color': '#FFF'});
185 });
186 }
187 if( "" == $("input[name='member\[zipcode\]']").val() ) {
188 error++;
189 $("input[name='member\[zipcode\]']").css({'background-color': '#FFA'}).click(function() {
190 $(this).css({'background-color': '#FFF'});
191 });
192 }
193 if( default_pre == $("select[name='member\[pref\]']").val() || "" == $("select[name='member\[pref\]']").val() ) {
194 error++;
195 $("select[name='member\[pref\]']").css({'background-color': '#FFA'}).click(function() {
196 $(this).css({'background-color': '#FFF'});
197 });
198 }
199 if( "" == $("input[name='member\[address1\]']").val() ) {
200 error++;
201 $("input[name='member\[address1\]']").css({'background-color': '#FFA'}).click(function() {
202 $(this).css({'background-color': '#FFF'});
203 });
204 }
205 if( "" == $("input[name='member\[address2\]']").val() ) {
206 error++;
207 $("input[name='member\[address2\]']").css({'background-color': '#FFA'}).click(function() {
208 $(this).css({'background-color': '#FFF'});
209 });
210 }
211 if( "" == $("input[name='member\[tel\]']").val() ) {
212 error++;
213 $("input[name='member\[tel\]']").css({'background-color': '#FFA'}).click(function() {
214 $(this).css({'background-color': '#FFF'});
215 });
216 }
217 if( !checkNum( $("input[name='member\[point\]']").val() ) ) {
218 error++;
219 $("input[name='member\[point\]']").css({'background-color': '#FFA'}).click(function() {
220 $(this).css({'background-color': '#FFF'});
221 });
222 }
223
224 if( 0 < error ) {
225 $("#aniboxStatus").removeClass("none");
226 $("#aniboxStatus").addClass("error");
227 $("#info_image").attr("src", "<?php echo USCES_PLUGIN_URL; ?>/images/list_message_error.gif");
228 $("#info_massage").html("データに不備があります");
229 $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
230 return false;
231 } else {
232 return true;
233 }
234 });
235 });
236
237 function addComma(str)
238 {
239 cnt = 0;
240 n = "";
241 for (i=str.length-1; i>=0; i--)
242 {
243 n = str.charAt(i) + n;
244 cnt++;
245 if (((cnt % 3) == 0) && (i != 0)) n = ","+n;
246 }
247 return n;
248 };
249 </script>
250 <div class="wrap">
251 <div class="usces_admin">
252 <form action="<?php echo USCES_ADMIN_URL.'?page=' . $page . '&member_action='.$oa; ?>" method="post" name="editpost" />
253 <?php if( $member_action == 'new' || $member_action == 'newpost' ) : ?>
254 <h2>Welcart Management <?php _e('新規会員登録','usces'); ?></h2>
255 <?php else : ?>
256 <h2>Welcart Management <?php _e('Edit membership data','usces'); ?></h2>
257 <?php endif;?>
258
259 <p class="version_info">Version <?php echo USCES_VERSION; ?></p>
260 <div id="aniboxStatus" class="<?php echo $status; ?>">
261 <div id="anibox" class="clearfix">
262 <img id="info_image" src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
263 <div class="mes" id="info_massage"><?php echo $message; ?></div>
264 </div>
265 </div>
266 <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>
267 <div class="info_head">
268 <div class="error_message"><?php echo $this->error_message; ?></div>
269 <table class="mem_wrap">
270 <tr>
271 <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>
272 <td colspan="2" rowspan="5" class="mem_col2">
273 <table class="mem_info">
274 <tr>
275 <td class="label">e-mail</td>
276 <td><input name="member[email]" type="text" class="text long" value="<?php echo esc_attr($data['mem_email']); ?>" /></td>
277 </tr>
278 <?php if( $member_action == 'new' || $member_action == 'newpost' ) : ?>
279 <tr>
280 <td class="label"><?php _e('password', 'usces'); ?></td>
281 <td><input name="member[password]" type="text" class="text" value="<?php echo esc_attr($data['mem_pass']); ?>" autocomplete="off" /></td>
282 </tr>
283 <?php endif; ?>
284 <?php echo uesces_get_admin_addressform( 'member', $data, $csmb_meta ); ?>
285 </table>
286 </td>
287 <td colspan="2" rowspan="5" class="mem_col3">
288 <table class="mem_info">
289 <?php
290 foreach($member_metas as $value){
291 if( in_array($value['meta_key'], array('partofcard','limitofcard','remise_memid',)) ){
292 ?>
293 <tr>
294 <td class="label"><?php echo esc_html($value['meta_key']); ?></td>
295 <td><div class="rod_left"><?php echo esc_html($value['meta_value']); ?></div></td>
296 </tr>
297 <?php }} ?>
298 </table>
299
300
301 </td>
302 </tr>
303 <tr>
304 <td class="label"><?php _e('Rank', 'usces'); ?></td><td class="col1"><select name="member[status]">
305 <?php
306 foreach ((array)$this->member_status as $rk => $rv) {
307 $selected = ($rk == $data['mem_status']) ? ' selected="selected"' : '';
308 ?>
309 <option value="<?php echo esc_attr($rk); ?>"<?php echo $selected; ?>><?php echo esc_html($rv); ?></option>
310 <?php } ?>
311 </select></td>
312 </tr>
313 <tr>
314 <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>
315 <?php if( USCES_JP ): ?>
316 <?php endif; ?>
317 </tr>
318 <tr>
319 <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>
320 </tr>
321 <tr>
322 <td colspan="2"><?php do_action( 'usces_action_member_edit_form_left_blank', $ID ); ?></td>
323 </tr>
324 </table>
325 </div>
326 <div id="member_history">
327 <table>
328 <?php if ( !count($usces_member_history) ) : ?>
329 <tr>
330 <td><?php _e('There is no purchase history for this moment.', 'usces'); ?></td>
331 </tr>
332 <?php endif; ?>
333 <?php foreach ( (array)$usces_member_history as $umhs ) : $cart = $umhs['cart']; ?>
334 <?php $order_id = $umhs['ID']; ?>
335 <tr>
336 <th class="historyrow"><?php _e('Purchase date', 'usces'); ?></th>
337 <th class="historyrow"><?php _e('Order number', 'usces'); ?></th>
338 <th class="historyrow"><?php _e('Purchase price', 'usces'); ?></th>
339 <th class="historyrow"><?php _e('Used points','usces'); ?></th>
340 <th class="historyrow"><?php echo apply_filters( 'usces_member_discount_label', __('Special Price', 'usces'), $umhs['ID'] ); ?></th>
341 <th class="historyrow"><?php _e('Shipping', 'usces'); ?></th>
342 <th class="historyrow"><?php _e('C.O.D', 'usces'); ?></th>
343 <th class="historyrow"><?php _e('consumption tax', 'usces'); ?></th>
344 <th class="historyrow"><?php _e('Acquired points', 'usces'); ?></th>
345 </tr>
346 <tr>
347 <td><?php echo $umhs['date']; ?></td>
348 <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>
349 <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>
350 <td class="rightnum"><?php echo number_format($umhs['usedpoint']); ?></td>
351 <td class="rightnum"><?php usces_crform( $umhs['discount'], true, false ); ?></td>
352 <td class="rightnum"><?php usces_crform( $umhs['shipping_charge'], true, false ); ?></td>
353 <td class="rightnum"><?php usces_crform( $umhs['cod_fee'], true, false ); ?></td>
354 <td class="rightnum"><?php usces_crform( $umhs['tax'], true, false ); ?></td>
355 <td class="rightnum"><?php echo number_format($umhs['getpoint']); ?></td>
356 </tr>
357 <tr>
358 <td class="retail" colspan="9">
359 <table id="retail_table">
360 <tr>
361 <th scope="row" class="num"><?php echo __('No.','usces'); ?></th>
362 <th class="thumbnail">&nbsp;</th>
363 <th><?php _e('Items','usces'); ?></th>
364 <th class="price "><?php _e('Unit price','usces'); ?>(<?php usces_crcode(); ?>)</th>
365 <th class="quantity"><?php _e('Quantity','usces'); ?></th>
366 <th class="subtotal"><?php _e('Amount','usces'); ?>(<?php usces_crcode(); ?>)</th>
367 </tr>
368 <?php
369 for($i=0; $i<count($cart); $i++) {
370 $cart_row = $cart[$i];
371 $ordercart_id = $cart_row['cart_id'];
372 $post_id = $cart_row['post_id'];
373 $sku = urldecode($cart_row['sku']);
374 $quantity = $cart_row['quantity'];
375 $options = $cart_row['options'];
376 //$advance = $this->cart->wc_serialize($cart_row['advance']);
377 $advance = usces_get_ordercart_meta( 'advance', $ordercart_id );
378 // $itemCode = $this->getItemCode($post_id);
379 // $itemName = $this->getItemName($post_id);
380 $itemCode = $cart_row['item_code'];
381 $itemName = $cart_row['item_name'];
382 // $cartItemName = $this->getCartItemName($post_id, $sku);
383 $cartItemName = $this->getCartItemName_byOrder($cart_row);
384 //$skuPrice = $this->getItemPrice($post_id, $sku);
385 $skuPrice = $cart_row['price'];
386 $pictid = (int)$this->get_mainpictid($itemCode);
387 $optstr = '';
388 foreach((array)$options as $key => $value){
389 //20110629ysk start 0000190
390 //if( !empty($key) )
391 // $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
392 if( !empty($key) ) {
393 $key = urldecode($key);
394 $value = maybe_unserialize($value);
395 if(is_array($value)) {
396 $c = '';
397 $optstr .= esc_html($key) . ' : ';
398 foreach($value as $v) {
399 $optstr .= $c.nl2br(esc_html(urldecode($v)));
400 $c = ', ';
401 }
402 $optstr .= "<br />\n";
403 } else {
404 $optstr .= esc_html($key) . ' : ' . nl2br(esc_html(urldecode($value))) . "<br />\n";
405 }
406 }
407 //20110629ysk end
408 }
409 $materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'quantity', 'options', 'advance',
410 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid', 'order_id' );
411 $optstr = apply_filters( 'usces_filter_member_edit_form_row', $optstr, $cart, $materials );
412 ?>
413 <tr>
414 <td><?php echo $i + 1; ?></td>
415 <td><?php echo wp_get_attachment_image( $pictid, array(60, 60), true ); ?></td>
416 <td class="aleft"><?php echo esc_html($cartItemName); ?><br /><?php echo $optstr; ?></td>
417 <td class="rightnum"><?php usces_crform( $skuPrice, true, false ); ?></td>
418 <td class="rightnum"><?php echo number_format($cart_row['quantity']); ?></td>
419 <td class="rightnum"><?php usces_crform( $skuPrice * $cart_row['quantity'], true, false ); ?></td>
420 </tr>
421 <?php
422 }
423 ?>
424 </table>
425 </td>
426 </tr>
427 <?php endforeach; ?>
428 </table>
429 </div>
430 <input name="member_action" type="hidden" value="<?php echo $oa; ?>" />
431 <input name="member_id" id="member_id" type="hidden" value="<?php echo $data['ID']; ?>" />
432
433
434 <div id="mailSendAlert" title="">
435 <div id="order-response"></div>
436 <fieldset>
437 </fieldset>
438 </div>
439
440 </form>
441
442 </div><!--usces_admin-->
443 </div><!--wrap-->
444