当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_DAO::objectExists方法代码示例

本文整理汇总了PHP中CRM_Core_DAO::objectExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::objectExists方法的具体用法?PHP CRM_Core_DAO::objectExists怎么用?PHP CRM_Core_DAO::objectExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_DAO的用法示例。


在下文中一共展示了CRM_Core_DAO::objectExists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formRule

 /**
  * global form rule
  *
  * @param array $fields  the input form values
  *
  * @return true if no errors, else array of errors
  * @access public
  * @static
  */
 static function formRule(&$fields, $files, $self)
 {
     $errors = array();
     if ($self->_id) {
         $contactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $self->_id, 'name');
     } else {
         $contactName = ucfirst(CRM_Utils_String::munge($fields['label']));
     }
     if (!CRM_Core_DAO::objectExists($contactName, 'CRM_Contact_DAO_ContactType', $self->_id)) {
         $errors['label'] = ts('This contact type name already exists in database. Contact type names must be unique.');
     }
     return empty($errors) ? true : $errors;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:22,代码来源:ContactType.php

示例2: objectExists

 /**
  * Check if there is a record with the same name in the db
  *
  * @param string $value     the value of the field we are checking
  * @param array  $options   the daoName and fieldName (optional )
  *
  * @return boolean     true if object exists
  * @access public
  * @static
  */
 static function objectExists($value, $options)
 {
     $name = 'name';
     if (isset($options[2])) {
         $name = $options[2];
     }
     return CRM_Core_DAO::objectExists($value, CRM_Utils_Array::value(0, $options), CRM_Utils_Array::value(1, $options), CRM_Utils_Array::value(2, $options, $name));
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:18,代码来源:Rule.php

示例3: formRule

 /**
  * Global form rule.
  *
  * @param array $fields
  *   The input form values.
  *
  * @param $files
  * @param $self
  *
  * @return bool|array
  *   true if no errors, else array of errors
  */
 public static function formRule($fields, $files, $self)
 {
     $errors = array();
     if ($self->_id) {
         $contactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $self->_id, 'name');
     } else {
         $contactName = ucfirst(CRM_Utils_String::munge($fields['label']));
     }
     if (!CRM_Core_DAO::objectExists($contactName, 'CRM_Contact_DAO_ContactType', $self->_id)) {
         $errors['label'] = ts('This contact type name already exists in database. Contact type names must be unique.');
     }
     $reservedKeyWords = CRM_Core_SelectValues::customGroupExtends();
     //restrict "name" from being a reserved keyword when a new contact subtype is created
     if (!$self->_id && in_array($contactName, array_keys($reservedKeyWords))) {
         $errors['label'] = ts('Contact type names should not use reserved keywords.');
     }
     return empty($errors) ? TRUE : $errors;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:30,代码来源:ContactType.php

示例4: formRule

 /**
  * Global validation rules for the form.
  *
  * @param array $values
  * @param $files
  * @param $self
  *
  * @return array
  *   list of errors to be posted back to the form
  */
 public static function formRule($values, $files, $self)
 {
     $errors = array();
     if (!empty($values['contact_name']) && !is_numeric($values['created_id'])) {
         $errors['contact_name'] = ts('Please select a valid contact.');
     }
     if ($values['item_count'] && (!is_numeric($values['item_count']) || $values['item_count'] < 1)) {
         $errors['item_count'] = ts('Number of Transactions should a positive number');
     }
     if ($values['total'] && (!is_numeric($values['total']) || $values['total'] <= 0)) {
         $errors['total'] = ts('Total Amount should be a positive number');
     }
     if (!empty($values['created_date']) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) {
         $errors['created_date'] = ts('Created date cannot be greater than current date');
     }
     $batchName = $values['title'];
     if (!CRM_Core_DAO::objectExists($batchName, 'CRM_Batch_DAO_Batch', $self->_id)) {
         $errors['title'] = ts('This name already exists in database. Batch names must be unique.');
     }
     return CRM_Utils_Array::crmIsEmptyArray($errors) ? TRUE : $errors;
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:31,代码来源:FinancialBatch.php

示例5: objectExists

 /**
  * Check if there is a record with the same name in the db
  *
  * @param string $value     the value of the field we are checking
  * @param array  $options   the daoName and fieldName (optional )
  *
  * @return boolean     true if object exists
  * @access public
  * @static
  */
 function objectExists($value, $options)
 {
     return CRM_Core_DAO::objectExists($value, $options[0], $options[1], CRM_Utils_Array::value(2, $options, 'name'));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:14,代码来源:Rule.php


注:本文中的CRM_Core_DAO::objectExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。