Completed
Push — master ( f77a5b...d9795d )
by
unknown
12:33
created
includes/librairies/purchase/orders.class.php 3 patches
Doc Comments   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     }
260 260
 
261 261
     /** Renvoi une nouvelle r�f�rence unique pour une commande
262
-     * @return int
262
+     * @return string
263 263
      */
264 264
     public static function get_new_order_reference()
265 265
     {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     }
281 281
 
282 282
     /** Renvoi une nouvelle r�f�rence unique pour un devis
283
-     * @return int
283
+     * @return string
284 284
      */
285 285
     public static function get_new_pre_order_reference($save = true)
286 286
     {
@@ -654,6 +654,10 @@  discard block
 block discarded – undo
654 654
 
655 655
         return $output;
656 656
     }
657
+
658
+    /**
659
+     * @param boolean $state
660
+     */
657 661
     public static function display_customer_pay_quotation($state, $oid)
658 662
     {
659 663
         $btn = '<p><a role="button" data-nonce="' . wp_create_nonce('wps_quotation_is_payable_by_customer') . '" class="wps-bton-' . (($state) ? 'third' : 'second') . '-mini-rounded quotation_is_payable_by_customer" href="#" >' . __('Valid quotation', 'wpshop') . '</a></p>';
Please login to merge, or discard this patch.
Indentation   +593 added lines, -593 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (!defined('ABSPATH')) {
2
-    exit;
2
+	exit;
3 3
 }
4 4
 
5 5
 /**
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 /*    Check if file is include. No direct access possible with file url    */
16 16
 if (!defined('WPSHOP_VERSION')) {
17
-    die(__('Access is not allowed by this way', 'wpshop'));
17
+	die(__('Access is not allowed by this way', 'wpshop'));
18 18
 }
19 19
 
20 20
 /**
@@ -27,135 +27,135 @@  discard block
 block discarded – undo
27 27
 class wpshop_orders
28 28
 {
29 29
 
30
-    /**
31
-     * Create a new custom post type in wordpress for current element
32
-     */
33
-    public static function create_orders_type()
34
-    {
35
-        register_post_type(WPSHOP_NEWTYPE_IDENTIFIER_ORDER, array(
36
-            'labels' => array(
37
-                'name' => __('Orders', 'wpshop'),
38
-                'singular_name' => __('Order', 'wpshop'),
39
-                'add_new' => __('Add quotation', 'wpshop'),
40
-                'add_new_item' => __('Add new quotation', 'wpshop'),
41
-                'edit' => __('Edit', 'wpshop'),
42
-                'edit_item' => __('Edit Order', 'wpshop'),
43
-                'new_item' => __('New quotation', 'wpshop'),
44
-                'view' => __('View Order', 'wpshop'),
45
-                'view_item' => __('View Order', 'wpshop'),
46
-                'search_items' => __('Search Orders', 'wpshop'),
47
-                'not_found' => __('No Orders found', 'wpshop'),
48
-                'not_found_in_trash' => __('No Orders found in trash', 'wpshop'),
49
-                'parent' => __('Parent Orders', 'wpshop'),
50
-            ),
51
-            'description' => __('This is where store orders are stored.', 'wpshop'),
52
-            'public' => true,
53
-            'show_ui' => true,
54
-            'capability_type' => 'post',
55
-            'publicly_queryable' => false,
56
-            'exclude_from_search' => true,
57
-            'show_in_menu' => true,
58
-            'hierarchical' => false,
59
-            'show_in_nav_menus' => false,
60
-            'show_in_admin_bar' => false,
61
-            'rewrite' => false,
62
-            'query_var' => true,
63
-            'supports' => array(''),
64
-            'has_archive' => false,
65
-            'menu_icon' => 'dashicons-cart',
66
-        ));
67
-    }
68
-
69
-    /**
70
-     *    Call the different boxes in edition page
71
-     */
72
-    public static function add_meta_boxes()
73
-    {
74
-        global $post;
75
-
76
-        /**    Add action button    */
77
-        add_meta_box(
78
-            'wpshop_order_actions',
79
-            '<span class="dashicons dashicons-info"></span> ' . __('Actions on order', 'wpshop'),
80
-            array('wpshop_orders', 'order_actions'),
81
-            WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'high'
82
-        );
83
-
84
-        if (!in_array($post->post_status, array('auto-draft'))) {
85
-            add_meta_box('wpshop_credit_actions', __('Credit on order', 'wpshop'), array('wps_credit', 'wps_credit_meta_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
86
-        }
87
-
88
-        /**    Box    containing listing of customer notification */
30
+	/**
31
+	 * Create a new custom post type in wordpress for current element
32
+	 */
33
+	public static function create_orders_type()
34
+	{
35
+		register_post_type(WPSHOP_NEWTYPE_IDENTIFIER_ORDER, array(
36
+			'labels' => array(
37
+				'name' => __('Orders', 'wpshop'),
38
+				'singular_name' => __('Order', 'wpshop'),
39
+				'add_new' => __('Add quotation', 'wpshop'),
40
+				'add_new_item' => __('Add new quotation', 'wpshop'),
41
+				'edit' => __('Edit', 'wpshop'),
42
+				'edit_item' => __('Edit Order', 'wpshop'),
43
+				'new_item' => __('New quotation', 'wpshop'),
44
+				'view' => __('View Order', 'wpshop'),
45
+				'view_item' => __('View Order', 'wpshop'),
46
+				'search_items' => __('Search Orders', 'wpshop'),
47
+				'not_found' => __('No Orders found', 'wpshop'),
48
+				'not_found_in_trash' => __('No Orders found in trash', 'wpshop'),
49
+				'parent' => __('Parent Orders', 'wpshop'),
50
+			),
51
+			'description' => __('This is where store orders are stored.', 'wpshop'),
52
+			'public' => true,
53
+			'show_ui' => true,
54
+			'capability_type' => 'post',
55
+			'publicly_queryable' => false,
56
+			'exclude_from_search' => true,
57
+			'show_in_menu' => true,
58
+			'hierarchical' => false,
59
+			'show_in_nav_menus' => false,
60
+			'show_in_admin_bar' => false,
61
+			'rewrite' => false,
62
+			'query_var' => true,
63
+			'supports' => array(''),
64
+			'has_archive' => false,
65
+			'menu_icon' => 'dashicons-cart',
66
+		));
67
+	}
68
+
69
+	/**
70
+	 *    Call the different boxes in edition page
71
+	 */
72
+	public static function add_meta_boxes()
73
+	{
74
+		global $post;
75
+
76
+		/**    Add action button    */
77
+		add_meta_box(
78
+			'wpshop_order_actions',
79
+			'<span class="dashicons dashicons-info"></span> ' . __('Actions on order', 'wpshop'),
80
+			array('wpshop_orders', 'order_actions'),
81
+			WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'high'
82
+		);
83
+
84
+		if (!in_array($post->post_status, array('auto-draft'))) {
85
+			add_meta_box('wpshop_credit_actions', __('Credit on order', 'wpshop'), array('wps_credit', 'wps_credit_meta_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low');
86
+		}
87
+
88
+		/**    Box    containing listing of customer notification */
89 89
 //         $notifs = self::get_notification_by_object( array('object_type' => 'order', 'object_id' => $post->ID) );
90
-        //         if ( !empty($notifs) ) {
91
-        //             add_meta_box(
92
-        //                 'wpshop_order_customer_notification',
93
-        //                 __('Customer Notification', 'wpshop'),
94
-        //                 array('wpshop_orders', 'wpshop_order_customer_notification'),
95
-        //                     WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low'
96
-        //             );
97
-        //         }
98
-    }
99
-
100
-    /**
101
-     * Define the box for actions on order
102
-     *
103
-     * @param object $order The current order being edited
104
-     */
105
-    public static function order_actions($order)
106
-    {
107
-        $output = '';
108
-
109
-        $order_status = unserialize(WPSHOP_ORDER_STATUS);
110
-        $order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
111
-
112
-        $tpl_component = array();
113
-
114
-        $delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url(get_delete_post_link($order->ID)), 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') : __('Move to Trash', 'wpshop'))), array(), 'admin');
115
-        $tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can("delete_post", $order->ID) ? $delete_button : '';
116
-
117
-        /**    Add an action list    */
118
-        $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = '';
119
-
120
-        /**    Display main information about the order    */
121
-        $order_main_info = '';
122
-        if (!empty($order_postmeta['order_date'])) {
123
-            $order_main_info .= '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>' . __('Order date', 'wpshop') . ' : </strong><br/>' . mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true) . '</div>';
124
-        }
125
-        $order_main_info .= '<div class="wps-product-section">';
126
-        if (empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))) {
127
-            $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Temporary quotation reference', 'wpshop') . ': </strong>' . self::get_new_pre_order_reference(false) . '<br/>';
128
-        } else {
129
-            if (!empty($order_postmeta['order_key'])) {
130
-                $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Order reference', 'wpshop') . ' : </strong>' . $order_postmeta['order_key'] . '<br/>';
131
-            }
132
-            if (!empty($order_postmeta['order_temporary_key'])) {
133
-                $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Pre-order reference', 'wpshop') . ': </strong>' . $order_postmeta['order_temporary_key'] . '<br/>';
134
-                $post_ID = !empty($_GET['post']) ? (int) $_GET['post'] : 0;
135
-                $order_main_info .= '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf') . '">' . __('Download the quotation', 'wpshop') . '</a><br />';
136
-            }
137
-            if (!empty($order_postmeta['order_invoice_ref'])) {
138
-                $sub_tpl_component = array();
139
-                $order_invoice_download = '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf') . '">' . __('Download invoice', 'wpshop') . '</a><br />';
140
-                $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Invoice number', 'wpshop') . ': </strong>' . $order_postmeta['order_invoice_ref'] . '<br/>' . $order_invoice_download . '';
141
-            } else {
142
-                $order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin');
143
-            }
144
-        }
145
-        $order_main_info .= '</div>';
146
-
147
-        /*Add the current order status in display**/
148
-        $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= (!empty($order_postmeta['order_status'])) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop'))) : '';
149
-
150
-        $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= $order_main_info;
151
-
152
-        /**    Add a box allowing to notify the customer on order update    */
153
-        /**
154
-         *
155
-         * To check because notification is not really send
156
-         *
157
-         */
158
-        /*if ( !empty($order->post_author) ) {
90
+		//         if ( !empty($notifs) ) {
91
+		//             add_meta_box(
92
+		//                 'wpshop_order_customer_notification',
93
+		//                 __('Customer Notification', 'wpshop'),
94
+		//                 array('wpshop_orders', 'wpshop_order_customer_notification'),
95
+		//                     WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low'
96
+		//             );
97
+		//         }
98
+	}
99
+
100
+	/**
101
+	 * Define the box for actions on order
102
+	 *
103
+	 * @param object $order The current order being edited
104
+	 */
105
+	public static function order_actions($order)
106
+	{
107
+		$output = '';
108
+
109
+		$order_status = unserialize(WPSHOP_ORDER_STATUS);
110
+		$order_postmeta = get_post_meta($order->ID, '_order_postmeta', true);
111
+
112
+		$tpl_component = array();
113
+
114
+		$delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url(get_delete_post_link($order->ID)), 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') : __('Move to Trash', 'wpshop'))), array(), 'admin');
115
+		$tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can("delete_post", $order->ID) ? $delete_button : '';
116
+
117
+		/**    Add an action list    */
118
+		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = '';
119
+
120
+		/**    Display main information about the order    */
121
+		$order_main_info = '';
122
+		if (!empty($order_postmeta['order_date'])) {
123
+			$order_main_info .= '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>' . __('Order date', 'wpshop') . ' : </strong><br/>' . mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true) . '</div>';
124
+		}
125
+		$order_main_info .= '<div class="wps-product-section">';
126
+		if (empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))) {
127
+			$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Temporary quotation reference', 'wpshop') . ': </strong>' . self::get_new_pre_order_reference(false) . '<br/>';
128
+		} else {
129
+			if (!empty($order_postmeta['order_key'])) {
130
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Order reference', 'wpshop') . ' : </strong>' . $order_postmeta['order_key'] . '<br/>';
131
+			}
132
+			if (!empty($order_postmeta['order_temporary_key'])) {
133
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Pre-order reference', 'wpshop') . ': </strong>' . $order_postmeta['order_temporary_key'] . '<br/>';
134
+				$post_ID = !empty($_GET['post']) ? (int) $_GET['post'] : 0;
135
+				$order_main_info .= '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf') . '">' . __('Download the quotation', 'wpshop') . '</a><br />';
136
+			}
137
+			if (!empty($order_postmeta['order_invoice_ref'])) {
138
+				$sub_tpl_component = array();
139
+				$order_invoice_download = '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf') . '">' . __('Download invoice', 'wpshop') . '</a><br />';
140
+				$order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Invoice number', 'wpshop') . ': </strong>' . $order_postmeta['order_invoice_ref'] . '<br/>' . $order_invoice_download . '';
141
+			} else {
142
+				$order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin');
143
+			}
144
+		}
145
+		$order_main_info .= '</div>';
146
+
147
+		/*Add the current order status in display**/
148
+		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= (!empty($order_postmeta['order_status'])) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop'))) : '';
149
+
150
+		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= $order_main_info;
151
+
152
+		/**    Add a box allowing to notify the customer on order update    */
153
+		/**
154
+		 *
155
+		 * To check because notification is not really send
156
+		 *
157
+		 */
158
+		/*if ( !empty($order->post_author) ) {
159 159
         $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '
160 160
         <div class="wps-product-section wpshop_order_notify_customer_on_update_container" >
161 161
         <input type="checkbox" name="notif_the_customer" id="wpshop_order_notif_the_customer_on_update" /> <label for="wpshop_order_notif_the_customer_on_update" >'.__('Send a notification to the customer', 'wpshop').'</label>
@@ -163,290 +163,290 @@  discard block
 block discarded – undo
163 163
         </div>';
164 164
         }*/
