[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/include/Webservices/Custom/ -> VtigerCompanyDetails.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   * Description of VtigerCompanyDetails
  14   *
  15   * @author MAK
  16   */
  17  class VtigerCompanyDetails extends VtigerActorOperation {
  18  	public function create($elementType, $element) {
  19          $db = PearDatabase::getInstance();
  20          $sql = 'select * from vtiger_organizationdetails';
  21          $result = $db->pquery($sql,$params);
  22          $rowCount = $db->num_rows($result);
  23          if($rowCount > 0) {
  24              $id = $db->query_result($result,0,'organization_id');
  25              $meta = $this->getMeta();
  26              $element['id'] = vtws_getId($meta->getEntityId(), $id);
  27              return $this->revise($element);
  28          }else{
  29              $element = $this->handleFileUpload($element);
  30              return parent::create($elementType, $element);
  31          }
  32      }
  33  
  34  	function handleFileUpload($element) {
  35          $fileFieldList = $this->meta->getFieldListByType('file');
  36          foreach ($fileFieldList as $field) {
  37              $fieldname = $field->getFieldName();
  38              if(is_array($_FILES[$fieldname])) {
  39                  $element[$fieldname] = vtws_CreateCompanyLogoFile($fieldname);
  40              }
  41          }
  42          return $element;
  43      }
  44  
  45  	public function update($element) {
  46          $element = $this->handleFileUpload($element);
  47          return parent::update($element);
  48      }
  49  
  50  	public function revise($element) {
  51          $element = $this->handleFileUpload($element);
  52          return parent::revise($element);
  53      }
  54  
  55  }
  56  ?>


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