require_once(DIR_WS_CLASSES . 'phreebooks.php'); $dnXML = new phreebooks(); if (sizeof($pb_orders) > 0) $dnXML->submitXML('download', $pb_orders); $_GET['action'] = ''; $action = ''; $oID = ''; break; } */ if (zen_not_null($action) && $order_exists == true) { switch ($action) { case 'download': require_once DIR_WS_CLASSES . 'phreebooks.php'; // open the phreebooks class $dnXML = new phreebooks(); $dnXML->submitXML('download', array($oID)); $_GET['action'] = ''; $action = ''; $oID = ''; break; // EOF - Download operation added by PhreeSoft // EOF - Download operation added by PhreeSoft case 'edit': // reset single download to on if ($_GET['download_reset_on'] > 0) { // adjust download_maxdays based on current date $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,\n date_purchased from " . TABLE_ORDERS . "\n where orders_id = '" . $_GET['oID'] . "'"); // check for existing product attribute download days and max $chk_products_download_query = "SELECT orders_products_id, orders_products_filename, products_prid from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_products_download_id='" . $_GET['download_reset_on'] . "'"; $chk_products_download = $db->Execute($chk_products_download_query); $chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount\n from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n WHERE pa.products_attributes_id = pad.products_attributes_id\n and pad.products_attributes_filename = '" . $chk_products_download->fields['orders_products_filename'] . "'\n and pa.products_id = '" . (int) $chk_products_download->fields['products_prid'] . "'";
} } } if (zen_not_null($action) && $order_exists == true) { switch ($action) { // Begin - Download operation added by PhreeSoft to download order to PhreeBooks case 'download': $oID = zen_db_prepare_input($_GET['oID']); $order = new order($oID); // open the order and read all information $order->id = $oID; //echo 'order # ' . $oID . ' = '; print_r($order); echo'<br>'; require DIR_WS_CLASSES . 'phreebooks.php'; // open the phreebooks class $dnXML = new phreebooks(); if ($dnXML->submitXML('download', $order)) { // set the download successful flag $db->Execute("update " . TABLE_ORDERS . " set phreebooks = 1, last_modified = now() where orders_id = " . (int) $oID); } $_GET['action'] = ''; $action = ''; $oID = ''; break; // End - Download operation added by PhreeSoft // End - Download operation added by PhreeSoft case 'edit': // reset single download to on if ($_GET['download_reset_on'] > 0) { // adjust download_maxdays based on current date $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,\r\n date_purchased from " . TABLE_ORDERS . "\r\n where orders_id = '" . $_GET['oID'] . "'"); $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;