165 165
 
166
-        if (in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0) {
167
-            if (((!empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation') || !empty($order_postmeta['order_temporary_key']))) {
168
-                $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation(isset($order_postmeta['pay_quotation']), $order->ID) . '</div>';
169
-            } else {
170
-                $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_order($order->ID) . '</div>';
171
-            }
172
-        }
173
-        /**
174
-         * Only for quotations
175
-         */
176
-        /*if( ( ( !empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation' ) || !empty( $order_postmeta['order_temporary_key'] ) ) && $order_postmeta['order_status'] != 'canceled' && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0 ) {
166
+		if (in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0) {
167
+			if (((!empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation') || !empty($order_postmeta['order_temporary_key']))) {
168
+				$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation(isset($order_postmeta['pay_quotation']), $order->ID) . '</div>';
169
+			} else {
170
+				$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_order($order->ID) . '</div>';
171
+			}
172
+		}
173
+		/**
174
+		 * Only for quotations
175
+		 */
176
+		/*if( ( ( !empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation' ) || !empty( $order_postmeta['order_temporary_key'] ) ) && $order_postmeta['order_status'] != 'canceled' && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0 ) {
177 177
         $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><input type="text" value="' . wpshop_checkout::wps_direct_payment_link_url( $order->ID ) . '"/></div>';
178 178
         }*/
179 179
 
180
-        /*Add the button regarding the order status**/
181
-        if (!empty($order_postmeta['order_status'])) {
182
-            if ($order_postmeta['order_status'] == 'awaiting_payment') {
183
-                $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_' . $order->ID . '" >' . __('Cancel this order', 'wpshop') . '</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>';
184
-            }
185
-            $credit_meta = get_post_meta($order->ID, '_wps_order_credit', true);
186
-
187
-            $total_received = (float) 0;
188
-            if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) {
189
-                foreach ($order_postmeta['order_payment']['received'] as $received) {
190
-                    $total_received += (float) isset($received['received_amount']) ? $received['received_amount'] : 0;
191
-                }
192
-            }
193
-
194
-            if (empty($credit_meta) && (float) 0 !== $total_received) {
195
-                if ($order_postmeta['order_status'] == 'refunded') {
196
-                    $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' . __('Credit Slip number', 'wpshop') . ' : <strong>' . ((!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref'])) ? '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&amp;invoice_ref=' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '&credit_slip=ok') . '" target="_blank">' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '</a>' : '') . '</strong></div>';
197
-                } else {
198
-                    $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' . $order->ID . '">' . __('Refund this order', 'wpshop') . '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>';
199
-                }
200
-            }
201
-        }
202
-        $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev(preg_replace(strrev('/wps-product-section/'), '', strrev($tpl_component['ADMIN_ORDER_ACTIONS_LIST']), 1));
203
-        echo wpshop_display::display_template_element('wpshop_admin_order_action_box', $tpl_component, array('type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID), 'admin');
204
-    }
205
-
206
-    public function order_container_in_admin()
207
-    {
208
-        global $post;
209
-        $output = '<div id="wps_order_content_container">';
210
-        $output .= self::order_content($post);
211
-        $output .= '</div>';
212
-        echo $output;
213
-    }
214
-
215
-    /**
216
-     * Display the order content: the list of element put into order
217
-     *
218
-     * @param order $post The complete order content
219
-     */
220
-    public function order_content($post)
221
-    {
222
-        $order_content = '';
223
-
224
-        $order = get_post_meta($post->ID, '_order_postmeta', true);
225
-
226
-        $order_content .= '<div id="order_product_container" class="order_product_container wpshop_cls" >';
227
-        if ($order) {
180
+		/*Add the button regarding the order status**/
181
+		if (!empty($order_postmeta['order_status'])) {
182
+			if ($order_postmeta['order_status'] == 'awaiting_payment') {
183
+				$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_' . $order->ID . '" >' . __('Cancel this order', 'wpshop') . '</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>';
184
+			}
185
+			$credit_meta = get_post_meta($order->ID, '_wps_order_credit', true);
186
+
187
+			$total_received = (float) 0;
188
+			if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) {
189
+				foreach ($order_postmeta['order_payment']['received'] as $received) {
190
+					$total_received += (float) isset($received['received_amount']) ? $received['received_amount'] : 0;
191
+				}
192
+			}
193
+
194
+			if (empty($credit_meta) && (float) 0 !== $total_received) {
195
+				if ($order_postmeta['order_status'] == 'refunded') {
196
+					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' . __('Credit Slip number', 'wpshop') . ' : <strong>' . ((!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref'])) ? '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&amp;invoice_ref=' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '&credit_slip=ok') . '" target="_blank">' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '</a>' : '') . '</strong></div>';
197
+				} else {
198
+					$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' . $order->ID . '">' . __('Refund this order', 'wpshop') . '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>';
199
+				}
200
+			}
201
+		}
202
+		$tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev(preg_replace(strrev('/wps-product-section/'), '', strrev($tpl_component['ADMIN_ORDER_ACTIONS_LIST']), 1));
203
+		echo wpshop_display::display_template_element('wpshop_admin_order_action_box', $tpl_component, array('type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID), 'admin');
204
+	}
205
+
206
+	public function order_container_in_admin()
207
+	{
208
+		global $post;
209
+		$output = '<div id="wps_order_content_container">';
210
+		$output .= self::order_content($post);
211
+		$output .= '</div>';
212
+		echo $output;
213
+	}
214
+
215
+	/**
216
+	 * Display the order content: the list of element put into order
217
+	 *
218
+	 * @param order $post The complete order content
219
+	 */
220
+	public function order_content($post)
221
+	{
222
+		$order_content = '';
223
+
224
+		$order = get_post_meta($post->ID, '_order_postmeta', true);
225
+
226
+		$order_content .= '<div id="order_product_container" class="order_product_container wpshop_cls" >';
227
+		if ($order) {
228 228
 /*    Read the order content if the order has product    */
229
-            $order_content .= '<input type="hidden" value="" name="order_products_to_delete" id="order_products_to_delete" />' . wpshop_cart::display_cart(true, $order, 'admin');
230
-            if (empty($order['order_invoice_ref'])) {
231
-                $order_content .= '<div id="order_refresh_button_container" class="wpshop_clear_block" ><input type="button" class="button-primary alignright wpshopHide" id="wpshop_admin_order_recalculate" value="' . __('Refresh order informations', 'wpshop') . '" /></div>';
232
-            }
233
-        }
234
-        $order_content .= '<div class="wpshop_cls" ></div></div>';
235
-
236
-        return $order_content;
237
-    }
238
-
239
-    /** Generate the billing reference regarding the order $order_id
240
-     * @return void
241
-     */
242
-    public function order_generate_billing_number($order_id, $force_invoicing = false)
243
-    {
244
-        global $wpdb, $wpshop_modules_billing;
245
-
246
-        // Get the order from the db
247
-        $order = get_post_meta($order_id, '_order_postmeta', true);
248
-
249
-        // If the payment is completed
250
-        if (($order['order_status'] == 'completed') || $force_invoicing) {
251
-
252
-            // If the reference hasn't been generated yet
253
-            if (empty($order['order_invoice_ref'])) {
254
-                $order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number($order_id);
255
-
256
-                update_post_meta($order_id, '_order_postmeta', $order);
257
-            }
258
-        }
259
-    }
260
-
261
-    /** Renvoi une nouvelle r�f�rence unique pour une commande
262
-     * @return int
263
-     */
264
-    public static function get_new_order_reference()
265
-    {
266
-        $number_figures = get_option('wpshop_order_number_figures', false);
267
-        /* If the number doesn't exist, we create a default one */
268
-        if (!$number_figures) {
269
-            $number_figures = 5;
270
-            update_option('wpshop_order_number_figures', $number_figures);
271
-        }
272
-
273
-        $order_current_number = get_option('wpshop_order_current_number', false);
274
-        /* If the counter doesn't exist, we initiate it */
275
-        if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
276
-        update_option('wpshop_order_current_number', $order_current_number);
277
-
278
-        $order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
279
-        return WPSHOP_ORDER_REFERENCE_PREFIX . $order_ref;
280
-    }
281
-
282
-    /** Renvoi une nouvelle r�f�rence unique pour un devis
283
-     * @return int
284
-     */
285
-    public static function get_new_pre_order_reference($save = true)
286
-    {
287
-        $number_figures = get_option('wpshop_order_number_figures', false);
288
-        /* If the number doesn't exist, we create a default one */
289
-        if (!$number_figures) {
290
-            $number_figures = 5;
291
-            update_option('wpshop_order_number_figures', $number_figures);
292
-        }
293
-
294
-        $order_current_number = get_option('wpshop_preorder_current_number', false);
295
-        /* If the counter doesn't exist, we initiate it */
296
-        if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
297
-        if ($save) {
298
-            update_option('wpshop_preorder_current_number', $order_current_number);
299
-        }
300
-
301
-        $order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
302
-        return WPSHOP_PREORDER_REFERENCE_PREFIX . $order_ref;
303
-    }
304
-
305
-    /**
306
-     *    Add information about user to the selected order
307
-     *
308
-     *    @param int $user_id The user identifier to get information for and to add to order meta informations
309
-     *    @param int $order_id The order identifier to update meta information for
310
-     *
311
-     *    @return void
312
-     */
313
-    public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id = '', $billing_address_id = '')
314
-    {
315
-        /**    Get order informations    */
316
-        $billing_info['id'] = get_post_meta($billing_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
317
-        $billing_info['address'] = get_post_meta($billing_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
318
-        $billing_info['address_id'] = (!empty($_SESSION['billing_address'])) ? intval($_SESSION['billing_address']) : '';
319
-        if (!empty($_SESSION['shipping_partner_id'])) {
320
-            $partner_address_id = get_post_meta($_SESSION['shipping_partner_id'], '_wpshop_attached_address', true);
321
-            if (!empty($partner_address_id)) {
322
-                foreach ($partner_address_id as $address_id) {
323
-                    $shipping_info['id'] = get_post_meta($address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
324
-                    $shipping_info['address'] = get_post_meta($address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
325
-                }
326
-            }
327
-        } else {
328
-            $shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
329
-            $shipping_info['address'] = get_post_meta($shipping_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
330
-            $shipping_info['address_id'] = (!empty($_SESSION['shipping_address'])) ? intval($_SESSION['shipping_address']) : '';
331
-        }
332
-
333
-        $order_info = array('billing' => $billing_info, 'shipping' => $shipping_info);
334
-
335
-        /**    Update order info metadata with new shipping    */
336
-        update_post_meta($order_id, '_order_info', $order_info);
337
-    }
338
-
339
-    /** Set the custom colums
340
-     * @return array
341
-     */
342
-    public static function orders_edit_columns($columns)
343
-    {
344
-        $columns = array(
345
-            'cb' => '<input type="checkbox" />',
346
-            'order_identifier' => __('Identifiers', 'wpshop'),
347
-            'order_status' => __('Status', 'wpshop'),
348
-            'order_type' => __('Order type', 'wpshop'),
349
-            'order_billing' => __('Billing', 'wpshop'),
350
-            'order_shipping' => __('Shipping', 'wpshop'),
351
-            'order_total' => __('Order total', 'wpshop'),
352
-            'date' => __('Date', 'wpshop'),
353
-            //'order_actions' => __('Actions', 'wpshop')
354
-        );
355
-
356
-        return $columns;
357
-    }
358
-
359
-    /** Give the content by column
360
-     * @return array
361
-     */
362
-    public static function orders_custom_columns($column, $post_id)
363
-    {
364
-        if (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
365
-            global $civility, $order_status;
366
-
367
-            $metadata = get_post_custom();
368
-
369
-            $order_postmeta = isset($metadata['_order_postmeta'][0]) ? unserialize($metadata['_order_postmeta'][0]) : '';
370
-            $addresses = get_post_meta($post_id, '_order_info', true);
371
-
372
-            switch ($column) {
373
-                case "order_identifier":
374
-                    if (!empty($order_postmeta['order_key'])) {
375
-                        echo '<b>' . $order_postmeta['order_key'] . '</b><br>';
376
-                    }
377
-                    if (!empty($order_postmeta['order_invoice_ref'])) {
378
-                        echo '<i>' . $order_postmeta['order_invoice_ref'] . '</i>';
379
-                    } elseif (!empty($order_postmeta['order_temporary_key'])) {
380
-                        echo '<b>' . $order_postmeta['order_temporary_key'] . '</b>';
381
-                    }
382
-                    break;
383
-
384
-                case "order_status":
385
-                    echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_' . $post_id . '">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop');
386
-                    break;
387
-
388
-                case "order_billing":
389
-                    if (!empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address'])) {
390
-                        $billing = $addresses['billing']['address'];
391
-                    } else if (!empty($addresses['billing'])) {
392
-                        $billing = $addresses['billing'];
393
-                    }
394
-                    if (!empty($billing)) {
395
-                        echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null) . ' <strong>' . (!empty($billing['address_first_name']) ? $billing['address_first_name'] : null) . ' ' . (!empty($billing['address_last_name']) ? $billing['address_last_name'] : null) . '</strong>';
396
-                        echo empty($billing['company']) ? '<br />' : ', <i>' . $billing['company'] . '</i><br />';
397
-                        echo !empty($billing['address']) ? $billing['address'] : null;
398
-                        echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
399
-                        echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
400
-                        echo !empty($billing['country']) ? $billing['country'] : null;
401
-                        echo (!empty($billing['phone']) ? '<br /><b>' . $billing['phone'] . '</b>' : '');
402
-                    } else {
403
-                        echo __('No information available for user billing', 'wpshop');
404
-                    }
405
-                    break;
406
-
407
-                case "order_shipping":
408
-                    if (!empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address'])) {
409
-                        $shipping = $addresses['shipping']['address'];
410
-                    } else if (!empty($addresses['shipping'])) {
411
-                        $shipping = $addresses['shipping'];
412
-                    }
413
-                    if (!empty($shipping)) {
414
-                        echo '<strong>' . (!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null) . ' ' . (!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null) . '</strong>';
415
-                        echo empty($shipping['company']) ? '<br />' : ', <i>' . $shipping['company'] . '</i><br />';
416
-                        echo (!empty($shipping['address']) ? $shipping['address'] : null);
417
-                        echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
418
-                        echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
419
-                        echo !empty($billing['country']) ? $billing['country'] : null;
420
-                    } else {
421
-                        echo __('No information available for user shipping', 'wpshop');
422
-                    }
423
-                    break;
424
-
425
-                case "order_type":
426
-                    echo '<a href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . (!empty($order_postmeta['order_temporary_key']) ? __('Quotation', 'wpshop') : __('Basic order', 'wpshop')) . '</a>';
427
-                    $buttons = '<p class="row-actions">';
428
-                    // Voir la commande
429
-                    $buttons .= '<a class="button button-small" href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . __('View', 'wpshop') . '</a>';
430
-                    // Marquer comme envoy�
431
-                    if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) {
432
-                        $buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_' . $post_id . ' wps-bton-loader">' . __('Mark as shipped', 'wpshop') . '</a> ';
433
-                    } else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment')) {
434
-                        //        $buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' ';
435
-                    }
436
-                    $buttons .= '</p>';
437
-                    $buttons .= '<input type="hidden" name="input_wpshop_change_order_state" id="input_wpshop_change_order_state" value="' . wp_create_nonce("wpshop_change_order_state") . '" />';
438
-                    $buttons .= '<input type="hidden" name="input_wpshop_dialog_inform_shipping_number" id="input_wpshop_dialog_inform_shipping_number" value="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '" />';
439
-                    $buttons .= '<input type="hidden" name="input_wpshop_validate_payment_method" id="input_wpshop_validate_payment_method" value="' . wp_create_nonce("wpshop_validate_payment_method") . '" />';
440
-
441
-                    echo $buttons;
442
-                    break;
443
-
444
-                case "order_total":
445
-                    $currency = !empty($order_postmeta['order_currency']) ? $order_postmeta['order_currency'] : get_option('wpshop_shop_default_currency');
446
-                    echo isset($order_postmeta['order_grand_total']) ? number_format($order_postmeta['order_grand_total'], 2, '.', '') . ' ' . wpshop_tools::wpshop_get_sigle($currency) : 'NaN';
447
-                    break;
448
-
449
-                    /*case "order_actions":
229
+			$order_content .= '<input type="hidden" value="" name="order_products_to_delete" id="order_products_to_delete" />' . wpshop_cart::display_cart(true, $order, 'admin');
230
+			if (empty($order['order_invoice_ref'])) {
231
+				$order_content .= '<div id="order_refresh_button_container" class="wpshop_clear_block" ><input type="button" class="button-primary alignright wpshopHide" id="wpshop_admin_order_recalculate" value="' . __('Refresh order informations', 'wpshop') . '" /></div>';
232
+			}
233
+		}
234
+		$order_content .= '<div class="wpshop_cls" ></div></div>';
235
+
236
+		return $order_content;
237
+	}
238
+
239
+	/** Generate the billing reference regarding the order $order_id
240
+	 * @return void
241
+	 */
242
+	public function order_generate_billing_number($order_id, $force_invoicing = false)
243
+	{
244
+		global $wpdb, $wpshop_modules_billing;
245
+
246
+		// Get the order from the db
247
+		$order = get_post_meta($order_id, '_order_postmeta', true);
248
+
249
+		// If the payment is completed
250
+		if (($order['order_status'] == 'completed') || $force_invoicing) {
251
+
252
+			// If the reference hasn't been generated yet
253
+			if (empty($order['order_invoice_ref'])) {
254
+				$order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number($order_id);
255
+
256
+				update_post_meta($order_id, '_order_postmeta', $order);
257
+			}
258
+		}
259
+	}
260
+
261
+	/** Renvoi une nouvelle r�f�rence unique pour une commande
262
+	 * @return int
263
+	 */
264
+	public static function get_new_order_reference()
265
+	{
266
+		$number_figures = get_option('wpshop_order_number_figures', false);
267
+		/* If the number doesn't exist, we create a default one */
268
+		if (!$number_figures) {
269
+			$number_figures = 5;
270
+			update_option('wpshop_order_number_figures', $number_figures);
271
+		}
272
+
273
+		$order_current_number = get_option('wpshop_order_current_number', false);
274
+		/* If the counter doesn't exist, we initiate it */
275
+		if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
276
+		update_option('wpshop_order_current_number', $order_current_number);
277
+
278
+		$order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
279
+		return WPSHOP_ORDER_REFERENCE_PREFIX . $order_ref;
280
+	}
281
+
282
+	/** Renvoi une nouvelle r�f�rence unique pour un devis
283
+	 * @return int
284
+	 */
285
+	public static function get_new_pre_order_reference($save = true)
286
+	{
287
+		$number_figures = get_option('wpshop_order_number_figures', false);
288
+		/* If the number doesn't exist, we create a default one */
289
+		if (!$number_figures) {
290
+			$number_figures = 5;
291
+			update_option('wpshop_order_number_figures', $number_figures);
292
+		}
293
+
294
+		$order_current_number = get_option('wpshop_preorder_current_number', false);
295
+		/* If the counter doesn't exist, we initiate it */
296
+		if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
297
+		if ($save) {
298
+			update_option('wpshop_preorder_current_number', $order_current_number);
299
+		}
300
+
301
+		$order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
302
+		return WPSHOP_PREORDER_REFERENCE_PREFIX . $order_ref;
303
+	}
304
+
305
+	/**
306
+	 *    Add information about user to the selected order
307
+	 *
308
+	 *    @param int $user_id The user identifier to get information for and to add to order meta informations
309
+	 *    @param int $order_id The order identifier to update meta information for
310
+	 *
311
+	 *    @return void
312
+	 */
313
+	public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id = '', $billing_address_id = '')
314
+	{
315
+		/**    Get order informations    */
316
+		$billing_info['id'] = get_post_meta($billing_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
317
+		$billing_info['address'] = get_post_meta($billing_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
318
+		$billing_info['address_id'] = (!empty($_SESSION['billing_address'])) ? intval($_SESSION['billing_address']) : '';
319
+		if (!empty($_SESSION['shipping_partner_id'])) {
320
+			$partner_address_id = get_post_meta($_SESSION['shipping_partner_id'], '_wpshop_attached_address', true);
321
+			if (!empty($partner_address_id)) {
322
+				foreach ($partner_address_id as $address_id) {
323
+					$shipping_info['id'] = get_post_meta($address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
324
+					$shipping_info['address'] = get_post_meta($address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
325
+				}
326
+			}
327
+		} else {
328
+			$shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true);
329
+			$shipping_info['address'] = get_post_meta($shipping_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
330
+			$shipping_info['address_id'] = (!empty($_SESSION['shipping_address'])) ? intval($_SESSION['shipping_address']) : '';
331
+		}
332
+
333
+		$order_info = array('billing' => $billing_info, 'shipping' => $shipping_info);
334
+
335
+		/**    Update order info metadata with new shipping    */
336
+		update_post_meta($order_id, '_order_info', $order_info);
337
+	}
338
+
339
+	/** Set the custom colums
340
+	 * @return array
341
+	 */
342
+	public static function orders_edit_columns($columns)
343
+	{
344
+		$columns = array(
345
+			'cb' => '<input type="checkbox" />',
346
+			'order_identifier' => __('Identifiers', 'wpshop'),
347
+			'order_status' => __('Status', 'wpshop'),
348
+			'order_type' => __('Order type', 'wpshop'),
349
+			'order_billing' => __('Billing', 'wpshop'),
350
+			'order_shipping' => __('Shipping', 'wpshop'),
351
+			'order_total' => __('Order total', 'wpshop'),
352
+			'date' => __('Date', 'wpshop'),
353
+			//'order_actions' => __('Actions', 'wpshop')
354
+		);
355
+
356
+		return $columns;
357
+	}
358
+
359
+	/** Give the content by column
360
+	 * @return array
361
+	 */
362
+	public static function orders_custom_columns($column, $post_id)
363
+	{
364
+		if (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
365
+			global $civility, $order_status;
366
+
367
+			$metadata = get_post_custom();
368
+
369
+			$order_postmeta = isset($metadata['_order_postmeta'][0]) ? unserialize($metadata['_order_postmeta'][0]) : '';
370
+			$addresses = get_post_meta($post_id, '_order_info', true);
371
+
372
+			switch ($column) {
373
+				case "order_identifier":
374
+					if (!empty($order_postmeta['order_key'])) {
375
+						echo '<b>' . $order_postmeta['order_key'] . '</b><br>';
376
+					}
377
+					if (!empty($order_postmeta['order_invoice_ref'])) {
378
+						echo '<i>' . $order_postmeta['order_invoice_ref'] . '</i>';
379
+					} elseif (!empty($order_postmeta['order_temporary_key'])) {
380
+						echo '<b>' . $order_postmeta['order_temporary_key'] . '</b>';
381
+					}
382
+					break;
383
+
384
+				case "order_status":
385
+					echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_' . $post_id . '">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop');
386
+					break;
387
+
388
+				case "order_billing":
389
+					if (!empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address'])) {
390
+						$billing = $addresses['billing']['address'];
391
+					} else if (!empty($addresses['billing'])) {
392
+						$billing = $addresses['billing'];
393
+					}
394
+					if (!empty($billing)) {
395
+						echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null) . ' <strong>' . (!empty($billing['address_first_name']) ? $billing['address_first_name'] : null) . ' ' . (!empty($billing['address_last_name']) ? $billing['address_last_name'] : null) . '</strong>';
396
+						echo empty($billing['company']) ? '<br />' : ', <i>' . $billing['company'] . '</i><br />';
397
+						echo !empty($billing['address']) ? $billing['address'] : null;
398
+						echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
399
+						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
400
+						echo !empty($billing['country']) ? $billing['country'] : null;
401
+						echo (!empty($billing['phone']) ? '<br /><b>' . $billing['phone'] . '</b>' : '');
402
+					} else {
403
+						echo __('No information available for user billing', 'wpshop');
404
+					}
405
+					break;
406
+
407
+				case "order_shipping":
408
+					if (!empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address'])) {
409
+						$shipping = $addresses['shipping']['address'];
410
+					} else if (!empty($addresses['shipping'])) {
411
+						$shipping = $addresses['shipping'];
412
+					}
413
+					if (!empty($shipping)) {
414
+						echo '<strong>' . (!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null) . ' ' . (!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null) . '</strong>';
415
+						echo empty($shipping['company']) ? '<br />' : ', <i>' . $shipping['company'] . '</i><br />';
416
+						echo (!empty($shipping['address']) ? $shipping['address'] : null);
417
+						echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null;
418
+						echo !empty($billing['city']) ? $billing['city'] . ', ' : null;
419
+						echo !empty($billing['country']) ? $billing['country'] : null;
420
+					} else {
421
+						echo __('No information available for user shipping', 'wpshop');
422
+					}
423
+					break;
424
+
425
+				case "order_type":
426
+					echo '<a href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . (!empty($order_postmeta['order_temporary_key']) ? __('Quotation', 'wpshop') : __('Basic order', 'wpshop')) . '</a>';
427
+					$buttons = '<p class="row-actions">';
428
+					// Voir la commande
429
+					$buttons .= '<a class="button button-small" href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . __('View', 'wpshop') . '</a>';
430
+					// Marquer comme envoy�
431
+					if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) {
432
+						$buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_' . $post_id . ' wps-bton-loader">' . __('Mark as shipped', 'wpshop') . '</a> ';
433
+					} else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment')) {
434
+						//        $buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' ';
435
+					}
436
+					$buttons .= '</p>';
437
+					$buttons .= '<input type="hidden" name="input_wpshop_change_order_state" id="input_wpshop_change_order_state" value="' . wp_create_nonce("wpshop_change_order_state") . '" />';
438
+					$buttons .= '<input type="hidden" name="input_wpshop_dialog_inform_shipping_number" id="input_wpshop_dialog_inform_shipping_number" value="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '" />';
439
+					$buttons .= '<input type="hidden" name="input_wpshop_validate_payment_method" id="input_wpshop_validate_payment_method" value="' . wp_create_nonce("wpshop_validate_payment_method") . '" />';
440
+
441
+					echo $buttons;
442
+					break;
443
+
444
+				case "order_total":
445
+					$currency = !empty($order_postmeta['order_currency']) ? $order_postmeta['order_currency'] : get_option('wpshop_shop_default_currency');
446
+					echo isset($order_postmeta['order_grand_total']) ? number_format($order_postmeta['order_grand_total'], 2, '.', '') . ' ' . wpshop_tools::wpshop_get_sigle($currency) : 'NaN';
447
+					break;
448
+
449
+					/*case "order_actions":
450 450
             $buttons = '<p class="row-actions">';
451 451
             // Marquer comme envoy�
452 452
             if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) {
@@ -465,59 +465,59 @@  discard block
 block discarded – undo
465 465
 
466 466
             echo $buttons;
467 467
             break;*/
468
-            }
469
-
470
-        }
471
-    }
472
-
473
-    public static function list_table_filters()
474
-    {
475
-        $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
476
-        $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
477
-        $entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
478
-        $entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
479
-
480
-        if (isset($post_type)) {
481
-            if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) {
482
-                $filter_possibilities = array();
483
-                $filter_possibilities['all'] = __('-- Select Filter --', 'wpshop');
484
-                $filter_possibilities['only_orders'] = __('List orders only', 'wpshop');
485
-                $filter_possibilities['quotations'] = __('List quotations only', 'wpshop');
486
-                $filter_possibilities['free_orders'] = __('List orders free', 'wpshop');
487
-                echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, $entity_filter, '', 'index');
488
-                $min = $entity_filter_btpf;
489
-                $max = $entity_filter_btps;
490
-                echo ' <label for="entity_filter_btpf">' . __('Between two prices', 'wpshop') . '</label> ';
491
-                echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="' . __('Minimum price', 'wpshop') . '"', null);
492
-                echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="' . __('Maximum price', 'wpshop') . '"', null);
493
-            }
494
-        }
495
-    }
496
-
497
-    public static function list_table_filter_parse_query($query)
498
-    {
499
-        global $pagenow, $wpdb;
500
-        $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
501
-        $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
502
-        $entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
503
-        $entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
504
-
505
-        if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) && !empty($entity_filter)) {
506
-            $check = null;
507
-            switch ($entity_filter) {
508
-                case 'all':
509
-                    $sql_query = $wpdb->prepare(
510
-                        "SELECT ID
468
+			}
469
+
470
+		}
471
+	}
472
+
473
+	public static function list_table_filters()
474
+	{
475
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
476
+		$entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
477
+		$entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
478
+		$entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
479
+
480
+		if (isset($post_type)) {
481
+			if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) {
482
+				$filter_possibilities = array();
483
+				$filter_possibilities['all'] = __('-- Select Filter --', 'wpshop');
484
+				$filter_possibilities['only_orders'] = __('List orders only', 'wpshop');
485
+				$filter_possibilities['quotations'] = __('List quotations only', 'wpshop');
486
+				$filter_possibilities['free_orders'] = __('List orders free', 'wpshop');
487
+				echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, $entity_filter, '', 'index');
488
+				$min = $entity_filter_btpf;
489
+				$max = $entity_filter_btps;
490
+				echo ' <label for="entity_filter_btpf">' . __('Between two prices', 'wpshop') . '</label> ';
491
+				echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="' . __('Minimum price', 'wpshop') . '"', null);
492
+				echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="' . __('Maximum price', 'wpshop') . '"', null);
493
+			}
494
+		}
495
+	}
496
+
497
+	public static function list_table_filter_parse_query($query)
498
+	{
499
+		global $pagenow, $wpdb;
500
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
501
+		$entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
502
+		$entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : '';
503
+		$entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : '';
504
+
505
+		if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) && !empty($entity_filter)) {
506
+			$check = null;
507
+			switch ($entity_filter) {
508
+				case 'all':
509
+					$sql_query = $wpdb->prepare(
510
+						"SELECT ID
511 511
 						FROM {$wpdb->posts}
512 512
 						WHERE post_type = %s
513 513
 						AND post_status != %s",
514
-                        WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
515
-                        'auto-draft');
516
-                    $check = 'post__in';
517
-                    break;
518
-                case 'only_orders':
519
-                    $sql_query = $wpdb->prepare(
520
-                        "SELECT ID
514
+						WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
515
+						'auto-draft');
516
+					$check = 'post__in';
517
+					break;
518
+				case 'only_orders':
519
+					$sql_query = $wpdb->prepare(
520
+						"SELECT ID
521 521
 						FROM {$wpdb->posts}
522 522
 						INNER JOIN {$wpdb->postmeta}
523 523
 						ON post_id = ID
@@ -526,16 +526,16 @@  discard block
 block discarded – undo
526 526
 						AND meta_value NOT LIKE %s
527 527
 						WHERE post_type = %s
528 528
 						AND post_status != %s",
529
-                        '_order_postmeta',
530
-                        '%s:9:"cart_type";s:9:"quotation";%',
531
-                        '%s:17:"order_grand_total";d:0;%',
532
-                        WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
533
-                        'auto-draft');
534
-                    $check = 'post__in';
535
-                    break;
536
-                case 'quotations':
537
-                    $sql_query = $wpdb->prepare(
538
-                        "SELECT ID
529
+						'_order_postmeta',
530
+						'%s:9:"cart_type";s:9:"quotation";%',
531
+						'%s:17:"order_grand_total";d:0;%',
532
+						WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
533
+						'auto-draft');
534
+					$check = 'post__in';
535
+					break;
536
+				case 'quotations':
537
+					$sql_query = $wpdb->prepare(
538
+						"SELECT ID
539 539
 						FROM {$wpdb->posts}
540 540
 						INNER JOIN {$wpdb->postmeta}
541 541
 						ON post_id = ID
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 						AND meta_value LIKE %s
544 544
 						WHERE post_type = %s
545 545
 						AND post_status != %s",
546
-                        '_order_postmeta',
547
-                        '%s:9:"cart_type";s:9:"quotation";%',
548
-                        WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
549
-                        'auto-draft');
550
-                    $check = 'post__in';
551
-                    break;
552
-                case 'free_orders':
553
-                    $sql_query = $wpdb->prepare(
554
-                        "SELECT ID
546
+						'_order_postmeta',
547
+						'%s:9:"cart_type";s:9:"quotation";%',
548
+						WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
549
+						'auto-draft');
550
+					$check = 'post__in';
551
+					break;
552
+				case 'free_orders':
553
+					$sql_query = $wpdb->prepare(
554
+						"SELECT ID
555 555
 							FROM {$wpdb->posts}
556 556
 							INNER JOIN {$wpdb->postmeta}
557 557
 							ON post_id = ID
@@ -559,121 +559,121 @@  discard block
 block discarded – undo
559 559
 							AND meta_value LIKE %s
560 560
 							WHERE post_type = %s
561 561
 							AND post_status != %s",
562
-                        '_order_postmeta',
563
-                        '%s:17:"order_grand_total";d:0;%',
564
-                        WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
565
-                        'auto-draft');
566
-                    $check = 'post__in';
567
-                    $no_btp = 'yes';
568
-                    break;
569
-            }
570
-
571
-            if (!empty($check)) {
572
-                if (!empty($no_btp) && $no_btp == 'yes') {
573
-                    $min = 'minimum';
574
-                    $max = 'maximum';
575
-                } else {
576
-                    $min = (!empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf'])) ? sanitize_text_field($_GET['entity_filter_btpf']) : 'minimum';
577
-                    $max = (!empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps'])) ? sanitize_text_field($_GET['entity_filter_btps']) : 'maximum';
578
-                }
579
-                $results = $wpdb->get_results($sql_query);
580
-                $post_id_list = array();
581
-                $i = 0;
582
-                foreach ($results as $item) {
583
-                    $meta_value = get_post_meta($item->ID, '_order_postmeta');
584
-                    $price = (!empty($meta_value[0]['order_grand_total'])) ? $meta_value[0]['order_grand_total'] : '';
585
-                    if ($price >= $min || $min == 'minimum') {
586
-                        if ($price <= $max || $max == 'maximum') {
587
-                            $post_id_list[] = $item->ID;
588
-                        }
589
-                    }
590
-                }
591
-                if (empty($post_id_list)) {
592
-                    $post_id_list[] = 'no_result';
593
-                }
594
-                $query->query_vars[$check] = $post_id_list;
595
-            }
596
-            $query->query_vars['post_type'] = WPSHOP_NEWTYPE_IDENTIFIER_ORDER;
597
-        }
598
-    }
599
-
600
-    public function latest_products_ordered($orders)
601
-    {
602
-        global $wpdb;
603
-        $product_id = $output = '';
604
-        $products = array();
605
-        $display_option = get_option('wpshop_display_option');
606
-        if (!empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered'])) {
607
-            foreach ($orders as $order) {
608
-                $order_content = get_post_meta($order->ID, '_order_postmeta', true);
609
-                if (!empty($order_content) && !empty($order_content['order_items'])) {
610
-
611
-                    foreach ($order_content['order_items'] as $item) {
612
-                        if (count($products) >= $display_option['latest_products_ordered']) {
613
-                            continue;
614
-                        }
615
-                        $product_id = $item['item_id'];
616
-                        if (!empty($item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition'])) {
617
-                            $parent_def = wpshop_products::get_parent_variation($item['item_id']);
618
-                            if (!empty($parent_def)) {
619
-                                $parent_post = $parent_def['parent_post'];
620
-                                $product_id = $parent_post->ID;
621
-                            }
622
-                        }
623
-
624
-                        if (!in_array($product_id, $products)) {
625
-                            $products[] = $product_id;
626
-                        }
627
-                    }
628
-                }
629
-            }
630
-            if (!empty($products)) {
631
-                $products_id = implode(",", $products);
632
-                $output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' . $products_id . '"]')));
633
-            }
634
-        }
635
-        return $output;
636
-    }
637
-
638
-    public function get_order_list_for_customer($customer_id)
639
-    {
640
-        global $wpdb;
641
-        $output = '';
642
-
643
-        if (!empty($customer_id)) {
644
-            $query = $wpdb->prepare('SELECT *
562
+						'_order_postmeta',
563
+						'%s:17:"order_grand_total";d:0;%',
564
+						WPSHOP_NEWTYPE_IDENTIFIER_ORDER,
565
+						'auto-draft');
566
+					$check = 'post__in';
567
+					$no_btp = 'yes';
568
+					break;
569
+			}
570
+
571
+			if (!empty($check)) {
572
+				if (!empty($no_btp) && $no_btp == 'yes') {
573
+					$min = 'minimum';
574
+					$max = 'maximum';
575
+				} else {
576
+					$min = (!empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf'])) ? sanitize_text_field($_GET['entity_filter_btpf']) : 'minimum';
577
+					$max = (!empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps'])) ? sanitize_text_field($_GET['entity_filter_btps']) : 'maximum';
578
+				}
579
+				$results = $wpdb->get_results($sql_query);
580
+				$post_id_list = array();
581
+				$i = 0;
582
+				foreach ($results as $item) {
583
+					$meta_value = get_post_meta($item->ID, '_order_postmeta');
584
+					$price = (!empty($meta_value[0]['order_grand_total'])) ? $meta_value[0]['order_grand_total'] : '';
585
+					if ($price >= $min || $min == 'minimum') {
586
+						if ($price <= $max || $max == 'maximum') {
587
+							$post_id_list[] = $item->ID;
588
+						}
589
+					}
590
+				}
591
+				if (empty($post_id_list)) {
592
+					$post_id_list[] = 'no_result';
593
+				}
594
+				$query->query_vars[$check] = $post_id_list;
595
+			}
596
+			$query->query_vars['post_type'] = WPSHOP_NEWTYPE_IDENTIFIER_ORDER;
597
+		}
598
+	}
599
+
600
+	public function latest_products_ordered($orders)
601
+	{
602
+		global $wpdb;
603
+		$product_id = $output = '';
604
+		$products = array();
605
+		$display_option = get_option('wpshop_display_option');
606
+		if (!empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered'])) {
607
+			foreach ($orders as $order) {
608
+				$order_content = get_post_meta($order->ID, '_order_postmeta', true);
609
+				if (!empty($order_content) && !empty($order_content['order_items'])) {
610
+
611
+					foreach ($order_content['order_items'] as $item) {
612
+						if (count($products) >= $display_option['latest_products_ordered']) {
613
+							continue;
614
+						}
615
+						$product_id = $item['item_id'];
616
+						if (!empty($item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition'])) {
617
+							$parent_def = wpshop_products::get_parent_variation($item['item_id']);
618
+							if (!empty($parent_def)) {
619
+								$parent_post = $parent_def['parent_post'];
620
+								$product_id = $parent_post->ID;
621
+							}
622
+						}
623
+
624
+						if (!in_array($product_id, $products)) {
625
+							$products[] = $product_id;
626
+						}
627
+					}
628
+				}
629
+			}
630
+			if (!empty($products)) {
631
+				$products_id = implode(",", $products);
632
+				$output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' . $products_id . '"]')));
633
+			}
634
+		}
635
+		return $output;
636
+	}
637
+
638
+	public function get_order_list_for_customer($customer_id)
639
+	{
640
+		global $wpdb;
641
+		$output = '';
642
+
643
+		if (!empty($customer_id)) {
644
+			$query = $wpdb->prepare('SELECT *
645 645
 							 		   FROM ' . $wpdb->posts . '
646 646
 							 		   WHERE post_author = %d
647 647
 							 		   AND post_type = %s', $customer_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
648
-            $orders = $wpdb->get_results($query);
649
-
650
-            foreach ($orders as $order) {
651
-
652
-            }
653
-        }
654
-
655
-        return $output;
656
-    }
657
-    public static function display_customer_pay_quotation($state, $oid)
658
-    {
659
-        $btn = '<p><a role="button" data-nonce="' . wp_create_nonce('wps_quotation_is_payable_by_customer') . '" class="wps-bton-' . (($state) ? 'third' : 'second') . '-mini-rounded quotation_is_payable_by_customer" href="#" >' . __('Valid quotation', 'wpshop') . '</a></p>';
660
-        if ($state) {
661
-            $btn .= self::display_customer_pay_order($oid);
662
-        }
663
-        return $btn;
664
-    }
665
-    public static function display_customer_pay_order($oid)
666
-    {
667
-        $output = '<span>';
668
-        $output .= '<input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url($oid) . '"/>';
669
-        $output .= '<a class="button" data-copy-target="#wps_direct_link_url" title="' . __('Copy', 'wpshop') . '">';
670
-        $output .= '<span class="dashicons dashicons-clipboard"></span>';
671
-        $output .= '</a>';
672
-        $output .= '<a data-nonce="' . wp_create_nonce('wps_send_direct_payment_link') . '" role="button" class="button" href="#" title="' . __('Send by mail', 'wpshop') . '">';
673
-        $output .= '<span class="dashicons dashicons-email"></span>';
674
-        $output .= '</a>';
675
-        $output .= '</span>';
676
-        $output .= '<span>' . sprintf(__('Link is valid until %s', 'wpshop'), mysql2date(get_option('date_format'), date_format(date_create(date('Y-m') . ' + 2month - 1day'), 'Y-m-d H:i:s'), true)) . '</span>';
677
-        return $output;
678
-    }
648
+			$orders = $wpdb->get_results($query);
649
+
650
+			foreach ($orders as $order) {
651
+
652
+			}
653
+		}
654
+
655
+		return $output;
656
+	}
657
+	public static function display_customer_pay_quotation($state, $oid)
658
+	{
659
+		$btn = '<p><a role="button" data-nonce="' . wp_create_nonce('wps_quotation_is_payable_by_customer') . '" class="wps-bton-' . (($state) ? 'third' : 'second') . '-mini-rounded quotation_is_payable_by_customer" href="#" >' . __('Valid quotation', 'wpshop') . '</a></p>';
660
+		if ($state) {
661
+			$btn .= self::display_customer_pay_order($oid);
662
+		}
663
+		return $btn;
664
+	}
665
+	public static function display_customer_pay_order($oid)
666
+	{
667
+		$output = '<span>';
668
+		$output .= '<input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url($oid) . '"/>';
669
+		$output .= '<a class="button" data-copy-target="#wps_direct_link_url" title="' . __('Copy', 'wpshop') . '">';
670
+		$output .= '<span class="dashicons dashicons-clipboard"></span>';
671
+		$output .= '</a>';
672
+		$output .= '<a data-nonce="' . wp_create_nonce('wps_send_direct_payment_link') . '" role="button" class="button" href="#" title="' . __('Send by mail', 'wpshop') . '">';
673
+		$output .= '<span class="dashicons dashicons-email"></span>';
674
+		$output .= '</a>';
675
+		$output .= '</span>';
676
+		$output .= '<span>' . sprintf(__('Link is valid until %s', 'wpshop'), mysql2date(get_option('date_format'), date_format(date_create(date('Y-m') . ' + 2month - 1day'), 'Y-m-d H:i:s'), true)) . '</span>';
677
+		return $output;
678
+	}
679 679
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             }
132 132
             if (!empty($order_postmeta['order_temporary_key'])) {
133 133
                 $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Pre-order reference', 'wpshop') . ': </strong>' . $order_postmeta['order_temporary_key'] . '<br/>';
134
-                $post_ID = !empty($_GET['post']) ? (int) $_GET['post'] : 0;
134
+                $post_ID = !empty($_GET['post']) ? (int)$_GET['post'] : 0;
135 135
                 $order_main_info .= '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf') . '">' . __('Download the quotation', 'wpshop') . '</a><br />';
136 136
             }
137 137
             if (!empty($order_postmeta['order_invoice_ref'])) {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         </div>';
164 164
         }*/
165 165
 
166
-        if (in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0) {
166
+        if (in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float)$order_postmeta['order_amount_to_pay_now'] != (float)0) {
167 167
             if (((!empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation') || !empty($order_postmeta['order_temporary_key']))) {
168 168
                 $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation(isset($order_postmeta['pay_quotation']), $order->ID) . '</div>';
169 169
             } else {
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
             }
185 185
             $credit_meta = get_post_meta($order->ID, '_wps_order_credit', true);
186 186
 
187
-            $total_received = (float) 0;
187
+            $total_received = (float)0;
188 188
             if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) {
189 189
                 foreach ($order_postmeta['order_payment']['received'] as $received) {
190
-                    $total_received += (float) isset($received['received_amount']) ? $received['received_amount'] : 0;
190
+                    $total_received += (float)isset($received['received_amount']) ? $received['received_amount'] : 0;
191 191
                 }
192 192
             }
193 193
 
194
-            if (empty($credit_meta) && (float) 0 !== $total_received) {
194
+            if (empty($credit_meta) && (float)0 !== $total_received) {
195 195
                 if ($order_postmeta['order_status'] == 'refunded') {
196 196
                     $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' . __('Credit Slip number', 'wpshop') . ' : <strong>' . ((!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref'])) ? '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&amp;invoice_ref=' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '&credit_slip=ok') . '" target="_blank">' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '</a>' : '') . '</strong></div>';
197 197
                 } else {
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 
273 273
         $order_current_number = get_option('wpshop_order_current_number', false);
274 274
         /* If the counter doesn't exist, we initiate it */
275
-        if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
275
+        if (!$order_current_number) {$order_current_number = 1; } else { $order_current_number++; }
276 276
         update_option('wpshop_order_current_number', $order_current_number);
277 277
 
278
-        $order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
278
+        $order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number);
279 279
         return WPSHOP_ORDER_REFERENCE_PREFIX . $order_ref;
