[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Webservices/LineItem/ -> VtigerProductTaxesOperation.php (source)

   1  <?php
   2  /*+*******************************************************************************
   3   *  The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *
  10   *********************************************************************************/
  11  require_once  'include/Webservices/VtigerActorOperation.php';
  12  
  13  /**
  14   * Description of VtigerProductTaxesOperation
  15   */
  16  class VtigerProductTaxesOperation extends VtigerActorOperation {
  17  	public function create($elementType, $element) {
  18          $db = PearDatabase::getInstance();
  19          $sql = 'SELECT * FROM vtiger_producttaxrel WHERE productid =? AND taxid=?';
  20          list($typeId, $productId) = vtws_getIdComponents($element['productid']);
  21          list($typeId, $taxId) = vtws_getIdComponents($element['taxid']);
  22          $params = array($productId, $taxId);
  23          $result = $db->pquery($sql,$params);
  24          $rowCount = $db->num_rows($result);
  25          if($rowCount > 0) {
  26              $id = $db->query_result($result,0, $this->meta->getObectIndexColumn());
  27              $meta = $this->getMeta();
  28              $element['id'] = vtws_getId($meta->getEntityId(), $id);
  29              return $this->update($element);
  30          }else{
  31              unset($element['id']);
  32              return parent::create($elementType, $element);
  33          }
  34      }
  35  }
  36  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1