0) { $record['noDownloads'] = 0; $record['expire'] = time()+$config['dnLoadExpire']; $where = 'id = '.$_GET['reset']; $update = $db->update($glob['dbprefix']."CubeCart_Downloads", $record, $where); httpredir($glob['adminFile'].'?_g=orders/orderBuilder&edit='.$_GET['edit']); } if (isset($_POST['cart_order_id']) && !isset($_POST['prodRowsSubmit']) && $_POST['customer_id']>0) { $cache = new cache(); $cache->clearCache(); // ORDER INVENTORY if (count($_POST['prodName'])>0) { for ($i=0;$i<=count($_POST['prodName']);$i++) { if ((!empty($_POST['prodName'][$i]) && !empty($_POST['quantity'][$i]) && !empty($_POST['price'][$i])) || $_POST['delId'][$i] == 1) { $newOrderInv['name'] = $db->mySQLSafe($_POST['prodName'][$i]); $newOrderInv['productCode'] = $db->mySQLSafe($_POST['productCode'][$i]); $newOrderInv['product_options'] = $db->mySQLSafe($_POST['product_options'][$i]); $newOrderInv['quantity'] = $db->mySQLSafe($_POST['quantity'][$i]); $newOrderInv['price'] = $db->mySQLSafe($_POST['price'][$i]); $newOrderInv['cart_order_id'] = $db->mySQLSafe($_POST['cart_order_id']); if ($_POST['delId'][$i] == 1) { $where = "id = ".$db->mySQLSafe($_POST['id'][$i]); $delete = $db->delete($glob['dbprefix']."CubeCart_order_inv", $where); } else if ($_POST['id'][$i]>0) { $where = "id = ".$db->mySQLSafe($_POST['id'][$i]); $update = $db->update($glob['dbprefix']."CubeCart_order_inv", $newOrderInv, $where); } else { $insert = $db->insert($glob['dbprefix']."CubeCart_order_inv", $newOrderInv); } } } } // ORDER SUMMARY $newOrderSum['cart_order_id'] = $db->mySQLSafe($_POST['cart_order_id']); $newOrderSum['customer_id'] = $db->mySQLSafe($_POST['customer_id']); $newOrderSum['name'] = $db->mySQLSafe($_POST['name']); $newOrderSum['add_1'] = $db->mySQLSafe($_POST['add_1']); $newOrderSum['add_2'] = $db->mySQLSafe($_POST['add_2']); $newOrderSum['town'] = $db->mySQLSafe($_POST['town']); $newOrderSum['county'] = $db->mySQLSafe($_POST['county']); $newOrderSum['postcode'] = $db->mySQLSafe($_POST['postcode']); $newOrderSum['country'] = $db->mySQLSafe($_POST['country']); $newOrderSum['name_d'] = $db->mySQLSafe($_POST['name_d']); $newOrderSum['companyName'] = $db->mySQLSafe($_POST['companyName']); $newOrderSum['companyName_d'] = $db->mySQLSafe($_POST['companyName_d']); $newOrderSum['add_1_d'] = $db->mySQLSafe($_POST['add_1_d']); $newOrderSum['add_2_d'] = $db->mySQLSafe($_POST['add_2_d']); $newOrderSum['town_d'] = $db->mySQLSafe($_POST['town_d']); $newOrderSum['county_d'] = $db->mySQLSafe($_POST['county_d']); $newOrderSum['postcode_d'] = $db->mySQLSafe($_POST['postcode_d']); $newOrderSum['country_d'] = $db->mySQLSafe($_POST['country_d']); $newOrderSum['phone'] = $db->mySQLSafe($_POST['phone']); $newOrderSum['mobile'] = $db->mySQLSafe($_POST['mobile']); $newOrderSum['subtotal'] = $db->mySQLSafe($_POST['subtotal']); $newOrderSum['discount'] = $db->mySQLSafe($_POST['discount']); $newOrderSum['prod_total'] = $db->mySQLSafe($_POST['prod_total']); $newOrderSum['total_tax'] = $db->mySQLSafe($_POST['total_tax']); $newOrderSum['total_ship'] = $db->mySQLSafe($_POST['total_ship']); // removed as this is done further down $newOrderSum['status'] = $db->mySQLSafe($_POST['status']); $newOrderSum['comments'] = $db->mySQLSafe($_POST['comments']); $newOrderSum['customer_comments'] = $db->mySQLSafe($_POST['customer_comments']); $newOrderSum['extra_notes'] = $db->mySQLSafe($_POST['extra_notes']); $newOrderSum['email'] = $db->mySQLSafe($_POST['email']); $newOrderSum['ship_date'] = $db->mySQLSafe($_POST['ship_date']); $newOrderSum['shipMethod'] = $db->mySQLSafe($_POST['shipMethod']); $newOrderSum['gateway'] = $db->mySQLSafe($_POST['gateway']); $newOrderSum['courier_tracking'] = $db->mySQLsafe($_POST['courier_tracking']); if (isset($_GET['edit'])) { $where = "cart_order_id = ".$db->mySQLSafe($_GET['edit']); $update = $db->update($glob['dbprefix']."CubeCart_order_sum", $newOrderSum, $where); if (isset($_POST['cc_delete'])) { $record['offline_capture'] = "''"; $db->update($glob['dbprefix'].'CubeCart_order_sum', $record, array('customer_id' => $_POST['customer_id'], 'cart_order_id' => $_POST['cart_order_id'])); ## If not under SSL card fileds defalt to "xxx" } elseif($_POST['card_type']!=="xxx") { if (isset($_POST['card_number'])) { $cardData = array( 'card_type' => $_POST['card_type'], 'card_number' => $_POST['card_number'], 'card_expire' => $_POST['card_expire'], 'card_valid' => $_POST['card_valid'], 'card_issue' => $_POST['card_issue'], 'card_cvv' => $_POST['card_cvv'], ); if (function_exists('mcrypt_module_open')) { require_once("classes".CC_DS."cart".CC_DS."encrypt.inc.php"); $keyArray = array($_POST['cart_order_id']); $crypt = new encryption($keyArray); $record['offline_capture'] = "'".base64_encode($crypt->encrypt(serialize($cardData)))."'"; } $db->update($glob['dbprefix'].'CubeCart_order_sum', $record, array('customer_id' => $_POST['customer_id'], 'cart_order_id' => $_POST['cart_order_id'])); } } if ($update == true) { $msg .= "
".sprintf($lang['admin']['orders_updated_successfully'],$_GET['edit'])."
"; }/* else { $msg .= "".sprintf($lang['admin']['orders_update_failed'], $_GET['edit'])."
"; } */ } else { $newOrderSum['ip'] = $db->mySQLSafe(get_ip_address()); $newOrderSum['time'] = $db->mySQLSafe(time()); $insert = $db->insert($glob['dbprefix']."CubeCart_order_sum", $newOrderSum); if ($_POST['customer_id']>0) { $record['noOrders'] = "noOrders + 1"; $where = "customer_id = ".$_POST['customer_id']; $update = $db->update($glob['dbprefix']."CubeCart_customer", $record, $where); } if ($insert == true) { $msg .= "".sprintf($lang['admin']['orders_add_success'],$_POST['cart_order_id'])."
"; // send email confirmation $order->newOrderEmail($_POST['cart_order_id']); } else { $msg .= "".sprintf($lang['admin']['orders_add_fail'],$_POST['cart_order_id'])."
"; } } // update order status email etc $order->orderStatus($_POST['status'], $_POST['cart_order_id'], true); if ($_POST['cart_order_id']!==$_GET['edit']) { httpredir($glob['adminFile']."?_g=orders/orderBuilder&edit=".$_POST['cart_order_id']); } } if (isset($_GET['edit'])) { $orderSum = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE cart_order_id = ".$db->mySQLSafe($_GET['edit'])); $orderInv = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_order_inv WHERE cart_order_id = ".$db->mySQLSafe($_GET['edit'])); } if (count($orderInv) < 1 && !empty($_GET['edit'])) { $msg .= "".sprintf($lang['admin']['orders_no_products'], $_GET['edit'])."
"; } $sql = "SELECT * FROM ".$glob['dbprefix']."CubeCart_customer WHERE `type` > 0"; $noCustomers = $db->numrows($sql); ## Work around to change the drop dowm menu to a text box if there are over 500 customers. Current ## solution drastically slows or even halts the page. Ajax lookup required. ## See bug 1212 if($noCustomers<500) { $customers = $db->select($sql." ORDER BY lastName, firstName ASC"); } $countries = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_iso_countries"); if ($countries == true) { $countriesArray = array(); for($i=0;$i<=count($countries);$i++){ $countriesArray[$countries[$i]['id']] = $countries[$i]['printable_name']; } } if(isset($_GET['PayPal-Pro']) && !empty($_GET['PayPal-Pro'])) { // Get Module Config $module = fetchDbConfig("PayPal_Pro"); $basePPPath = "modules".CC_DS."altCheckout".CC_DS."PayPal_Pro".CC_DS."wpp-".str_replace(array('ECO','DPO'),'',$module['mode']).CC_DS; $order_id = $_GET['edit']; $ppfunction = preg_replace('#[^a-z]#i', '', $_GET['PayPal-Pro']); switch($ppfunction) { case "doCapture": require_once($basePPPath."DoCaptureReceipt.php"); break; case "doAuth": case "doReAuth": require_once($basePPPath."DoReauthorizationReceipt.php"); break; case "doRefund": require_once($basePPPath."RefundReceipt.php"); break; case "doVoidAuth": require_once($basePPPath."DoVoidReceipt.php"); break; case "doFMF": require_once($basePPPath."ManagePendingTransactionStatus.php"); break; } } require_once($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php"); ?>