晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/akaindir/www/crm/include/Webservices/ |
Upload File : |
<?php
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*************************************************************************************/
abstract class EntityMeta{
public static $RETRIEVE = "DetailView";
public static $CREATE = "CreateView";
public static $UPDATE = "EditView";
public static $DELETE = "Delete";
protected $webserviceObject;
protected $objectName;
protected $objectId;
protected $user;
protected $baseTable;
protected $tableList;
protected $tableIndexList;
protected $defaultTableList;
protected $idColumn;
protected $userAccessibleColumns;
protected $columnTableMapping;
protected $fieldColumnMapping;
protected $mandatoryFields;
protected $referenceFieldDetails;
protected $emailFields;
protected $ownerFields;
protected $moduleFields = null;
protected function EntityMeta($webserviceObject,$user){
$this->webserviceObject = $webserviceObject;
$this->objectName = $this->webserviceObject->getEntityName();
$this->objectId = $this->webserviceObject->getEntityId();
$this->user = $user;
}
public function getEmailFields(){
if($this->emailFields === null){
$this->emailFields = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if((strcasecmp($webserviceField->getFieldType(),'e') === 0) || $webserviceField->getUIType() === '13'){
array_push($this->emailFields, $fieldName);
}
}
}
return $this->emailFields;
}
public function getFieldColumnMapping(){
if($this->fieldColumnMapping === null){
$this->fieldColumnMapping = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
$this->fieldColumnMapping[$fieldName] = $webserviceField->getColumnName();
}
$this->fieldColumnMapping['id'] = $this->idColumn;
}
return $this->fieldColumnMapping;
}
public function getMandatoryFields(){
if($this->mandatoryFields === null){
$this->mandatoryFields = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if($webserviceField->isMandatory() === true){
array_push($this->mandatoryFields,$fieldName);
}
}
}
return $this->mandatoryFields;
}
public function getReferenceFieldDetails(){
if($this->referenceFieldDetails === null){
$this->referenceFieldDetails = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if(strcasecmp($webserviceField->getFieldDataType(),'reference') === 0){
$this->referenceFieldDetails[$fieldName] = $webserviceField->getReferenceList();
}
}
}
return $this->referenceFieldDetails;
}
public function getOwnerFields(){
if($this->ownerFields === null){
$this->ownerFields = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if(strcasecmp($webserviceField->getFieldDataType(),'owner') === 0){
array_push($this->ownerFields, $fieldName);
}
}
}
return $this->ownerFields;
}
public function getObectIndexColumn(){
return $this->idColumn;
}
public function getUserAccessibleColumns(){
if($this->userAccessibleColumns === null){
$this->userAccessibleColumns = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
array_push($this->userAccessibleColumns,$webserviceField->getColumnName());
}
array_push($this->userAccessibleColumns,$this->idColumn);
}
return $this->userAccessibleColumns;
}
public function getFieldByColumnName($column){
$fields = $this->getModuleFields();
foreach ($fields as $fieldName=>$webserviceField) {
if($column == $webserviceField->getColumnName()) {
return $webserviceField;
}
}
return null;
}
public function getColumnTableMapping(){
if($this->columnTableMapping === null){
$this->columnTableMapping = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
$this->columnTableMapping[$webserviceField->getColumnName()] = $webserviceField->getTableName();
}
$this->columnTableMapping[$this->idColumn] = $this->baseTable;
}
return $this->columnTableMapping;
}
function getUser(){
return $this->user;
}
function hasMandatoryFields($row){
$mandatoryFields = $this->getMandatoryFields();
$hasMandatory = true;
foreach($mandatoryFields as $ind=>$field){
// dont use empty API as '0'(zero) is a valid value.
if( !isset($row[$field]) || $row[$field] === "" || $row[$field] === null ){
throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING,
"$field does not have a value");
}
}
return $hasMandatory;
}
public function isUpdateMandatoryFields($element){
if(!is_array($element)){
throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING,
"Mandatory field does not have a value");
}
$mandatoryFields = $this->getMandatoryFields();
$updateFields = array_keys($element);
$hasMandatory = true;
$updateMandatoryFields = array_intersect($updateFields, $mandatoryFields);
if(!empty($updateMandatoryFields)){
foreach($updateMandatoryFields as $ind=>$field){
// dont use empty API as '0'(zero) is a valid value.
if( !isset($element[$field]) || $element[$field] === "" || $element[$field] === null ){
throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING,
"$field does not have a value");
}
}
}
return $hasMandatory;
}
public function getModuleFields(){
return $this->moduleFields;
}
public function getFieldNameListByType($type) {
$type = strtolower($type);
$typeList = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if(strcmp($webserviceField->getFieldDataType(),$type) === 0){
array_push($typeList, $fieldName);
}
}
return $typeList;
}
public function getFieldListByType($type) {
$type = strtolower($type);
$typeList = array();
$moduleFields = $this->getModuleFields();
foreach ($moduleFields as $fieldName=>$webserviceField) {
if(strcmp($webserviceField->getFieldDataType(),$type) === 0){
array_push($typeList, $webserviceField);
}
}
return $typeList;
}
public function getIdColumn(){
return $this->idColumn;
}
public function getEntityBaseTable() {
return $this->baseTable;
}
public function getEntityTableIndexList() {
return $this->tableIndexList;
}
public function getEntityDefaultTableList() {
return $this->defaultTableList;
}
public function getEntityTableList() {
return $this->tableList;
}
public function getEntityAccessControlQuery(){
$accessControlQuery = '';
return $accessControlQuery;
}
public function getEntityDeletedQuery(){
if($this->getEntityName() == 'Leads') {
return "vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0";
}
if($this->getEntityName() != "Users"){
return "vtiger_crmentity.deleted=0";
}
// not sure whether inactive users should be considered deleted or not.
return "vtiger_users.status='Active'";
}
abstract function hasPermission($operation,$webserviceId);
abstract function hasAssignPrivilege($ownerWebserviceId);
abstract function hasDeleteAccess();
abstract function hasAccess();
abstract function hasReadAccess();
abstract function hasCreateAccess();
abstract function hasWriteAccess();
abstract function getEntityName();
abstract function getEntityId();
abstract function exists($recordId);
abstract function getObjectEntityName($webserviceId);
abstract public function getNameFields();
abstract public function getName($webserviceId);
abstract public function isModuleEntity();
}
?>