rename
This commit is contained in:
@@ -27,7 +27,7 @@ class Wiaas_Admin_Order_Process_Flow {
|
||||
$final_confirmed_date = Wiaas_Order::get_final_confirmed_date($order_id);
|
||||
$earliest_installation_date = Wiaas_Order::get_earliest_installation_date($order_id);
|
||||
|
||||
require 'views/html-order-delivery-dates.php';
|
||||
require 'views/html-order-suppliers-delivery-dates.php';
|
||||
}
|
||||
|
||||
public static function add_process_flow_meta_box(){
|
||||
@@ -64,10 +64,10 @@ class Wiaas_Admin_Order_Process_Flow {
|
||||
}
|
||||
|
||||
public static function add_custom_fields_after_order_details($order){
|
||||
$global_estimated_delivery_date = Wiaas_Order::get_global_estimated_date($order->id);
|
||||
$order_estimated_delivery_date = Wiaas_Order::get_order_estimated_date($order->id);
|
||||
|
||||
$order_id = $order->id;
|
||||
require 'views/html-order-global-delivery-date.php';
|
||||
require 'views/html-order-delivery-date.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<p class="form-field form-field-wide">
|
||||
<label for="estimated-delivery-date">Estimated delivery date:</label>
|
||||
<input id="estimated-delivery-date" name="estimated-delivery-date"
|
||||
type="date" value="<?php echo $global_estimated_delivery_date ? date("Y-m-d", $global_estimated_delivery_date) : ""; ?>"
|
||||
onChange="onGlobalEstimatedDeliveryDateChange(this.value)"/>
|
||||
type="date" value="<?php echo $order_estimated_delivery_date ? date("Y-m-d", $order_estimated_delivery_date) : ""; ?>"
|
||||
onChange="onOrderEstimatedDeliveryDateChange(this.value)"/>
|
||||
</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
function onGlobalEstimatedDeliveryDateChange(date) {
|
||||
function onOrderEstimatedDeliveryDateChange(date) {
|
||||
var timestamp = parseInt((new Date(date).getTime() / 1000).toFixed(0));
|
||||
|
||||
if (isNaN(timestamp)){
|
||||
@@ -20,8 +20,8 @@ function onGlobalEstimatedDeliveryDateChange(date) {
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: 'wiaas_save_global_estimated_date_for_order',
|
||||
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_global_estimated_date_for_order" ) ?>',
|
||||
action: 'wiaas_save_estimated_date_for_order',
|
||||
_ajax_nonce: '<?php echo wp_create_nonce( "wiaas_save_estimated_date_for_order" ) ?>',
|
||||
order: '<?php echo $order_id ?>',
|
||||
date: timestamp
|
||||
};
|
||||
@@ -6,7 +6,7 @@ add_action( 'wp_ajax_wiaas_save_tracking_info', 'wiaas_ajax_save_tracking_info')
|
||||
add_action( 'wp_ajax_wiaas_delete_tracking_info', 'wiaas_ajax_delete_tracking_info');
|
||||
add_action( 'wp_ajax_wiaas_save_estimated_date_for_supplier', 'wiaas_ajax_save_estimated_date_for_supplier');
|
||||
add_action( 'wp_ajax_wiaas_save_confirmed_date_for_supplier', 'wiaas_ajax_save_confirmed_date_for_supplier');
|
||||
add_action( 'wp_ajax_wiaas_save_global_estimated_date_for_order', 'wiaas_ajax_save_global_estimated_date_for_order');
|
||||
add_action( 'wp_ajax_wiaas_save_estimated_date_for_order', 'wiaas_ajax_save_estimated_date_for_order');
|
||||
|
||||
/**
|
||||
* Creates delivery process for order
|
||||
@@ -122,8 +122,8 @@ function wiaas_ajax_save_confirmed_date_for_supplier(){
|
||||
wp_send_json_error($error);
|
||||
}
|
||||
|
||||
function wiaas_ajax_save_global_estimated_date_for_order(){
|
||||
check_ajax_referer('wiaas_save_global_estimated_date_for_order');
|
||||
function wiaas_ajax_save_estimated_date_for_order(){
|
||||
check_ajax_referer('wiaas_save_estimated_date_for_order');
|
||||
$error = new WP_Error('-1', 'Failed to save global estimated date for order');
|
||||
|
||||
if (!isset($_POST['order']) || !isset($_POST['date'])){
|
||||
@@ -132,7 +132,7 @@ function wiaas_ajax_save_global_estimated_date_for_order(){
|
||||
$order_id = intval( $_POST['order'] );
|
||||
$date = intval($_POST['date']);
|
||||
|
||||
if (Wiaas_Order::save_global_estimated_date($order_id, $date)){
|
||||
if (Wiaas_Order::save_order_estimated_date($order_id, $date)){
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ class Wiaas_Cart {
|
||||
$order->add_meta_data('_wiaas_suppliers', $suppliers, true);
|
||||
|
||||
// add additional date fields to order
|
||||
$order->add_meta_data('_wiaas_global_estimated_delivery_date', NULL, true);
|
||||
$order->add_meta_data('_wiaas_estimated_delivery_date', NULL, true);
|
||||
$order->add_meta_data('_wiaas_final_estimated_delivery_date', 0, true);
|
||||
$order->add_meta_data('_wiaas_final_confirmed_delivery_date', 0, true);
|
||||
$order->add_meta_data('_wiaas_earliest_installation_date', 0, true);
|
||||
|
||||
@@ -151,17 +151,17 @@ class Wiaas_Order {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function get_global_estimated_date($order_id){
|
||||
public static function get_order_estimated_date($order_id){
|
||||
$order = wc_get_order($order_id);
|
||||
if (!$order){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return $order->get_meta('_wiaas_global_estimated_delivery_date') ?: NULL;
|
||||
return $order->get_meta('_wiaas_order_estimated_delivery_date') ?: NULL;
|
||||
}
|
||||
|
||||
public static function save_global_estimated_date($order_id, $date){
|
||||
return update_post_meta($order_id, '_wiaas_global_estimated_delivery_date', $date);
|
||||
public static function save_order_estimated_date($order_id, $date){
|
||||
return update_post_meta($order_id, '_wiaas_order_estimated_delivery_date', $date);
|
||||
}
|
||||
|
||||
public static function get_final_estimated_date($order_id){
|
||||
|
||||
Reference in New Issue
Block a user