280 280
     }
281 281
 
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 
294 294
         $order_current_number = get_option('wpshop_preorder_current_number', false);
295 295
         /* If the counter doesn't exist, we initiate it */
296
-        if (!$order_current_number) {$order_current_number = 1;} else { $order_current_number++;}
296
+        if (!$order_current_number) {$order_current_number = 1; } else { $order_current_number++; }
297 297
         if ($save) {
298 298
             update_option('wpshop_preorder_current_number', $order_current_number);
299 299
         }
300 300
 
301
-        $order_ref = (string) sprintf('%0' . $number_figures . 'd', $order_current_number);
301
+        $order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number);
302 302
         return WPSHOP_PREORDER_REFERENCE_PREFIX . $order_ref;
303 303
     }
304 304
 
Please login to merge, or discard this patch.
includes/modules/wps_orders/templates/backend/wps_order_payment_box.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@  discard block
 block discarded – undo
1 1
 <?php if (!defined('ABSPATH')) {
2
-    exit;
2
+	exit;
3 3
 }
4 4
 
5 5
 if (!empty($order_postmeta['order_payment'])):
6
-    $total_amount = (!empty($order_postmeta['order_grand_total'])) ? $order_postmeta['order_grand_total'] : '';
7
-    $waited_amount_sum = $received_amount_sum = $i = 0;
8
-    ?>
6
+	$total_amount = (!empty($order_postmeta['order_grand_total'])) ? $order_postmeta['order_grand_total'] : '';
7
+	$waited_amount_sum = $received_amount_sum = $i = 0;
8
+	?>
9 9
 										<?php $payment_modes = get_option('wps_payment_mode');?>
