/**
  * Adds tax status
  *
  * @param string $passkey
  * @param int $intRowid
  * @param string $strStatus
  * @param int $blnTax1Exempt
  * @param int $blnTax2Exempt
  * @param int $blnTax3Exempt
  * @param int $blnTax4Exempt
  * @param int $blnTax5Exempt
  * @return string
  */
 function add_tax_status($passkey, $intRowid, $strStatus, $blnTax1Exempt, $blnTax2Exempt, $blnTax3Exempt, $blnTax4Exempt, $blnTax5Exempt)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     if ($strStatus == "") {
         //ignore blank tax statuses
         return self::OK;
     }
     // Loads tax
     $tax = TaxStatus::LoadByLS($intRowid);
     if (!$tax) {
         $tax = new TaxStatus();
     }
     $tax->lsid = $intRowid;
     $tax->status = $strStatus;
     $tax->tax1_status = $blnTax1Exempt;
     $tax->tax2_status = $blnTax2Exempt;
     $tax->tax3_status = $blnTax3Exempt;
     $tax->tax4_status = $blnTax4Exempt;
     $tax->tax5_status = $blnTax5Exempt;
     if (!$tax->save()) {
         Yii::log("SOAP ERROR : Error saving category {$strStatus} " . print_r($tax->getErrors()), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return self::UNKNOWN_ERROR . " Error saving category {$strStatus} " . print_r($tax->getErrors(), true);
     }
     return self::OK;
 }
Ejemplo n.º 2
0
 /**
  * For a product, returns tax rate for all defined destinations
  * Useful for RSS exports
  * @return TaxGrid[]
  */
 public function GetTaxRateGrid()
 {
     $arrGrid = array();
     $intTaxStatus = $this->tax_status_id;
     $objStatus = TaxStatus::LoadByLS($intTaxStatus);
     $objDestinations = Destination::model()->findAll();
     foreach ($objDestinations as $objDestination) {
         //Because of differences in how Google defines zip code ranges, we can't convert our ranges
         //to theirs. At this time we won't be able to support zip code ranges
         if (!is_null($objDestination->country) && $objDestination->Zipcode1 == '') {
             $objTaxCode = TaxCode::LoadByLS($objDestination->taxcode);
             //print_r($objTaxCode);
             $fltRate = 0.0;
             for ($x = 1; $x <= 5; $x++) {
                 $statusstring = "tax" . $x . "_status";
                 $codestring = "tax" . $x . "_rate";
                 if ($objStatus->{$statusstring} == 0) {
                     $fltRate += $objTaxCode->{$codestring};
                 }
             }
             //Our four elements
             $strCountry = Country::CodeById($objDestination->country);
             if (!is_null($objDestination->state)) {
                 $strState = State::CodeById($objDestination->state);
             } else {
                 $strState = '';
             }
             //$fltRate -- built above
             $strTaxShip = Yii::app()->params['SHIPPING_TAXABLE'] == '1' ? "y" : "n";
             $arrGrid[] = array($strCountry, $strState, $fltRate, $strTaxShip);
         }
     }
     return $arrGrid;
 }
Ejemplo n.º 3
0
 /**
  * Adds tax status
  *
  * @param string $passkey
  * @param int $intRowid
  * @param string $strStatus
  * @param int $blnTax1Exempt
  * @param int $blnTax2Exempt
  * @param int $blnTax3Exempt
  * @param int $blnTax4Exempt
  * @param int $blnTax5Exempt
  * @return string
  * @throws SoapFault
  * @soap
  */
 function add_tax_status($passkey, $intRowid, $strStatus, $blnTax1Exempt, $blnTax2Exempt, $blnTax3Exempt, $blnTax4Exempt, $blnTax5Exempt)
 {
     self::check_passkey($passkey);
     if ($strStatus == "") {
         //ignore blank tax statuses
         return self::OK;
     }
     // Loads tax
     $tax = TaxStatus::LoadByLS($intRowid);
     if (!$tax) {
         $tax = new TaxStatus();
     }
     $tax->lsid = $intRowid;
     $tax->status = $strStatus;
     $tax->tax1_status = $blnTax1Exempt;
     $tax->tax2_status = $blnTax2Exempt;
     $tax->tax3_status = $blnTax3Exempt;
     $tax->tax4_status = $blnTax4Exempt;
     $tax->tax5_status = $blnTax5Exempt;
     if (!$tax->save()) {
         $strMsg = "Error saving category {$strStatus}";
         Yii::log("SOAP ERROR : {$strMsg} " . print_r($tax->getErrors(), true), CLogger::LEVEL_ERROR, 'application.' . __CLASS__ . "." . __FUNCTION__);
         throw new SoapFault($strMsg, WsSoapException::ERROR_UNKNOWN);
     }
     return self::OK;
 }