function shipping_get_name($id) { if (!$id) { return ''; } $parts = explode(':', $id); if (!$parts[0]) { return ''; } load_specific_method('shipping', $parts[0]); //echo 'id = ' . $id . ' and method = ' . constant($parts[0] . '_' . $parts[1]) . '<br>'; return defined($parts[0] . '_' . $parts[1]) ? constant($parts[0] . '_' . $parts[1]) : $id; }
function post_ordr($action) { global $db, $currencies, $messageStack, $processor; $this->journal_main_array = $this->build_journal_main_array(); // build ledger main record $this->journal_rows = array(); // initialize ledger row(s) array switch ($this->journal_id) { case 18: // Cash Receipts Journal $method = isset($this->shipper_code) ? $this->shipper_code : 'freecharger'; $method = load_specific_method('payment', $method); if (class_exists($method)) { $processor = new $method(); if (!defined('MODULE_PAYMENT_' . strtoupper($method) . '_STATUS')) { return false; } } $result = $this->add_item_journal_rows('credit'); // read in line items and add to journal row array $credit_total = $result['total']; $debit_total = $this->add_discount_journal_row('debit'); $debit_total += $this->add_total_journal_row('debit', $result['total'] - $result['discount']); break; case 20: // Cash Disbursements Journal $result = $this->add_item_journal_rows('debit'); // read in line items and add to journal row array $debit_total = $result['total']; $credit_total = $this->add_discount_journal_row('credit'); $credit_total += $this->add_total_journal_row('credit', $result['total'] - $result['discount']); break; default: return $this->fail_message('bad journal_id in banking pre-POST processing'); // this should never happen, JOURNAL_ID is tested at script entry! } // ***************************** START TRANSACTION ******************************* $db->transStart(); // ************* Pre-POST processing ************* if (!$this->validate_purchase_invoice_id()) { return false; } // ************* POST journal entry ************* if ($this->id) { // it's an edit, first unPost record, then rewrite if (!$this->Post($new_post = 'edit')) { return false; } $messageStack->add(BNK_REPOST_PAYMENT, 'caution'); } else { if (!$this->Post($new_post = 'insert')) { return false; } } // ************* post-POST processing ************* switch ($this->journal_id) { case 18: if ($this->purchase_invoice_id == '') { // it's a new record, increment the po/so/inv to next number if (!$this->increment_purchase_invoice_id()) { return false; } } // Lastly, we process the payment (for receipts). NEEDS TO BE AT THE END BEFORE THE COMMIT!!! // Because, if an error here we need to back out the entire post (which we can), but if // the credit card has been processed and the post fails, there is no way to back out the credit card charge. // if ($processor->pre_confirmation_check()) return false; // Update the save payment/encryption data if requested if (ENABLE_ENCRYPTION && $this->save_payment && $processor->enable_encryption !== false) { if (!$this->encrypt_payment($method, $processor->enable_encryption)) { return false; } } if ($processor->before_process()) { return false; } break; case 20: if ($new_post == 'insert') { // only increment if posting a new payment if (!$this->increment_purchase_invoice_id($force = true)) { return false; } } break; default: } $db->transCommit(); // finished successfully // ***************************** END TRANSACTION ******************************* $this->session_message(sprintf(TEXT_POST_SUCCESSFUL, constant('ORD_HEADING_NUMBER_' . $this->journal_id), $this->purchase_invoice_id), 'success'); return true; }
function load_shipment_details($id) { global $db; $this->ship_carrier = ''; $this->ship_service = ''; $this->tracking_id = ''; $shipping_info = explode(':', $this->shipper_code); $carrier = $shipping_info[0]; if ($carrier) { load_specific_method('shipping', $carrier); $this->ship_carrier = constant('MODULE_SHIPPING_' . strtoupper($carrier) . '_TITLE_SHORT'); $this->ship_service = defined($carrier . '_' . $shipping_info[1]) ? constant($carrier . '_' . $shipping_info[1]) : ''; $result = $db->Execute("SELECT tracking_id FROM " . TABLE_SHIPPING_LOG . " \n\t WHERE ref_id='{$this->purchase_invoice_id}' OR ref_id LIKE '" . $this->purchase_invoice_id . "-%'"); if ($result->RecordCount() > 0) { $tracking = array(); while (!$result->EOF) { $tracking[] = $result->fields['tracking_id']; $result->MoveNext(); } $this->tracking_id = $this->ship_carrier . ' ' . $this->ship_service . ' # ' . implode(', ', $tracking); } } }
// +-----------------------------------------------------------------+ // | 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/shipping/methods/ups/label_mgr/pre_process.php // $shipping_module = 'ups'; /************** include page specific files *********************/ load_specific_method('shipping', $shipping_module); require_once DIR_FS_WORKING . 'defaults.php'; require_once DIR_FS_WORKING . 'functions/shipping.php'; require_once DIR_FS_WORKING . 'classes/shipping.php'; /************** page specific initialization *************************/ $error = false; $auto_print = false; $label_data = NULL; $sInfo = new shipment(); $action = isset($_GET['action']) ? $_GET['action'] : $_POST['todo']; /*************** Act on the action request *************************/ switch ($action) { case 'label': // overwrite the defaults with data from the form reset($_POST); while (list($key, $value) = each($_POST)) {
load_specific_method('shipping', $method); $shipment = new $method(); $message = $shipment->trackPackages('', $tID); } break; case 'validate': $address = new objectInfo(); $address->ship_primary_name = db_prepare_input($_GET['primary_name']); $address->ship_contact = db_prepare_input($_GET['contact']); $address->ship_address1 = db_prepare_input($_GET['address1']); $address->ship_address2 = db_prepare_input($_GET['address2']); $address->ship_city_town = db_prepare_input($_GET['city_town']); $address->ship_state_province = db_prepare_input($_GET['state_province']); $address->ship_postal_code = db_prepare_input($_GET['postal_code']); $address->ship_country_code = db_prepare_input($_GET['country_code']); load_specific_method('shipping', $method); $shipment = new $method(); $result = $shipment->validateAddress($address); if ($result['result'] == 'success') { $xml .= $result['xmlString']; } $debug = $result['debug']; $message = $result['message']; break; } //$debug = 'method = '.$method.' and action = '.$_REQUEST['action'].' and tID = '.$tID; if ($message) { $xml .= xmlEntry('message', $message); } if ($debug) { $xml .= xmlEntry('debug', $debug);