10 10
 										<?php if (!empty($order_postmeta['order_payment']['customer_choice']) && !empty($order_postmeta['order_payment']['customer_choice']['method'])) {
11
-        ;
12
-    }
13
-    ?>
11
+		;
12
+	}
13
+	?>
14 14
 											<div class="wps-alert-info"><strong><?php _e('Payment method customer select', 'wpshop');?> : </strong><br/>
15 15
 											<?php if (!empty($order_postmeta) && !empty($order_postmeta['order_payment']['customer_choice']['method']) && !empty($payment_modes['mode'][strtolower((string) $order_postmeta['order_payment']['customer_choice']['method'])]['name'])) {
16
-        echo $payment_modes['mode'][strtolower((string) $order_postmeta['order_payment']['customer_choice']['method'])]['name'];
17
-    } else {
18
-        _e('Unknow', 'wpshop');
19
-        if (!empty($order_postmeta['order_payment']['customer_choice']['method'])) {
20
-            echo ' (' . strtolower((string) $order_postmeta['order_payment']['customer_choice']['method']) . ')';
21
-        }
22
-    }?>
16
+		echo $payment_modes['mode'][strtolower((string) $order_postmeta['order_payment']['customer_choice']['method'])]['name'];
17
+	} else {
18
+		_e('Unknow', 'wpshop');
19
+		if (!empty($order_postmeta['order_payment']['customer_choice']['method'])) {
20
+			echo ' (' . strtolower((string) $order_postmeta['order_payment']['customer_choice']['method']) . ')';
21
+		}
22
+	}?>
23 23
 											</div>
