Schedule installation #49

Merged
bilal.catic merged 21 commits from schedule-installation-new into master 2018-11-03 11:24:43 +01:00
Showing only changes of commit b91341c5df - Show all commits

View File

@@ -0,0 +1,22 @@
<?php
add_action( 'wp_ajax_wiaas_create_order_delivery_process', 'wiaas_ajax_create_order_delivery_process' );
/**
* Creates delivery process for order
*/
function wiaas_ajax_create_order_delivery_process() {
check_ajax_referer('wiaas_create_order_delivery_process');
$error = new WP_Error('-1', 'Failed to create order delivery process');
if (!isset($_POST['order']) || !isset($_POST['form'])){
wp_send_json_error($error);
}
$order_id = intval( $_POST['order'] );
$form_id = intval( $_POST['form'] );
if (Wiaas_Delivery_Process::create_delivery_process_for_order($order_id, $form_id)){
wp_send_json_success();
}
wp_send_json_error($error);
}