<?php

ini_set('include_path', ini_get('include_path') . ':' . $_SERVER['DOCUMENT_ROOT'] . '/admin/includes/');
include_once 'doba/DobaApi.php';
include_once 'doba/DobaProductAPI.php';
$api = new DobaApi();
// change the following variables to have the data you wish to submit
$action = DOBA_API_ACTION_GETPRODUCTDETAIL;
$data = array('watchlist_id' => '94227');
// end fields to be changed
echo "<strong>Testing:</strong> " . $action . "<br><strong>With data:</strong><pre>";
print_r($data);
echo "</pre><strong>Result:</strong>";
if ($api->compileRequestXml($action, $data) && $api->sendRequest()) {
    echo " Successfully submitted<br><strong>Response XML:</strong><pre>";
    echo htmlentities($api->getResponseXml());
    $productList = DobaProductAPI::parseProductDetails($api->getResponseXml());
    var_dump($productList);
} else {
    if ($api->hasErrors()) {
        echo " Submission Failure, with errors<br><strong>Errors:</strong><pre>";
        print_r($api->getErrors());
    } else {
        echo " Submission Failure, no errors<br><strong>Object dump:</strong><pre>";
        var_dump($api);
    }
}
echo "</pre>";
/*
  $Id: doba_configure.php,v 1.0 2008/01/17 14:40:27 hpdl Exp $

  Doba     Inventory on Demand
  http://www.doba.com

  Copyright (c) 2008 Doba

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
require_once 'doba/DobaProducts.php';
include_once 'doba/DobaApi.php';
include_once 'doba/DobaProductAPI.php';
$msg = '';
$api = new DobaApi();
if (isset($_POST['submit'])) {
    require_once 'doba/DobaInteraction.php';
    $watchlist_id = isset($_POST['watchlist_id']) ? intval($_POST['watchlist_id']) : 0;
    if ($watchlist_id > 0) {
        $action = DOBA_API_ACTION_GETPRODUCTDETAIL;
        $data = array('watchlist_id' => $watchlist_id);
        if ($api->compileRequestXml($action, $data) && $api->sendRequest()) {
            $objDobaProducts = DobaProductAPI::parseProductDetails($api->getResponseXml());
            if (is_a($objDobaProducts, 'DobaProducts') && DobaInteraction::loadDobaProductsIntoDB($objDobaProducts)) {
                require_once 'doba/DobaLog.php';
                DobaLog::logProductApiLoad($objDobaProducts, 'success');
                header('Location: ' . FILENAME_DOBA_PRODUCTS . '?api=success');
                exit;
            } else {
                $msg = 'Your request could not be completed at this time.  Please try again later.';
  $Id: doba_configure.php,v 1.0 2008/01/17 14:40:27 hpdl Exp $

  Doba     Product Sourcing Simplified
  http://www.doba.com

  Copyright (c) 2008 Doba

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
$downloaded = true;
require_once 'doba/DobaOrders.php';
require_once 'doba/DobaInteraction.php';
require_once 'doba/DobaLog.php';
include_once 'doba/DobaApi.php';
$api = new DobaApi();
$msg = '';
if (isset($_POST['ordergroup'])) {
    require_once 'doba/DobaOrderFile.php';
    $ordergroup = trim($_POST['ordergroup']);
    $objDobaOrders = DobaInteraction::loadOrders($ordergroup);
    $now = time();
    if ($_POST['act'] == 'download') {
        if (is_a($objDobaOrders, 'DobaOrders')) {
            $filename = 'orders_' . date('YmdHis', $now) . '.tab';
            // make this header replace previous headers
            header('Content-Type: application/octet-stream', true);
            header('Content-Disposition: attachment; ' . 'filename="' . $filename . '"');
            $objDobaOrderFile = new DobaOrderFile();
            $objDobaOrderFile->processData($objDobaOrders);
            if ($ordergroup == 'new') {