24 24
 											<?php
25
-    $payment_method_filter = apply_filters('wps_administration_order_payment_informations', $order->ID);
26
-    if ($order->ID != $payment_method_filter) {
27
-        echo $payment_method_filter;
28
-    }
29
-    ?>
25
+	$payment_method_filter = apply_filters('wps_administration_order_payment_informations', $order->ID);
26
+	if ($order->ID != $payment_method_filter) {
27
+		echo $payment_method_filter;
28
+	}
29
+	?>
30 30
 
31 31
 										<?php if (!empty($order_postmeta['order_payment']['received'])): ?>
32 32
 											<?php ob_start();
33
-    foreach ($order_postmeta['order_payment']['received'] as $index_payment => $received_payment):
34
-        if (empty($received_payment['method']) || $received_payment['method'] == 'quotation') {
35
-            continue;
36
-        }
37
-        if ($i == 0): ?>
33
+	foreach ($order_postmeta['order_payment']['received'] as $index_payment => $received_payment):
34
+		if (empty($received_payment['method']) || $received_payment['method'] == 'quotation') {
35
+			continue;
36
+		}
37
+		if ($i == 0): ?>
38 38
 																				<div class="wps-boxed">
39 39
 																					<div class="wps-h2"><?php _e('Received payments', 'wpshop');?></div>
