Exemplo n.º 1
0
 protected function FedExCancel()
 {
     // Create the new Fedex object
     if ($this->objFedexShipment->ShippingAccountId) {
         $fed = new FedExDC($this->objFedexShipment->ShippingAccount->AccessId, $this->objFedexShipment->ShippingAccount->AccessCode);
     } else {
         // if not billing to a sender account, use the default fedex account from admin_setting for FedEx communication
         $objFedexAccount = ShippingAccount::Load(QApplication::$TracmorSettings->FedexAccountId);
         $fed = new FedExDC($objFedexAccount->AccessId, $objFedexAccount->AccessCode);
     }
     // create new FedExDC object
     //$fed = new FedExDC($this->objShipment->ShippingAccount->Value, QApplication::$TracmorSettings->FedexMeterNumber);
     // Populate an array with the necessary information
     $fdx_arr = array(1 => $this->objShipment->ShipmentNumber, 29 => $this->objShipment->TrackingNumber);
     // If ground service
     // if($this->objShipment->FedexServiceType->Value	== '92')
     if ($this->objFedexShipment->FedexServiceType->Value == '92') {
         $cancel_Ret = $fed->ground_cancel($fdx_arr);
     } else {
         $cancel_Ret = $fed->express_cancel($fdx_arr);
     }
     // If there is an error, display it and return false
     if ($error = $fed->getError()) {
         $this->btnCancelCompleteShipment->Warning = $error;
         return false;
     } else {
         return true;
     }
 }