Example #1
0
// load the sort fields
$_GET['sf'] = $_POST['sort_field'] ? $_POST['sort_field'] : $_GET['sf'];
$_GET['so'] = $_POST['sort_order'] ? $_POST['sort_order'] : $_GET['so'];
if (!isset($_REQUEST['list'])) {
    $_REQUEST['list'] = 1;
}
/***************   Act on the action request   *************************/
switch ($action) {
    case 'import':
        validate_security($security_level, 3);
        // first verify the file was uploaded ok
        if (!validate_upload($upload_name, 'text', 'txt')) {
            $messageStack->add('There was an error uploading the file.', 'error');
            break;
        } else {
            $salesOrder = new amazon();
            if ($salesOrder->processOrders($upload_name)) {
                gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
            }
        }
        break;
    case 'ship_confirm':
        $str = "order-id\torder-item-id\tquantity\tship-date\tcarrier-code\tcarrier-name\ttracking-number\tship-method\n";
        // fetch every shipment for the given post_date
        $result = $db->Execute("SELECT ref_id, carrier, method, ship_date, tracking_id \n\t  FROM " . TABLE_SHIPPING_LOG . " WHERE ship_date LIKE '{$ship_date}%'");
        if ($result->RecordCount() == 0) {
            $messageStack->add('No valid Amazon orders have been shipped on the date selected!', 'caution');
            break;
        }
        // for each shipment, fetch the invoice details needed
        $no_dups = array();
Example #2
0
 static function objectToArrayAndCharset($object)
 {
     global $charset;
     $out = array();
     foreach ($object as $key => $value) {
         switch (true) {
             case is_object($value):
                 $out[$key] = amazon::objectToArrayAndCharset($value);
                 break;
             case is_array($value):
                 $out[$key] = amazon::objectToArrayAndCharset($value);
                 break;
             default:
                 if ($charset != "utf-8") {
                     $out[$key] = iconv("utf-8", $charset . "//TRANSLIT", $value);
                 } else {
                     $out[$key] = $value;
                 }
                 break;
         }
     }
     return $out;
 }
<?php

// +-----------------------------------------------------------------+
// |                   PhreeBooks Open Source ERP                    |
// +-----------------------------------------------------------------+
// | Copyright(c) 2008-2014 PhreeSoft      (www.PhreeSoft.com)       |
// +-----------------------------------------------------------------+
// | This program is free software: you can redistribute it and/or   |
// | modify it under the terms of the GNU General Public License as  |
// | published by the Free Software Foundation, either version 3 of  |
// | the License, or any later version.                              |
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/inventory/custom/pages/main/extra_actions.php
//
// This file contains the extra actions added to the maintain inventory module, it is executed
// before the standard switch statement
switch ($_REQUEST['action']) {
    case 'amazondump':
        require DIR_FS_MODULES . 'amazon/classes/amazon.php';
        $upXML = new amazon();
        $upXML->dumpAmazon();
        $_REQUEST['action'] = '';
        break;
    default:
}