40 40
 																					<?php endif;
41
-    $i++;
42
-    if (!empty($received_payment['waited_amount'])) {
43
-        $waited_amount_sum += $received_payment['waited_amount'];
44
-    }
45
-    if (!empty($received_payment['received_amount']) && ($received_payment['status'] == 'payment_received')) {
46
-        $received_amount_sum += $received_payment['received_amount'];
47
-    }
48
-    ?>
41
+	$i++;
42
+	if (!empty($received_payment['waited_amount'])) {
43
+		$waited_amount_sum += $received_payment['waited_amount'];
44
+	}
45
+	if (!empty($received_payment['received_amount']) && ($received_payment['status'] == 'payment_received')) {
46
+		$received_amount_sum += $received_payment['received_amount'];
47
+	}
48
+	?>
49 49
 												<div>
50 50
 													<div class="wps-h5"><span class="dashicons dashicons-arrow-right"></span><strong><?php echo (!empty($received_payment) && !empty($received_payment['method']) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]['name']) ? $payment_modes['mode'][strtolower($received_payment['method'])]['name'] : sprintf(__('Unknow (%s)', 'wpshop'), strtolower($received_payment['method']))); ?></strong></div>
51 51
 													<div class="wps-product-section">
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref'] . '&mode=pdf'); ?>" target="_blank" class="wps-bton-second-mini-rounded" role="button"><i class="dashicons dashicons-download"></i><?php _e('Download invoice', 'wpshop');?></a></div>
69 69
 					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref']); ?>" target="_blank" class="wps-bton-fourth-mini-third" role="button"><i class="dashicons dashicons-welcome-view-site"></i><?php _e('Watch invoice', 'wpshop');?></a></div>
