*/ function getAccountHierarchy() { $focus = CRMEntity::getInstance($this->getModuleName()); $hierarchy = $focus->getAccountHierarchy($this->getId()); $i=0; foreach($hierarchy['entries'] as $accountId => $accountInfo) { preg_match('/(.*)<\/a>/i",$accountInfo[0], $name); $recordModel = Vtiger_Record_Model::getCleanInstance('Accounts'); $recordModel->setId($accountId); $hierarchy['entries'][$accountId][0] = $dashes[0]."".$name[2].""; } } return $hierarchy; } /** * Function returns the url for create event * @return */ function getCreateEventUrl() { $calendarModuleModel = Vtiger_Module_Model::getInstance('Calendar'); return $calendarModuleModel->getCreateEventRecordUrl().'&parent_id='.$this->getId(); } /** * Function returns the url for create todo * @retun */ function getCreateTaskUrl() { $calendarModuleModel = Vtiger_Module_Model::getInstance('Calendar'); return $calendarModuleModel->getCreateTaskRecordUrl().'&parent_id='.$this->getId(); } /** * Function to check duplicate exists or not * @return */ public function checkDuplicate() { $db = PearDatabase::getInstance(); $query = "SELECT 1 FROM vtiger_crmentity WHERE setype = ? AND label = ? AND deleted = 0"; $params = array($this->getModule()->getName(), decode_html($this->getName())); $record = $this->getId(); if ($record) { $query .= " AND crmid != ?"; array_push($params, $record); } $result = $db->pquery($query, $params); if ($db->num_rows($result)) { return true; } return false; } /** * Function to get List of Fields which are related from Accounts to Inventory Record. * @return */ public function getInventoryMappingFields() { return array( //Billing Address Fields array('parentField'=>'bill_city', 'inventoryField'=>'bill_city', 'defaultValue'=>''), array('parentField'=>'bill_street', 'inventoryField'=>'bill_street', 'defaultValue'=>''), array('parentField'=>'bill_state', 'inventoryField'=>'bill_state', 'defaultValue'=>''), array('parentField'=>'bill_code', 'inventoryField'=>'bill_code', 'defaultValue'=>''), array('parentField'=>'bill_country', 'inventoryField'=>'bill_country', 'defaultValue'=>''), array('parentField'=>'bill_pobox', 'inventoryField'=>'bill_pobox', 'defaultValue'=>''), //Shipping Address Fields array('parentField'=>'ship_city', 'inventoryField'=>'ship_city', 'defaultValue'=>''), array('parentField'=>'ship_street', 'inventoryField'=>'ship_street', 'defaultValue'=>''), array('parentField'=>'ship_state', 'inventoryField'=>'ship_state', 'defaultValue'=>''), array('parentField'=>'ship_code', 'inventoryField'=>'ship_code', 'defaultValue'=>''), array('parentField'=>'ship_country', 'inventoryField'=>'ship_country', 'defaultValue'=>''), array('parentField'=>'ship_pobox', 'inventoryField'=>'ship_pobox', 'defaultValue'=>'') ); } }