本文整理汇总了PHP中vtws_listtypes函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_listtypes函数的具体用法?PHP vtws_listtypes怎么用?PHP vtws_listtypes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_listtypes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vtws_retrieve
function vtws_retrieve($id, $user)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$entity = $handler->retrieve($id);
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:32,代码来源:Retrieve.php
示例2: vtws_setrelation
function vtws_setrelation($relateThisId, $withTheseIds, $user)
{
global $log, $adb;
list($moduleId, $elementId) = vtws_getIdComponents($relateThisId);
$webserviceObject = VtigerWebserviceObject::fromId($adb, $moduleId);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$moduleName = $meta->getObjectEntityName($relateThisId);
$types = vtws_listtypes(null, $user);
if (!in_array($moduleName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($moduleName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$UPDATE, $relateThisId)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
if (!$meta->exists($elementId)) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
vtws_internal_setrelation($elementId, $moduleName, $withTheseIds);
VTWS_PreserveGlobal::flush();
return true;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:SetRelation.php
示例3: vtws_update
function vtws_update($element, $user)
{
global $log, $adb;
$idList = vtws_getIdComponents($element['id']);
$webserviceObject = VtigerWebserviceObject::fromId($adb, $idList[0]);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($element['id']);
$types = vtws_listtypes($user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$UPDATE, $element['id'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
if (!$meta->exists($idList[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$referenceFields = $meta->getReferenceFieldDetails();
foreach ($referenceFields as $fieldName => $details) {
if (isset($element[$fieldName]) && strlen($element[$fieldName]) > 0) {
$ids = vtws_getIdComponents($element[$fieldName]);
$elemTypeId = $ids[0];
$elemId = $ids[1];
$referenceObject = VtigerWebserviceObject::fromId($adb, $elemTypeId);
if (!in_array($referenceObject->getEntityName(), $details)) {
throw new WebServiceException(WebServiceErrorCode::$REFERENCEINVALID, "Invalid reference specified for {$fieldName}");
}
if (!in_array($referenceObject->getEntityName(), $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to access reference type is denied " . $referenceObject->getEntityName());
}
} else {
if ($element[$fieldName] !== NULL) {
unset($element[$fieldName]);
}
}
}
$meta->hasMandatoryFields($element);
$ownerFields = $meta->getOwnerFields();
if (is_array($ownerFields) && sizeof($ownerFields) > 0) {
foreach ($ownerFields as $ownerField) {
if (isset($element[$ownerField]) && $element[$ownerField] !== null && !$meta->hasAssignPrivilege($element[$ownerField])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Cannot assign record to the given user");
}
}
}
$entity = $handler->update($element);
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:hardikk,项目名称:HNH,代码行数:59,代码来源:Update.php
示例4: vtws_retrieve
function vtws_retrieve($id, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$entity = $handler->retrieve($id);
//return product lines
if ($entityName == 'Quotes' || $entityName == 'PurchaseOrder' || $entityName == 'SalesOrder' || $entityName == 'Invoice') {
list($wsid, $recordid) = explode('x', $id);
$result = $adb->pquery('select * from vtiger_inventoryproductrel where id=?', array($recordid));
while ($row = $adb->getNextRow($result, false)) {
if ($row['discount_amount'] == NULL && $row['discount_percent'] == NULL) {
$discount = 0;
$discount_type = 0;
} else {
$discount = 1;
}
if ($row['discount_amount'] == NULL) {
$discount_amount = 0;
} else {
$discount_amount = $row['discount_amount'];
$discount_type = 'amount';
}
if ($row['discount_percent'] == NULL) {
$discount_percent = 0;
} else {
$discount_percent = $row['discount_percent'];
$discount_type = 'percentage';
}
$onlyPrd = array("productid" => $row['productid'], "comment" => $row['comment'], "qty" => $row['quantity'], "listprice" => $row['listprice'], 'discount' => $discount, "discount_type" => $discount_type, "discount_percentage" => $discount_percent, "discount_amount" => $discount_amount);
$entity['pdoInformation'][] = $onlyPrd;
}
}
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:58,代码来源:Retrieve.php
示例5: vtws_retrievedocattachment
function vtws_retrievedocattachment($all_ids, $returnfile, $user)
{
global $log, $adb;
$entities = array();
$docWSId = vtyiicpng_getWSEntityId('Documents');
$log->debug("Entering function vtws_retrievedocattachment");
$all_ids = "(" . str_replace($docWSId, '', $all_ids) . ")";
$query = "SELECT n.notesid, n.filename, n.filelocationtype\n FROM vtiger_notes n\n INNER JOIN vtiger_crmentity c ON c.crmid=n.notesid\n WHERE n.notesid in {$all_ids} and n.filelocationtype in ('I','E') and c.deleted=0";
$result = $adb->query($query);
$nr = $adb->num_rows($result);
for ($i = 0; $i < $nr; $i++) {
$id = $docWSId . $adb->query_result($result, $i, 'notesid');
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object ({$id}) is denied");
}
$ids = vtws_getIdComponents($id);
if (!$meta->exists($ids[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Document Record you are trying to access is not found");
}
$document_id = $ids[1];
$filetype = $adb->query_result($result, $i, 'filelocationtype');
if ($filetype == 'E') {
$entity["recordid"] = $adb->query_result($result, $i, 'notesid');
$entity["filetype"] = $fileType;
$entity["filename"] = $adb->query_result($result, $i, 'filename');
$entity["filesize"] = 0;
$entity["attachment"] = base64_encode('');
} elseif ($filetype == 'I') {
$entity = vtws_retrievedocattachment_get_attachment($document_id, true, $returnfile);
}
$entities[$id] = $entity;
VTWS_PreserveGlobal::flush();
}
// end for ids
$log->debug("Leaving function vtws_retrievedocattachment");
return $entities;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:54,代码来源:RetrieveDocAttachment.php
示例6: cbws_getrecordimageinfo
function cbws_getrecordimageinfo($id, $user)
{
global $log, $adb, $site_URL;
$log->debug("Entering function cbws_getrecordimageinfo({$id})");
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read entity is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$ids = vtws_getIdComponents($id);
$pdoid = $ids[1];
$rdo = array();
$query = 'select vtiger_attachments.name, vtiger_attachments.type, vtiger_attachments.attachmentsid, vtiger_attachments.path
from vtiger_attachments
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid
where (vtiger_crmentity.setype LIKE "%Image" or vtiger_crmentity.setype LIKE "%Attachment")
and deleted=0 and vtiger_seattachmentsrel.crmid=?';
$result_image = $adb->pquery($query, array($pdoid));
$rdo['results'] = $adb->num_rows($result_image);
$rdo['images'] = array();
while ($img = $adb->fetch_array($result_image)) {
$imga = array();
$imga['name'] = $img['name'];
$imga['path'] = $img['path'];
$imga['fullpath'] = $site_URL . '/' . $img['path'] . $img['attachmentsid'] . '_' . $img['name'];
$imga['type'] = $img['type'];
$imga['id'] = $img['attachmentsid'];
$rdo['images'][] = $imga;
}
VTWS_PreserveGlobal::flush();
$log->debug("Leaving function cbws_getrecordimageinfo");
return $rdo;
}
开发者ID:kduqi,项目名称:corebos,代码行数:53,代码来源:getRecordImages.php
示例7: vtws_query
function vtws_query($q, $user)
{
static $vtws_query_cache = array();
$adb = PearDatabase::getInstance();
$log = vglobal('log');
// Cache the instance for re-use
$moduleRegex = "/[fF][rR][Oo][Mm]\\s+([^\\s;]+)/";
$moduleName = '';
if (preg_match($moduleRegex, $q, $m)) {
$moduleName = trim($m[1]);
}
if (!isset($vtws_create_cache[$moduleName]['webserviceobject'])) {
$webserviceObject = VtigerWebserviceObject::fromQuery($adb, $q);
$vtws_query_cache[$moduleName]['webserviceobject'] = $webserviceObject;
} else {
$webserviceObject = $vtws_query_cache[$moduleName]['webserviceobject'];
}
// END
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
// Cache the instance for re-use
if (!isset($vtws_query_cache[$moduleName]['handler'])) {
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$vtws_query_cache[$moduleName]['handler'] = $handler;
} else {
$handler = $vtws_query_cache[$moduleName]['handler'];
}
// END
// Cache the instance for re-use
if (!isset($vtws_query_cache[$moduleName]['meta'])) {
$meta = $handler->getMeta();
$vtws_query_cache[$moduleName]['meta'] = $meta;
} else {
$meta = $vtws_query_cache[$moduleName]['meta'];
}
// END
$types = vtws_listtypes(null, $user);
if (!in_array($webserviceObject->getEntityName(), $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if (!$meta->hasReadAccess()) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read is denied");
}
$result = $handler->query($q);
VTWS_PreserveGlobal::flush();
return $result;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:48,代码来源:Query.php
示例8: vtws_describe
function vtws_describe($elementType, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromName($adb, $elementType);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$types = vtws_listtypes(null, $user);
if (!in_array($elementType, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
$entity = $handler->describe($elementType);
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:17,代码来源:DescribeObject.php
示例9: getListing
function getListing($user)
{
$modulewsids = Mobile_WS_Utils::getEntityModuleWSIds();
// Disallow modules
unset($modulewsids['Users']);
// Calendar & Events module will be merged
unset($modulewsids['Events']);
$listresult = vtws_listtypes(null, $user);
$listing = array();
foreach ($listresult['types'] as $index => $modulename) {
if (!isset($modulewsids[$modulename])) {
continue;
}
$listing[] = array('id' => $modulewsids[$modulename], 'name' => $modulename, 'isEntity' => $listresult['information'][$modulename]['isEntity'], 'label' => $listresult['information'][$modulename]['label'], 'singular' => $listresult['information'][$modulename]['singular']);
}
return $listing;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:17,代码来源:LoginAndFetchModules.php
示例10: getEmailRelatedModules
/**
* Function to get emails related modules
* @return <Array> - list of modules
*/
public function getEmailRelatedModules()
{
$userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$relatedModules = vtws_listtypes(array('email'), Users_Record_Model::getCurrentUserModel());
$relatedModules = $relatedModules['types'];
foreach ($relatedModules as $key => $moduleName) {
if ($moduleName === 'Users') {
unset($relatedModules[$key]);
}
}
foreach ($relatedModules as $moduleName) {
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if ($userPrivModel->isAdminUser() || $userPrivModel->hasGlobalReadPermission() || $userPrivModel->hasModulePermission($moduleModel->getId())) {
$emailRelatedModules[] = $moduleName;
}
}
$emailRelatedModules[] = 'Users';
return $emailRelatedModules;
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:23,代码来源:Module.php
示例11: vtws_query
function vtws_query($q, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromQuery($adb, $q);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$types = vtws_listtypes(null, $user);
if (!in_array($webserviceObject->getEntityName(), $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if (!$meta->hasReadAccess()) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read is denied");
}
$result = $handler->query($q);
VTWS_PreserveGlobal::flush();
return $result;
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:20,代码来源:Query.php
示例12: vtws_deleteUser
/**
* @author MAK
*/
function vtws_deleteUser($id, $newOwnerId, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes($user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied, EntityName = " . $entityName);
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$DELETE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found, idComponent = " . $idComponents);
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$newIdComponents = vtws_getIdComponents($newOwnerId);
if (empty($newIdComponents[1])) {
//force the default user to be the default admin user.
//added cause eazybusiness team is sending this value empty
$newIdComponents[1] = 1;
}
vtws_transferOwnership($idComponents[1], $newIdComponents[1]);
//delete from user vtiger_table;
$sql = "delete from vtiger_users where id=?";
vtws_runQueryAsTransaction($sql, array($idComponents[1]), $result);
VTWS_PreserveGlobal::flush();
return array("status" => "successful");
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:43,代码来源:DeleteUser.php
示例13: getListing
function getListing($user)
{
function useSortBySettings($a, $b)
{
global $displayed_modules;
$posA = $displayed_modules[$a['name']];
$posB = $displayed_modules[$b['name']];
if ($posA == $posB) {
return 0;
}
return $posA < $posB ? -1 : 1;
}
//settings information
global $displayed_modules, $current_language, $app_strings;
$modulewsids = Mobile_WS_Utils::getEntityModuleWSIds();
// Disallow modules
unset($modulewsids['Users']);
include_once dirname(__FILE__) . '/../../Mobile.Config.php';
$CRM_Version = Mobile::config('crm_version');
if ($CRM_Version != '5.2.1') {
//we use this class only for privilege purposes on types
$listresult = vtws_listtypes(null, $user, 'en_us');
} else {
$listresult = vtws_listtypes($user);
}
$listing = array();
foreach ($listresult['types'] as $index => $modulename) {
if (!isset($modulewsids[$modulename])) {
continue;
}
if (in_array($modulename, $displayed_modules)) {
$listing[] = array('id' => $modulewsids[$modulename], 'name' => $modulename, 'isEntity' => $listresult['information'][$modulename]['isEntity'], 'label' => getTranslatedString($modulename, $modulename), 'singular' => getTranslatedString('SINGLE_' . $modulename, $modulename));
}
}
//make sure the active modules are displayed in the order of the $displayed_modules settings entry in MobileSettings.config.php
$displayed_modules = array_flip($displayed_modules);
usort($listing, 'useSortBySettings');
return $listing;
}
开发者ID:kduqi,项目名称:corebos,代码行数:39,代码来源:LoginAndFetchModules.php
示例14: cbws_getpdfdata
function cbws_getpdfdata($id, $user)
{
global $log, $adb;
$log->debug("Entering function vtws_getpdfdata");
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$objectName = $webserviceObject->getEntityName();
if (!in_array($objectName, array('Invoice', 'Quotes', 'SalesOrder', 'PurchaseOrder'))) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Only Inventory modules support PDF Output.");
}
$ids = vtws_getIdComponents($id);
$document_id = $ids[1];
$entity = get_module_pdf($objectName, $document_id);
VTWS_PreserveGlobal::flush();
$log->debug("Leaving function vtws_getpdfdata");
return $entity;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:39,代码来源:GetPDFData.php
示例15: vtws_deleteUser
/**
* @author MAK
*/
function vtws_deleteUser($id, $newOwnerId, $user)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied, EntityName = " . $entityName);
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$DELETE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found, idComponent = " . $idComponents);
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$newIdComponents = vtws_getIdComponents($newOwnerId);
if (empty($newIdComponents[1])) {
//force the default user to be the default admin user.
$newIdComponents[1] = 1;
}
$userObj = new Users();
$userObj->transformOwnerShipAndDelete($idComponents[1], $newIdComponents[1]);
VTWS_PreserveGlobal::flush();
return array("status" => "successful");
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:41,代码来源:DeleteUser.php
示例16: vtws_relatedtypes
function vtws_relatedtypes($elementType, $user)
{
global $adb, $log;
$allowedTypes = vtws_listtypes(null, $user);
$webserviceObject = VtigerWebserviceObject::fromName($adb, $elementType);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$tabid = $meta->getTabId();
$sql = "SELECT vtiger_relatedlists.label, vtiger_tab.name, vtiger_tab.isentitytype FROM vtiger_relatedlists \n INNER JOIN vtiger_tab ON vtiger_tab.tabid=vtiger_relatedlists.related_tabid \n WHERE vtiger_relatedlists.tabid=? AND vtiger_tab.presence = 0";
$params = array($tabid);
$rs = $adb->pquery($sql, $params);
$return = array('types' => array(), 'information' => array());
while ($row = $adb->fetch_array($rs)) {
if (in_array($row['name'], $allowedTypes['types'])) {
$return['types'][] = $row['name'];
// There can be same module related under different label - so label is our key.
$return['information'][$row['label']] = array('name' => $row['name'], 'label' => $row['label'], 'isEntity' => $row['isentitytype']);
}
}
return $return;
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:24,代码来源:RelatedTypes.php
示例17: vtws_create
function vtws_create($elementType, $element, $user)
{
$types = vtws_listtypes(null, $user);
if (!in_array($elementType, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
global $log, $adb;
if (!empty($element['relations'])) {
$relations = $element['relations'];
unset($element['relations']);
}
// Cache the instance for re-use
if (!isset($vtws_create_cache[$elementType]['webserviceobject'])) {
$webserviceObject = VtigerWebserviceObject::fromName($adb, $elementType);
$vtws_create_cache[$elementType]['webserviceobject'] = $webserviceObject;
} else {
$webserviceObject = $vtws_create_cache[$elementType]['webserviceobject'];
}
// END
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$referenceFields = $meta->getReferenceFieldDetails();
foreach ($referenceFields as $fieldName => $details) {
if (isset($element[$fieldName]) && strlen($element[$fieldName]) > 0) {
$ids = vtws_getIdComponents($element[$fieldName]);
$elemTypeId = $ids[0];
$elemId = $ids[1];
$referenceObject = VtigerWebserviceObject::fromId($adb, $elemTypeId);
if (!in_array($referenceObject->getEntityName(), $details)) {
throw new WebServiceException(WebServiceErrorCode::$REFERENCEINVALID, "Invalid reference specified for {$fieldName}");
}
if ($referenceObject->getEntityName() == 'Users') {
if (!$meta->hasAssignPrivilege($element[$fieldName])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Cannot assign record to the given user");
}
}
if (!in_array($referenceObject->getEntityName(), $types['types']) && $referenceObject->getEntityName() != 'Users') {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to access reference type is denied" . $referenceObject->getEntityName());
}
} else {
if ($element[$fieldName] !== NULL) {
unset($element[$fieldName]);
}
}
}
if ($meta->hasMandatoryFields($element)) {
$ownerFields = $meta->getOwnerFields();
if (is_array($ownerFields) && sizeof($ownerFields) > 0) {
foreach ($ownerFields as $ownerField) {
if (isset($element[$ownerField]) && $element[$ownerField] !== null && !$meta->hasAssignPrivilege($element[$ownerField])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Cannot assign record to the given user");
}
}
}
// Product line support
if (($elementType == 'Quotes' || $elementType == 'PurchaseOrder' || $elementType == 'SalesOrder' || $elementType == 'Invoice') && is_array($element['pdoInformation'])) {
include 'include/Webservices/ProductLines.php';
} else {
$_REQUEST['action'] = $elementType . 'Ajax';
}
if ($elementType == 'HelpDesk') {
//Added to construct the update log for Ticket history
$colflds = $element;
list($void, $colflds['assigned_user_id']) = explode('x', $colflds['assigned_user_id']);
$grp_name = fetchGroupName($colflds['assigned_user_id']);
$assigntype = $grp_name != '' ? 'T' : 'U';
$updlog = HelpDesk::getUpdateLogCreateMessage($colflds, $grp_name, $assigntype);
$updlog = from_html($updlog, false);
}
$entity = $handler->create($elementType, $element);
if ($elementType == 'HelpDesk') {
list($wsid, $newrecid) = vtws_getIdComponents($entity['id']);
$adb->pquery('update vtiger_troubletickets set update_log=? where ticketid=?', array($updlog, $newrecid));
}
// Establish relations
if (!empty($relations)) {
list($wsid, $newrecid) = vtws_getIdComponents($entity['id']);
$modname = $meta->getEntityName();
vtws_internal_setrelation($newrecid, $modname, $relations);
}
VTWS_PreserveGlobal::flush();
return $entity;
} else {
return null;
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:92,代码来源:Create.php
示例18: getReferenceList
public function getReferenceList()
{
static $referenceList = array();
if ($this->referenceList === null) {
if (isset($referenceList[$this->getFieldId()])) {
$this->referenceList = $referenceList[$this->getFieldId()];
return $referenceList[$this->getFieldId()];
}
if (!isset(WebserviceField::$fieldTypeMapping[$this->getUIType()])) {
$this->getFieldTypeFromUIType();
}
$fieldTypeData = WebserviceField::$fieldTypeMapping[$this->getUIType()];
$referenceTypes = array();
if ($this->getUIType() != $this->genericUIType) {
$sql = "select * from vtiger_ws_referencetype where fieldtypeid=?";
$params = array($fieldTypeData['fieldtypeid']);
} else {
$sql = 'select relmodule as type from vtiger_fieldmodulerel where fieldid=?';
$params = array($this->getFieldId());
}
$result = $this->pearDB->pquery($sql, $params);
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
array_push($referenceTypes, $this->pearDB->query_result($result, $i, "type"));
}
//to handle hardcoding done for Calendar module todo activities.
if ($this->tabid == 9 && $this->fieldName == 'parent_id') {
$referenceTypes[] = 'Invoice';
$referenceTypes[] = 'Quotes';
$referenceTypes[] = 'PurchaseOrder';
$referenceTypes[] = 'SalesOrder';
$referenceTypes[] = 'Campaigns';
}
if ($this->getUIType() == 26) {
// DocumentFolders
$referenceTypes[] = 'DocumentFolders';
}
global $current_user;
$types = vtws_listtypes(null, $current_user);
$accessibleTypes = $types['types'];
if (!is_admin($current_user)) {
array_push($accessibleTypes, 'Users');
}
$referenceTypes = array_values(array_intersect($accessibleTypes, $referenceTypes));
$referenceList[$this->getFieldId()] = $referenceTypes;
$this->referenceList = $referenceTypes;
return $referenceTypes;
}
return $this->referenceList;
}
开发者ID:jgjermeni,项目名称:corebos,代码行数:50,代码来源:WebserviceField.php
示例19: vtws_update
function vtws_update($element, $user)
{
global $log, $adb;
$idList = vtws_getIdComponents($element['id']);
$webserviceObject = VtigerWebserviceObject::fromId($adb, $idList[0]);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($element['id']);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($entityName !== $webserviceObject-&
|
请发表评论