70 70
 				<?php } elseif (!empty($received_payment) && empty($received_payment['invoice_ref']) && $received_payment['status'] == 'payment_received') {
71
-    ?>
71
+	?>
72 72
 					<input type="hidden" name="order_id" class="wps-regerate-invoice-payment-input<?php $idregen = uniqid();
73
-    echo $idregen;?>" value="<?php echo $order->ID; ?>">
73
+	echo $idregen;?>" value="<?php echo $order->ID; ?>">
74 74
 					<input type="hidden" name="index_payment" class="wps-regerate-invoice-payment-input<?php echo $idregen; ?>" value="<?php echo $index_payment; ?>">
75 75
 					<div class="wps-product-section"><button data-nonce="<?php echo wp_create_nonce('wps_reverify_payment_invoice_ref'); ?>" id="wps-regerate-invoice-payment-btn" class="wps-bton-fourth-mini-third" data-class="<?php echo $idregen; ?>"><i class="dashicons dashicons-controls-repeat"></i><?php _e('Regerate invoice payment', 'wpshop');?></button></div>
76 76
 				<?php }?>
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@  discard block
 block discarded – undo
6 6
     $total_amount = (!empty($order_postmeta['order_grand_total'])) ? $order_postmeta['order_grand_total'] : '';
7 7
     $waited_amount_sum = $received_amount_sum = $i = 0;
8 8
     ?>
9
-										<?php $payment_modes = get_option('wps_payment_mode');?>
9
+										<?php $payment_modes = get_option('wps_payment_mode'); ?>
10 10
 										<?php if (!empty($order_postmeta['order_payment']['customer_choice']) && !empty($order_postmeta['order_payment']['customer_choice']['method'])) {
11 11
         ;
12 12
     }
13 13
     ?>
14
-											<div class="wps-alert-info"><strong><?php _e('Payment method customer select', 'wpshop');?> : </strong><br/>
15
-											<?php if (!empty($order_postmeta) && !empty($order_postmeta['order_payment']['customer_choice']['method']) && !empty($payment_modes['mode'][strtolower((string) $order_postmeta['order_payment']['customer_choice']['method'])]['name'])) {
16
-        echo $payment_modes['mode'][strtolower((string) $order_postmeta['order_payment']['customer_choice']['method'])]['name'];
14
+											<div class="wps-alert-info"><strong><?php _e('Payment method customer select', 'wpshop'); ?> : </strong><br/>
15
+											<?php if (!empty($order_postmeta) && !empty($order_postmeta['order_payment']['customer_choice']['method']) && !empty($payment_modes['mode'][strtolower((string)$order_postmeta['order_payment']['customer_choice']['method'])]['name'])) {
16
+        echo $payment_modes['mode'][strtolower((string)$order_postmeta['order_payment']['customer_choice']['method'])]['name'];
17 17
     } else {
18 18
         _e('Unknow', 'wpshop');
19 19
         if (!empty($order_postmeta['order_payment']['customer_choice']['method'])) {
20
-            echo ' (' . strtolower((string) $order_postmeta['order_payment']['customer_choice']['method']) . ')';
20
+            echo ' (' . strtolower((string)$order_postmeta['order_payment']['customer_choice']['method']) . ')';
21 21
         }
22 22
     }?>
23 23
 											</div>
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         }
37 37
         if ($i == 0): ?>
38 38
 																				<div class="wps-boxed">
39
-																					<div class="wps-h2"><?php _e('Received payments', 'wpshop');?></div>
39
+																					<div class="wps-h2"><?php _e('Received payments', 'wpshop'); ?></div>
40 40
 																					<?php endif;
41 41
     $i++;
42 42
     if (!empty($received_payment['waited_amount'])) {
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 												<div>
50 50
 													<div class="wps-h5"><span class="dashicons dashicons-arrow-right"></span><strong><?php echo (!empty($received_payment) && !empty($received_payment['method']) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]) && !empty($payment_modes['mode'][strtolower($received_payment['method'])]['name']) ? $payment_modes['mode'][strtolower($received_payment['method'])]['name'] : sprintf(__('Unknow (%s)', 'wpshop'), strtolower($received_payment['method']))); ?></strong></div>
51 51
 													<div class="wps-product-section">
52
-														<div><strong><?php _e('Payment date', 'wpshop');?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['date'])) ? mysql2date('d F Y H:i', $received_payment['date'], true) : __('Unknow', 'wpshop'); ?></div>
53
-														<div><strong><?php _e('Payment reference', 'wpshop');?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['payment_reference'])) ? $received_payment['payment_reference'] : __('Unknow', 'wpshop'); ?></div>
54
-														<div><strong><?php _e('Amount', 'wpshop');?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['received_amount'])) ? $received_payment['received_amount'] . ' ' . wpshop_tools::wpshop_get_currency() : __('Unknow', 'wpshop'); ?></div>
55
-														<div><strong><?php _e('Status', 'wpshop');?> :</strong>
52
+														<div><strong><?php _e('Payment date', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['date'])) ? mysql2date('d F Y H:i', $received_payment['date'], true) : __('Unknow', 'wpshop'); ?></div>
53
+														<div><strong><?php _e('Payment reference', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['payment_reference'])) ? $received_payment['payment_reference'] : __('Unknow', 'wpshop'); ?></div>
54
+														<div><strong><?php _e('Amount', 'wpshop'); ?> :</strong> <?php echo (!empty($received_payment) && !empty($received_payment['received_amount'])) ? $received_payment['received_amount'] . ' ' . wpshop_tools::wpshop_get_currency() : __('Unknow', 'wpshop'); ?></div>
55
+														<div><strong><?php _e('Status', 'wpshop'); ?> :</strong>
56 56
 															<?php if (!empty($received_payment['status']) && $received_payment['status'] == 'payment_received'): ?>
57
-																<span class="wps-label-vert"><?php _e('Received payment', 'wpshop');?></span>
57
+																<span class="wps-label-vert"><?php _e('Received payment', 'wpshop'); ?></span>
58 58
 															<?php elseif ($received_payment['status'] == 'incorrect_amount'): ?>
59
-							<span class="wps-label-orange"><?php _e('Incorrect amount', 'wpshop');?></span>
59
+							<span class="wps-label-orange"><?php _e('Incorrect amount', 'wpshop'); ?></span>
60 60
 						<?php elseif ($received_payment['status'] == 'waiting_payment'): ?>
