case 'update_order':
     $status = zen_db_scrub_in($_POST['status'], true);
     $comments = $_POST['comments'];
     $comments = stripslashes($comments);
     $comments = trim($comments);
     $comments = mysql_escape_string($comments);
     $comments = htmlspecialchars($comments);
     $check_status = $db->Execute("select customers_id, customers_name, customers_email_address, orders_status,\r\n                                      date_purchased from " . TABLE_ORDERS . "\r\n                                      where orders_id = '" . (int) $oID . "'");
     if ($check_status->fields['orders_status'] != $status || zen_not_null($comments)) {
         $customer_notified = '0';
         if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
             $customer_notified = '1';
         }
         update_status($oID, $status, $customer_notified, $comments);
         if ($customer_notified == '1') {
             email_latest_status($oID, $customer_notified);
         }
         if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
             // adjust download_maxdays based on current date
             $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;
             $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int) $oID . "'";
             $db->Execute($update_downloads_query);
         }
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
     } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
     }
     zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', $request_type));
     break;
 case 'deleteconfirm':
     zen_remove_order($oID, $_POST['restock']);
function batch_status($oID, $status, $comments, $notify = 0, $notify_comments = 0)
{
    global $db, $messageStack;
    require DIR_WS_LANGUAGES . 'english/super_orders.php';
    $order_updated = false;
    $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,\r\n                                date_purchased from " . TABLE_ORDERS . "\r\n                                where orders_id = '" . (int) $oID . "'");
    if ($check_status->fields['orders_status'] != $status || zen_not_null($comments)) {
        $customer_notified = '0';
        if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
            $customer_notified = '1';
        }
        update_status($oID, $status, $customer_notified, $comments);
        if ($customer_notified == '1') {
            email_latest_status($oID, $notify_comments);
        }
        $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
    } else {
        $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
    }
}
Example #3
0
             $db->Execute("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET\r\n                          orders_id = '" . $new_order_id . "'\r\n                          WHERE orders_products_id = '" . $orders_products_id . "'");
             $db->Execute("UPDATE " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " SET\r\n                          orders_id = '" . $new_order_id . "'\r\n                          WHERE orders_products_id = '" . $orders_products_id . "'");
             $db->Execute("UPDATE " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET\r\n                          orders_id = '" . $new_order_id . "'\r\n                          WHERE orders_products_id = '" . $orders_products_id . "'");
         }
         // recalculate totals on both orders
         recalc_total($oID);
         recalc_total($new_order_id);
         // add history comments to both orders reflecting the split
         $notify_split = isset($_POST['notify_split']) ? 1 : 0;
         // entry for original order
         $db->Execute("INSERT INTO " . TABLE_ORDERS_STATUS_HISTORY . "\r\n                       (orders_id, orders_status_id, date_added, customer_notified, comments)\r\n                       VALUES ('" . $oID . "',\r\n                       '" . $new_order['orders_status'] . "',\r\n                       now(),\r\n                       '" . $notify_split . "',\r\n                       '" . COMMENTS_SPLIT_OLD . $new_order_id . "')");
         // entry for new order
         $db->Execute("INSERT INTO " . TABLE_ORDERS_STATUS_HISTORY . "\r\n                       (orders_id, orders_status_id, date_added, customer_notified, comments)\r\n                       VALUES ('" . $new_order_id . "',\r\n                       '" . $new_order['orders_status'] . "',\r\n                       now(),\r\n                       '" . $notify_split . "',\r\n                       '" . COMMENTS_SPLIT_NEW . $oID . "')");
         // notify customer (if selected)
         if ($notify_split) {
             email_latest_status($oID);
         }
     }
     // END if (isset($_POST['split_products']) && zen_not_null($_POST['split_products']))
     break;
 case 'history':
     $update_status_history = $db->Execute("SELECT * FROM " . TABLE_ORDERS_STATUS_HISTORY . "\r\n                                               WHERE orders_id = '" . $oID . "'\r\n                                               ORDER BY orders_status_history_id DESC");
     while (!$update_status_history->EOF) {
         $this_history_id = $update_status_history->fields['orders_status_history_id'];
         $this_status = $_POST['status_' . $this_history_id];
         $this_comments = zen_db_scrub_in($_POST['comments_' . $this_history_id]);
         $this_delete = $_POST['delete_' . $this_history_id];
         $change_exists = false;
         if ($this_delete == 1) {
             zen_db_delete(TABLE_ORDERS_STATUS_HISTORY, "orders_status_history_id = '" . $this_history_id . "'");
         }
function batch_status($oID, $status, $comments, $notify, $notify_comments) {
  
  global $db, $messageStack;
  require(DIR_WS_LANGUAGES . 'english/orders.php');

  $order_updated = false;
  $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
                                date_purchased from " . TABLE_ORDERS . "
                                where orders_id = '" . (int)$oID . "'");

  if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
    update_status($oID, $status, $notify, $comments);
 
	
	
	 

    if ($notify == '1') { 
         email_latest_status($oID);
    }
    $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
  }
  else {
    $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
  }
}