61
-							<span class="wps-label-rouge"><?php _e('Waiting payment', 'wpshop');?></span>
61
+							<span class="wps-label-rouge"><?php _e('Waiting payment', 'wpshop'); ?></span>
62 62
 						<?php else: ?>
63 63
 							<span class="wps-label-rouge"><?php echo $received_payment['status']; ?></span>
64
-						<?php endif;?>
64
+						<?php endif; ?>
65 65
 					</div>
66 66
 				</div>
67 67
 				<?php if (!empty($received_payment) && !empty($received_payment['invoice_ref'])) {?>
68
-					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref'] . '&mode=pdf'); ?>" target="_blank" class="wps-bton-second-mini-rounded" role="button"><i class="dashicons dashicons-download"></i><?php _e('Download invoice', 'wpshop');?></a></div>
69
-					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref']); ?>" target="_blank" class="wps-bton-fourth-mini-third" role="button"><i class="dashicons dashicons-welcome-view-site"></i><?php _e('Watch invoice', 'wpshop');?></a></div>
68
+					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref'] . '&mode=pdf'); ?>" target="_blank" class="wps-bton-second-mini-rounded" role="button"><i class="dashicons dashicons-download"></i><?php _e('Download invoice', 'wpshop'); ?></a></div>
69
+					<div class="wps-product-section"><a href="<?php echo admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $received_payment['invoice_ref']); ?>" target="_blank" class="wps-bton-fourth-mini-third" role="button"><i class="dashicons dashicons-welcome-view-site"></i><?php _e('Watch invoice', 'wpshop'); ?></a></div>
70 70
 				<?php } elseif (!empty($received_payment) && empty($received_payment['invoice_ref']) && $received_payment['status'] == 'payment_received') {
71 71
     ?>
72 72
 					<input type="hidden" name="order_id" class="wps-regerate-invoice-payment-input<?php $idregen = uniqid();
73
-    echo $idregen;?>" value="<?php echo $order->ID; ?>">
73
+    echo $idregen; ?>" value="<?php echo $order->ID; ?>">
74 74
 					<input type="hidden" name="index_payment" class="wps-regerate-invoice-payment-input<?php echo $idregen; ?>" value="<?php echo $index_payment; ?>">
75
-					<div class="wps-product-section"><button data-nonce="<?php echo wp_create_nonce('wps_reverify_payment_invoice_ref'); ?>" id="wps-regerate-invoice-payment-btn" class="wps-bton-fourth-mini-third" data-class="<?php echo $idregen; ?>"><i class="dashicons dashicons-controls-repeat"></i><?php _e('Regerate invoice payment', 'wpshop');?></button></div>
75
+					<div class="wps-product-section"><button data-nonce="<?php echo wp_create_nonce('wps_reverify_payment_invoice_ref'); ?>" id="wps-regerate-invoice-payment-btn" class="wps-bton-fourth-mini-third" data-class="<?php echo $idregen; ?>"><i class="dashicons dashicons-controls-repeat"></i><?php _e('Regerate invoice payment', 'wpshop'); ?></button></div>
76 76
 				<?php }?>
77 77
 			</div>
78
-		<?php endforeach;?>
78
+		<?php endforeach; ?>
79 79
 		<?php echo strrev(preg_replace(strrev('/wps-product-section/'), '', strrev(ob_get_clean()), 1)); ?>
80 80
 		<?php if ($i == 0): ?>
81
-			<div class="wps-alert-info"><?php _e('No received payment for the moment', 'wpshop');?></div>
81
+			<div class="wps-alert-info"><?php _e('No received payment for the moment', 'wpshop'); ?></div>
82 82
 		<?php else: ?>
83 83
 			</div>
84
-		<?php endif;?>
84
+		<?php endif; ?>
85 85
 
86 86
 		<?php if ((($total_amount - $received_amount_sum) > 0) && ($order_postmeta['order_grand_total'] > 0)): ?>
87 87
 		<div class="wps-boxed">
88
-			<div class="wps-h5"><?php _e('Add a new payment', 'wpshop');?></div>
88
+			<div class="wps-h5"><?php _e('Add a new payment', 'wpshop'); ?></div>
89 89
 			<div class="wps-gridwrapper2-padded">
90 90
 				<div class="wps-form-group">
91
-					<label><?php _e('Method', 'wpshop');?> :</label>
91
+					<label><?php _e('Method', 'wpshop'); ?> :</label>
92 92
 					<div class="wps-form">
93 93
 						<select name="wpshop_admin_order_payment_received[method]">
94 94
 							<?php if (!empty($payment_modes) && !empty($payment_modes['mode'])): ?>
95 95
 								<?php foreach ($payment_modes['mode'] as $mode_id => $mode): ?>
96 96
 									<?php if (!empty($mode['active'])): ?>
97 97
 										<option value="<?php echo $mode_id; ?>"><?php echo $mode['name']; ?></option>
98
-									<?php endif;?>
99
-								<?php endforeach;?>
100
-							<?php endif;?>
98
+									<?php endif; ?>
99
+								<?php endforeach; ?>
100
+							<?php endif; ?>
101 101
 						</select>
102 102
 					</div>
103 103
 				</div>
104 104
 
105 105
 				<div class="wps-form-group">
106
-					<label><?php _e('Reference', 'wpshop');?> :</label>
106
+					<label><?php _e('Reference', 'wpshop'); ?> :</label>
107 107
 					<div class="wps-form">
108 108
 						<input type="text" name="wpshop_admin_order_payment_received[payment_reference]" />
109 109
 					</div>
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 
114 114
 			<div class="wps-gridwrapper2-padded">
115 115
 				<div class="wps-form-group">
116
-					<label><?php _e('Date', 'wpshop');?> :</label>
116
+					<label><?php _e('Date', 'wpshop'); ?> :</label>
117 117
 					<div class="wps-form">
118 118
 						<input type="text" name="wpshop_admin_order_payment_received[date]" class="wpshop_admin_order_arrived_payment_date" value="" />
119 119
 					</div>
120 120
 				</div>
121 121
 
122 122
 				<div class="wps-form-group">
123
-					<label><?php _e('Amount', 'wpshop');?> (<?php echo wpshop_tools::wpshop_get_currency(); ?>):</label>
123
+					<label><?php _e('Amount', 'wpshop'); ?> (<?php echo wpshop_tools::wpshop_get_currency(); ?>):</label>
124 124
 					<div class="wps-form">
125 125
 						<input type="text" name="wpshop_admin_order_payment_received[received_amount]" value="<?php echo $order_postmeta['order_amount_to_pay_now']; ?>" />
126 126
 					</div>
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			</div>
130 130
 			<input type="hidden" value="<?php echo ($waited_amount_sum - $received_amount_sum); ?>" id="wpshop_admin_order_due_amount" />
131 131
 			<input type="hidden" value="" id="action_triggered_from" name="action_triggered_from" />
132
-			<div><button class="wps-bton-first-mini-rounded" id="wpshop_order_arrived_payment_amount_add_button"><?php _e('Add the payment', 'wpshop');?></button></div>
132
+			<div><button class="wps-bton-first-mini-rounded" id="wpshop_order_arrived_payment_amount_add_button"><?php _e('Add the payment', 'wpshop'); ?></button></div>
133 133
 		</div>
134 134
 
135 135
 		<script type="text/javascript" >
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 		</script>
153 153
 
154 154
 
155
-		<?php endif;?>
156
-		<div class="wps-alert-<?php echo ((($order_postmeta['order_amount_to_pay_now']) <= 0) ? 'success' : 'warning'); ?>"><u><?php _e('Due amount for this order', 'wpshop');?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now']; ?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
155
+		<?php endif; ?>
156
+		<div class="wps-alert-<?php echo ((($order_postmeta['order_amount_to_pay_now']) <= 0) ? 'success' : 'warning'); ?>"><u><?php _e('Due amount for this order', 'wpshop'); ?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now']; ?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
157 157
 
158
-	<?php endif;?>
158
+	<?php endif; ?>
159 159
 <?php else: ?>
160
-	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop');?></div>
161
-<?php endif;?>
160
+	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop'); ?></div>
161
+<?php endif; ?>
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
 							<span class="wps-label-orange"><?php _e('Incorrect amount', 'wpshop');?></span>
60 60
 						<?php elseif ($received_payment['status'] == 'waiting_payment'): ?>
61 61
 							<span class="wps-label-rouge"><?php _e('Waiting payment', 'wpshop');?></span>
62
-						<?php else: ?>
63
-							<span class="wps-label-rouge"><?php echo $received_payment['status']; ?></span>
62
+						<?php else {
63
+	: ?>
64
+							<span class="wps-label-rouge"><?php echo $received_payment['status'];
65
+}
66
+?></span>
64 67
 						<?php endif;?>
65 68
 					</div>
66 69
 				</div>
@@ -79,9 +82,12 @@  discard block
 block discarded – undo
79 82
 		<?php echo strrev(preg_replace(strrev('/wps-product-section/'), '', strrev(ob_get_clean()), 1)); ?>
80 83
 		<?php if ($i == 0): ?>
81 84
 			<div class="wps-alert-info"><?php _e('No received payment for the moment', 'wpshop');?></div>
82
-		<?php else: ?>
85
+		<?php else {
86
+	: ?>
83 87
 			</div>
84
-		<?php endif;?>
88
+		<?php endif;
89
+}
90
+?>
85 91
 
86 92
 		<?php if ((($total_amount - $received_amount_sum) > 0) && ($order_postmeta['order_grand_total'] > 0)): ?>
87 93
 		<div class="wps-boxed">
@@ -156,6 +162,9 @@  discard block
 block discarded – undo
156 162
 		<div class="wps-alert-<?php echo ((($order_postmeta['order_amount_to_pay_now']) <= 0) ? 'success' : 'warning'); ?>"><u><?php _e('Due amount for this order', 'wpshop');?></u> : <span class="alignright"><strong><?php echo $order_postmeta['order_amount_to_pay_now']; ?> <?php echo wpshop_tools::wpshop_get_currency(); ?></strong></span></div>
157 163
 
158 164
 	<?php endif;?>
159
-<?php else: ?>
160
-	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop');?></div>
165
+<?php else {
166
+	: ?>
167
+	<div class="wps-alert-info"><?php _e('No information available for this order payment', 'wpshop');
168
+}
169
+?></div>
161 170
 <?php endif;?>
Please login to merge, or discard this patch.