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


PHP db_concat函数代码示例

本文整理汇总了PHP中db_concat函数的典型用法代码示例。如果您正苦于以下问题:PHP db_concat函数的具体用法?PHP db_concat怎么用?PHP db_concat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testdb_concat

 public function testdb_concat()
 {
     error_reporting(E_ERROR | E_PARSE);
     //execute the method and test if it returns expected values
     $table = 'Table1';
     $fields = array('Col1', 'Col2', 'Col3');
     $expected = "LTRIM(RTRIM(CONCAT(IFNULL(Table1.Col1,''),'',IFNULL(Table1.Col2,''),'',IFNULL(Table1.Col3,''))))";
     $actual = db_concat($table, $fields);
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:10,代码来源:dbUtilsTest.php

示例2: constructWhere

 /**
  * Internal function to construct where clauses
  */
 function constructWhere(&$query_obj, $focus)
 {
     $table = $focus->getTableName();
     if (!empty($table)) {
         $table .= ".";
     }
     $cond_arr = array();
     if (!is_array($query_obj['conditions'])) {
         $query_obj['conditions'] = array();
     }
     foreach ($query_obj['conditions'] as $condition) {
         if ($condition['op'] == 'contains') {
             array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '%" . $GLOBALS['db']->quote($condition['value']) . "%'");
         } else {
             if ($condition['op'] == 'like_custom') {
                 $like = '';
                 if (!empty($condition['begin'])) {
                     $like .= $GLOBALS['db']->quote($condition['begin']);
                 }
                 $like .= $GLOBALS['db']->quote($condition['value']);
                 if (!empty($condition['end'])) {
                     $like .= $GLOBALS['db']->quote($condition['end']);
                 }
                 if ($focus instanceof Person) {
                     $nameFormat = $GLOBALS['locale']->getLocaleFormatMacro($GLOBALS['current_user']);
                     if (strpos($nameFormat, 'l') > strpos($nameFormat, 'f')) {
                         array_push($cond_arr, db_concat(rtrim($table, '.'), array('first_name', 'last_name')) . " like '{$like}'");
                     } else {
                         array_push($cond_arr, db_concat(rtrim($table, '.'), array('last_name', 'first_name')) . " like '{$like}'");
                     }
                 } else {
                     array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '{$like}'");
                 }
             } else {
                 // starts_with
                 array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '" . $GLOBALS['db']->quote($condition['value']) . "%'");
             }
         }
     }
     $whereClause = '(' . implode(" {$query_obj['group']} ", $cond_arr) . ')';
     if ($table == 'users.') {
         $whereClause .= " AND {$table}status='Active'";
     }
     // Need to include the default whereStatement
     if (!empty($query_obj['whereExtra'])) {
         if (!empty($whereClause)) {
             $whereClause .= ' AND ';
         }
         $whereClause .= html_entity_decode($query_obj['whereExtra'], ENT_QUOTES);
     }
     return $whereClause;
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:55,代码来源:quicksearchQuery.php

示例3: constructWhere

 /**
  * Internal function to construct where clauses
  */
 function constructWhere(&$query_obj, $focus)
 {
     $table = $focus->getTableName();
     if (!empty($table)) {
         $table .= ".";
     }
     $cond_arr = array();
     if (!is_array($query_obj['conditions'])) {
         $query_obj['conditions'] = array();
     }
     foreach ($query_obj['conditions'] as $condition) {
         if ($condition['op'] == 'contains') {
             array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '%" . $GLOBALS['db']->quote($condition['value']) . "%'");
         } else {
             if ($condition['op'] == 'like_custom') {
                 $like = '';
                 if (!empty($condition['begin'])) {
                     $like .= $GLOBALS['db']->quote($condition['begin']);
                 }
                 $like .= $GLOBALS['db']->quote($condition['value']);
                 if (!empty($condition['end'])) {
                     $like .= $GLOBALS['db']->quote($condition['end']);
                 }
                 if ($focus instanceof Person) {
                     if ($condition['name'] == 'name') {
                         array_push($cond_arr, db_concat(rtrim($table, '.'), array('first_name')) . " like '{$like}'");
                         array_push($cond_arr, db_concat(rtrim($table, '.'), array('last_name')) . " like '{$like}'");
                     } else {
                         array_push($cond_arr, db_concat(rtrim($table, '.'), array($condition['name'])) . " like '{$like}'");
                     }
                 } else {
                     array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '{$like}'");
                 }
             } else {
                 // starts_with
                 array_push($cond_arr, $GLOBALS['db']->quote($table . $condition['name']) . " like '" . $GLOBALS['db']->quote($condition['value']) . "%'");
             }
         }
     }
     if ($table == 'users.') {
         array_push($cond_arr, $table . "status='Active'");
     }
     return implode(" {$query_obj['group']} ", $cond_arr);
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:47,代码来源:quicksearchQuery.php

示例4: getRelateJoin

 function getRelateJoin($field_def, $joinTableAlias, $withIdName = true)
 {
     if (empty($field_def['type']) || $field_def['type'] != "relate") {
         return false;
     }
     global $beanFiles, $beanList, $module;
     $rel_module = $field_def['module'];
     if (empty($beanFiles[$beanList[$rel_module]])) {
         return false;
     }
     require_once $beanFiles[$beanList[$rel_module]];
     $rel_mod = new $beanList[$rel_module]();
     $rel_table = $rel_mod->table_name;
     if (isset($rel_mod->field_defs['name'])) {
         $name_field_def = $rel_mod->field_defs['name'];
         if (isset($name_field_def['db_concat_fields'])) {
             $name_field = db_concat($joinTableAlias, $name_field_def['db_concat_fields']);
         } else {
             if (!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname'])) {
                 $name_field = "{$joinTableAlias}." . $field_def['rname'];
             } else {
                 $name_field = "{$joinTableAlias}.name";
             }
         }
     }
     $tableName = isset($field_def['custom_module']) ? "{$this->bean->table_name}_cstm" : $this->bean->table_name;
     $relID = $field_def['id_name'];
     $ret_array['rel_table'] = $rel_table;
     $ret_array['name_field'] = $name_field;
     $ret_array['select'] = ($withIdName ? ", {$tableName}.{$relID}" : "") . ", {$name_field} {$field_def['name']} ";
     $ret_array['from'] = " LEFT JOIN {$rel_table} {$joinTableAlias} ON {$tableName}.{$relID} = {$joinTableAlias}.id" . " AND {$joinTableAlias}.deleted=0 ";
     return $ret_array;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:33,代码来源:DynamicField.php

示例5: address_popup_create_new_list_query

 function address_popup_create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean = null, $singleSelect = false)
 {
     //if this is any action that is not the contact address popup, then go to parent function in sugarbean
     if (isset($_REQUEST['action']) && $_REQUEST['action'] !== 'ContactAddressPopup') {
         return parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, $return_array, $parentbean, $singleSelect);
     }
     $custom_join = $this->custom_fields->getJOIN();
     // MFH - BUG #14208 creates alias name for select
     $select_query = "SELECT ";
     $select_query .= db_concat($this->table_name, array('first_name', 'last_name')) . " name, ";
     $select_query .= "\n\t\t\t\t{$this->table_name}.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ";
     if ($custom_join) {
         $select_query .= $custom_join['select'];
     }
     $ret_array['select'] = $select_query;
     $from_query = "\n                FROM contacts ";
     $from_query .= "LEFT JOIN users\n\t                    ON contacts.assigned_user_id=users.id\n\t                    LEFT JOIN accounts_contacts\n\t                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n\t                    LEFT JOIN accounts\n\t                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 ";
     $from_query .= "LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 ";
     $from_query .= "LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) ";
     if ($custom_join) {
         $from_query .= $custom_join['join'];
     }
     $ret_array['from'] = $from_query;
     $ret_array['from_min'] = 'from contacts';
     $where_auto = '1=1';
     if ($show_deleted == 0) {
         $where_auto = " {$this->table_name}.deleted=0 ";
         //$where_auto .= " AND accounts.deleted=0  ";
     } else {
         if ($show_deleted == 1) {
             $where_auto = " {$this->table_name}.deleted=1 ";
         }
     }
     if ($where != "") {
         $where_query = "where ({$where}) AND " . $where_auto;
     } else {
         $where_query = "where " . $where_auto;
     }
     $ret_array['where'] = $where_query;
     $orderby_query = '';
     if (!empty($order_by)) {
         $orderby_query = " ORDER BY " . $this->process_order_by($order_by, null);
     }
     $ret_array['order_by'] = $orderby_query;
     if ($return_array) {
         return $ret_array;
     }
     return $ret_array['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by'];
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:49,代码来源:Contact.php

示例6: admin_page_users

 /**
  * @brief Generate users admin page and handle single item operations.
  *
  * This function generates the users/account admin page and handles the actions
  * if an icon next to an entry was clicked. If several items were selected and
  * the form was submitted it is handled by the function admin_page_users_post().
  *
  * @param App &$a
  * @return string
  */
 function admin_page_users(&$a)
 {
     if (argc() > 2) {
         $uid = argv(3);
         $account = q("SELECT * FROM account WHERE account_id = %d", intval($uid));
         if (!$account) {
             notice(t('Account not found') . EOL);
             goaway(z_root() . '/admin/users');
         }
         check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
         switch (argv(2)) {
             case 'delete':
                 // delete user
                 require_once 'include/Contact.php';
                 account_remove($uid, true, false);
                 notice(sprintf(t("Account '%s' deleted"), $account[0]['account_email']) . EOL);
                 break;
             case 'block':
                 q("UPDATE account SET account_flags = ( account_flags | %d ) WHERE account_id = %d", intval(ACCOUNT_BLOCKED), intval($uid));
                 notice(sprintf(t("Account '%s' blocked"), $account[0]['account_email']) . EOL);
                 break;
             case 'unblock':
                 q("UPDATE account SET account_flags = ( account_flags & ~%d ) WHERE account_id = %d", intval(ACCOUNT_BLOCKED), intval($uid));
                 notice(sprintf(t("Account '%s' unblocked"), $account[0]['account_email']) . EOL);
                 break;
         }
         goaway(z_root() . '/admin/users');
     }
     /* get pending */
     $pending = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d )>0 ", intval(ACCOUNT_PENDING));
     /* get users */
     $total = q("SELECT count(*) as total FROM account");
     if (count($total)) {
         \App::set_pager_total($total[0]['total']);
         \App::set_pager_itemspage(100);
     }
     //	We'll still need to link email addresses to admin/users/channels or some such, but this bit doesn't exist yet.
     //	That's where we need to be doing last post/channel flags/etc, not here.
     $serviceclass = $_REQUEST['class'] ? " and account_service_class = '" . dbesc($_REQUEST['class']) . "' " : '';
     $order = " order by account_email asc ";
     if ($_REQUEST['order'] === 'expires') {
         $order = " order by account_expires desc ";
     }
     if ($_REQUEST['order'] === 'created') {
         $order = " order by account_created desc ";
     }
     $users = q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d )>0 as `blocked`, " . "(SELECT %s FROM channel as ch " . "WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as `channels` " . "FROM account as ac where true {$serviceclass} {$order} limit %d offset %d ", intval(ACCOUNT_BLOCKED), db_concat('ch.channel_address', ' '), intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
     //	function _setup_users($e){
     //		$accounts = Array(
     //			t('Normal Account'),
     //			t('Soapbox Account'),
     //			t('Community/Celebrity Account'),
     //			t('Automatic Friend Account')
     //		);
     //		$e['page_flags'] = $accounts[$e['page-flags']];
     //		$e['register_date'] = relative_date($e['register_date']);
     //		$e['login_date'] = relative_date($e['login_date']);
     //		$e['lastitem_date'] = relative_date($e['lastitem_date']);
     //		return $e;
     //	}
     //	$users = array_map("_setup_users", $users);
     $t = get_markup_template('admin_users.tpl');
     $o = replace_macros($t, array('$title' => t('Administration'), '$page' => t('Users'), '$submit' => t('Submit'), '$select_all' => t('select all'), '$h_pending' => t('User registrations waiting for confirm'), '$th_pending' => array(t('Request date'), t('Email')), '$no_pending' => t('No registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), '$block' => t('Block'), '$unblock' => t('Unblock'), '$h_users' => t('Users'), '$th_users' => array(t('ID'), t('Email'), t('All Channels'), t('Register date'), t('Last login'), t('Expires'), t('Service Class')), '$confirm_delete_multi' => t('Selected accounts will be deleted!\\n\\nEverything these accounts had posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$confirm_delete' => t('The account {0} will be deleted!\\n\\nEverything this account has posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$form_security_token' => get_form_security_token("admin_users"), '$baseurl' => z_root(), '$pending' => $pending, '$users' => $users));
     $o .= paginate($a);
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:76,代码来源:Admin.php

示例7: generateSearchWhere


//.........这里部分代码省略.........
             $itr = 0;
             if ($field_value != '') {
                 $this->searchColumns[strtoupper($field)] = $field;
                 foreach ($parms['db_field'] as $db_field) {
                     if (strstr($db_field, '.') === false) {
                         //Try to get the table for relate fields from link defs
                         if ($type == 'relate' && !empty($this->seed->field_name_map[$field]['link']) && !empty($this->seed->field_name_map[$field]['rname'])) {
                             $link = $this->seed->field_name_map[$field]['link'];
                             $relname = $link['relationship'];
                             if ($this->seed->load_relationship($link)) {
                                 //Martin fix #27494
                                 $db_field = $this->seed->field_name_map[$field]['name'];
                             } else {
                                 //Best Guess for table name
                                 $db_field = strtolower($link['module']) . '.' . $db_field;
                             }
                         } else {
                             if ($type == 'parent') {
                                 if (!empty($this->searchFields['parent_type'])) {
                                     $parentType = $this->searchFields['parent_type'];
                                     $rel_module = $parentType['value'];
                                     global $beanFiles, $beanList;
                                     if (!empty($beanFiles[$beanList[$rel_module]])) {
                                         require_once $beanFiles[$beanList[$rel_module]];
                                         $rel_seed = new $beanList[$rel_module]();
                                         $db_field = 'parent_' . $rel_module . '_' . $rel_seed->table_name . '.name';
                                     }
                                 }
                             } else {
                                 if ($type == 'relate' && $customField && !empty($this->seed->field_name_map[$field]['module'])) {
                                     $db_field = !empty($this->seed->field_name_map[$field]['name']) ? $this->seed->field_name_map[$field]['name'] : 'name';
                                 } else {
                                     if (!$customField) {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name, $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "." . $db_field;
                                         }
                                     } else {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name . "_cstm.", $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "_cstm." . $db_field;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if ($type == 'date') {
                         // Collin - Have mysql as first because it's usually the case
                         // The regular expression check is to circumvent special case YYYY-MM
                         if ($GLOBALS['db']->dbType == 'mysql') {
                             if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                 $field_value = $timedate->to_db_date($field_value, false);
                                 $operator = '=';
                             } else {
                                 $operator = 'db_date';
                             }
                         } else {
                             if ($GLOBALS['db']->dbType == 'mssql') {
                                 if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                     $field_value = "Convert(DateTime, '" . $timedate->to_db_date($field_value, false) . "')";
                                 }
                                 $operator = 'db_date';
                             } else {
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:67,代码来源:SearchForm2.php

示例8: generateSearchWhere


//.........这里部分代码省略.........
             $itr = 0;
             if ($field_value != '' || $operator == 'isnull') {
                 $this->searchColumns[strtoupper($field)] = $field;
                 foreach ($parms['db_field'] as $db_field) {
                     if (strstr($db_field, '.') === false) {
                         //Try to get the table for relate fields from link defs
                         if ($type == 'relate' && !empty($this->seed->field_name_map[$field]['link']) && !empty($this->seed->field_name_map[$field]['rname'])) {
                             $link = $this->seed->field_name_map[$field]['link'];
                             $relname = $link['relationship'];
                             if ($this->seed->load_relationship($link)) {
                                 //Martin fix #27494
                                 $db_field = $this->seed->field_name_map[$field]['name'];
                             } else {
                                 //Best Guess for table name
                                 $db_field = strtolower($link['module']) . '.' . $db_field;
                             }
                         } else {
                             if ($type == 'parent') {
                                 if (!empty($this->searchFields['parent_type'])) {
                                     $parentType = $this->searchFields['parent_type'];
                                     $rel_module = $parentType['value'];
                                     global $beanFiles, $beanList;
                                     if (!empty($beanFiles[$beanList[$rel_module]])) {
                                         require_once $beanFiles[$beanList[$rel_module]];
                                         $rel_seed = new $beanList[$rel_module]();
                                         $db_field = 'parent_' . $rel_module . '_' . $rel_seed->table_name . '.name';
                                     }
                                 }
                             } else {
                                 if ($type == 'relate' && $customField && !empty($this->seed->field_name_map[$field]['module'])) {
                                     $db_field = !empty($this->seed->field_name_map[$field]['name']) ? $this->seed->field_name_map[$field]['name'] : 'name';
                                 } else {
                                     if (!$customField) {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name, $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "." . $db_field;
                                         }
                                     } else {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name . "_cstm.", $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "_cstm." . $db_field;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if ($type == 'date') {
                         // Collin - Have mysql as first because it's usually the case
                         // The regular expression check is to circumvent special case YYYY-MM
                         if ($GLOBALS['db']->dbType == 'mysql') {
                             if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                 $field_value = $timedate->to_db_date($field_value, false);
                                 $operator = '=';
                             } else {
                                 $operator = 'db_date';
                             }
                         } else {
                             if ($GLOBALS['db']->dbType == 'mssql') {
                                 if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                     $field_value = "Convert(DateTime, '" . $timedate->to_db_date($field_value, false) . "')";
                                 }
                                 $operator = 'db_date';
                             } else {
开发者ID:dinhquyet92,项目名称:sugarcrm_advanced_workflows,代码行数:67,代码来源:SearchForm2.php

示例9: relate

 /**
  * Validate relate fields
  *
  * @param  $value  string
  * @param  $vardef array
  * @param  $focus  object bean of the module we're importing into
  * @param  $addRelatedBean bool true if we want to add the related bean if it is not found
  * @return string sanitized and validated value on success, bool false on failure
  */
 public function relate($value, $vardef, &$focus, $addRelatedBean = true)
 {
     if (!isset($vardef['module'])) {
         return false;
     }
     $newbean = loadBean($vardef['module']);
     // Bug 38885 - If we are relating to the Users table on user_name, there's a good chance
     // that the related field data is the full_name, rather than the user_name. So to be sure
     // let's try to lookup the field the relationship is expecting to use (user_name).
     if ($vardef['module'] == 'Users' && $vardef['rname'] == 'user_name') {
         $userFocus = new User();
         $userFocus->retrieve_by_string_fields(array($userFocus->db->concat('users', array('first_name', 'last_name')) => $value));
         if (!empty($userFocus->id)) {
             $value = $userFocus->user_name;
         }
     }
     // Bug 32869 - Assumed related field name is 'name' if it is not specified
     if (!isset($vardef['rname'])) {
         $vardef['rname'] = 'name';
     }
     // Bug 27046 - Validate field against type as it is in the related field
     $rvardef = $newbean->getFieldDefinition($vardef['rname']);
     if (isset($rvardef['type']) && method_exists($this, $rvardef['type'])) {
         $fieldtype = $rvardef['type'];
         $returnValue = $this->{$fieldtype}($value, $rvardef, $focus, $addRelatedBean);
         if (!$returnValue) {
             return false;
         } else {
             $value = $returnValue;
         }
     }
     if (isset($vardef['id_name'])) {
         $idField = $vardef['id_name'];
         // Bug 24075 - clear out id field value if it is invalid
         if (isset($focus->{$idField})) {
             $checkfocus = loadBean($vardef['module']);
             if ($checkfocus && is_null($checkfocus->retrieve($focus->{$idField}))) {
                 $focus->{$idField} = '';
             }
         }
         // Bug 38356 - Populate the table entry in the vardef from the bean information in case it's not provided
         if (!isset($vardef['table'])) {
             // Set target module table as the default table name
             $tmpfocus = loadBean($vardef['module']);
             $vardef['table'] = $tmpfocus->table_name;
         }
         // be sure that the id isn't already set for this row
         if (empty($focus->{$idField}) && $idField != $vardef['name'] && !empty($vardef['rname']) && !empty($vardef['table'])) {
             // Bug 27562 - Check db_concat_fields first to see if the field name is a concat
             $relatedFieldDef = $newbean->getFieldDefinition($vardef['rname']);
             if (isset($relatedFieldDef['db_concat_fields']) && is_array($relatedFieldDef['db_concat_fields'])) {
                 $fieldname = db_concat($vardef['table'], $relatedFieldDef['db_concat_fields']);
             } else {
                 $fieldname = $vardef['rname'];
             }
             // lookup first record that matches in linked table
             $query = "SELECT id \n                            FROM {$vardef['table']} \n                            WHERE {$fieldname} = '" . $focus->db->quote($value) . "'\n                                AND deleted != 1";
             $result = $focus->db->limitQuery($query, 0, 1, true, "Want only a single row");
             if (!empty($result)) {
                 if ($relaterow = $focus->db->fetchByAssoc($result)) {
                     $focus->{$idField} = $relaterow['id'];
                 } elseif (!$addRelatedBean || $newbean->bean_implements('ACL') && !$newbean->ACLAccess('save') || in_array($newbean->module_dir, array('Teams', 'Users'))) {
                     return false;
                 } else {
                     // add this as a new record in that bean, then relate
                     if (isset($relatedFieldDef['db_concat_fields']) && is_array($relatedFieldDef['db_concat_fields'])) {
                         $relatedFieldParts = explode(' ', $value);
                         foreach ($relatedFieldDef['db_concat_fields'] as $relatedField) {
                             $newbean->{$relatedField} = array_shift($relatedFieldParts);
                         }
                     } else {
                         $newbean->{$vardef}['rname'] = $value;
                     }
                     if (!isset($focus->assigned_user_id) || $focus->assigned_user_id == '') {
                         $newbean->assigned_user_id = $GLOBALS['current_user']->id;
                     } else {
                         $newbean->assigned_user_id = $focus->assigned_user_id;
                     }
                     if (!isset($focus->modified_user_id) || $focus->modified_user_id == '') {
                         $newbean->modified_user_id = $GLOBALS['current_user']->id;
                     } else {
                         $newbean->modified_user_id = $focus->modified_user_id;
                     }
                     // populate fields from the parent bean to the child bean
                     $focus->populateRelatedBean($newbean);
                     $newbean->save(false);
                     $focus->{$idField} = $newbean->id;
                     $this->createdBeans[] = ImportFile::writeRowToLastImport($focus->module_dir, $newbean->object_name, $newbean->id);
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:101,代码来源:ImportFieldSanitize.php

示例10: generateSearchWhere


//.........这里部分代码省略.........
             $itr = 0;
             if ($field_value != '') {
                 $this->searchColumns[strtoupper($field)] = $field;
                 foreach ($parms['db_field'] as $db_field) {
                     if (strstr($db_field, '.') === false) {
                         //Try to get the table for relate fields from link defs
                         if ($type == 'relate' && !empty($this->seed->field_name_map[$field]['link']) && !empty($this->seed->field_name_map[$field]['rname'])) {
                             $link = $this->seed->field_name_map[$field]['link'];
                             $relname = $link['relationship'];
                             if ($this->seed->load_relationship($link)) {
                                 //Martin fix #27494
                                 $db_field = $this->seed->field_name_map[$field]['name'];
                             } else {
                                 //Best Guess for table name
                                 $db_field = strtolower($link['module']) . '.' . $db_field;
                             }
                         } else {
                             if ($type == 'parent') {
                                 if (!empty($this->searchFields['parent_type'])) {
                                     $parentType = $this->searchFields['parent_type'];
                                     $rel_module = $parentType['value'];
                                     global $beanFiles, $beanList;
                                     if (!empty($beanFiles[$beanList[$rel_module]])) {
                                         require_once $beanFiles[$beanList[$rel_module]];
                                         $rel_seed = new $beanList[$rel_module]();
                                         $db_field = 'parent_' . $rel_module . '_' . $rel_seed->table_name . '.name';
                                     }
                                 }
                             } else {
                                 if ($type == 'relate' && $customField && !empty($this->seed->field_name_map[$field]['module'])) {
                                     $db_field = !empty($this->seed->field_name_map[$field]['name']) ? $this->seed->field_name_map[$field]['name'] : 'name';
                                 } else {
                                     if (!$customField) {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name, $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "." . $db_field;
                                         }
                                     } else {
                                         if (!empty($this->seed->field_name_map[$field]['db_concat_fields'])) {
                                             $db_field = db_concat($this->seed->table_name . "_cstm.", $this->seed->field_name_map[$db_field]['db_concat_fields']);
                                         } else {
                                             $db_field = $this->seed->table_name . "_cstm." . $db_field;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if ($type == 'date') {
                         // Collin - Have mysql as first because it's usually the case
                         // The regular expression check is to circumvent special case YYYY-MM
                         if ($GLOBALS['db']->dbType == 'mysql') {
                             if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                 $field_value = $timedate->to_db_date($field_value, false);
                                 $operator = '=';
                             } else {
                                 $operator = 'db_date';
                             }
                         } else {
                             if ($GLOBALS['db']->dbType == 'oci8') {
                                 if (preg_match('/^\\d{4}.\\d{1,2}$/', $field_value) == 0) {
                                     $field_value = $timedate->to_db_date($field_value, false);
                                     $field_value = "to_date('" . $field_value . "', 'YYYY-MM-DD hh24:mi:ss')";
                                 }
                                 $operator = 'db_date';
开发者ID:Terradex,项目名称:sugar,代码行数:67,代码来源:SearchForm2.php

示例11: acl_init

function acl_init(&$a)
{
    //	logger('mod_acl: ' . print_r($_REQUEST,true));
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    $type = x($_REQUEST, 'type') ? $_REQUEST['type'] : "";
    $noforums = x($_REQUEST, 'n') ? $_REQUEST['n'] : false;
    // List of channels whose connections to also suggest, e.g. currently viewed channel or channels mentioned in a post
    $extra_channels = x($_REQUEST, 'extra_channels') ? $_REQUEST['extra_channels'] : array();
    // For use with jquery.autocomplete for private mail completion
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        if (!$type) {
            $type = 'm';
        }
        $search = $_REQUEST['query'];
    }
    if (!local_channel()) {
        if (!($type == 'x' || $type == 'c')) {
            killme();
        }
    }
    if ($search != "") {
        $sql_extra = " AND `name` LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " ";
        $sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " OR xchan_addr LIKE " . protect_sprintf("'%" . dbesc($search) . (strpos($search, '@') === false ? "%@%'" : "%'")) . ") ";
        // This horrible mess is needed because position also returns 0 if nothing is found. W/ould be MUCH easier if it instead returned a very large value
        // Otherwise we could just order by LEAST(POSITION($search IN xchan_name),POSITION($search IN xchan_addr)).
        $order_extra2 = "CASE WHEN xchan_name LIKE " . protect_sprintf("'%" . dbesc($search) . "%'") . " then POSITION('" . dbesc($search) . "' IN xchan_name) else position('" . dbesc($search) . "' IN xchan_addr) end, ";
        $col = strpos($search, '@') !== false ? 'xchan_addr' : 'xchan_name';
        $sql_extra3 = "AND {$col} like " . protect_sprintf("'%" . dbesc($search) . "%'") . " ";
    } else {
        $sql_extra = $sql_extra2 = $sql_extra3 = "";
    }
    $groups = array();
    $contacts = array();
    if ($type == '' || $type == 'g') {
        $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`, \n\t\t\t\t%s as uids\n\t\t\t\tFROM `groups`,`group_member` \n\t\t\t\tWHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d \n\t\t\t\t\tAND `group_member`.`gid`=`groups`.`id`\n\t\t\t\t\t{$sql_extra}\n\t\t\t\tGROUP BY `groups`.`id`\n\t\t\t\tORDER BY `groups`.`name` \n\t\t\t\tLIMIT %d OFFSET %d", db_concat('group_member.xchan', ','), intval(local_channel()), intval($count), intval($start));
        foreach ($r as $g) {
            //		logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
            $groups[] = array("type" => "g", "photo" => "images/twopeople.png", "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], "uids" => explode(",", $g['uids']), "link" => '');
        }
    }
    if ($type == '' || $type == 'c') {
        $extra_channels_sql = '';
        // Only include channels who allow the observer to view their permissions
        foreach ($extra_channels as $channel) {
            if (perm_is_allowed(intval($channel), get_observer_hash(), 'view_contacts')) {
                $extra_channels_sql .= "," . intval($channel);
            }
        }
        $extra_channels_sql = substr($extra_channels_sql, 1);
        // Remove initial comma
        // Getting info from the abook is better for local users because it contains info about permissions
        if (local_channel()) {
            if ($extra_channels_sql != '') {
                $extra_channels_sql = " OR (abook_channel IN ({$extra_channels_sql})) and abook_hidden = 0 ";
            }
            $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self \n\t\t\t\tFROM abook left join xchan on abook_xchan = xchan_hash \n\t\t\t\tWHERE (abook_channel = %d {$extra_channels_sql}) AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and xchan_deleted = 0 {$sql_extra2} order by {$order_extra2} xchan_name asc", intval(local_channel()));
        } else {
            // Visitors
            $r = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags, 0 as abook_self\n\t\t\t\tFROM xchan left join xlink on xlink_link = xchan_hash\n\t\t\t\tWHERE xlink_xchan  = '%s' AND xchan_deleted = 0 {$sql_extra2} order by {$order_extra2} xchan_name asc", dbesc(get_observer_hash()));
            // Find contacts of extra channels
            // This is probably more complicated than it needs to be
            if ($extra_channels_sql) {
                // Build a list of hashes that we got previously so we don't get them again
                $known_hashes = array("'" . get_observer_hash() . "'");
                if ($r) {
                    foreach ($r as $rr) {
                        $known_hashes[] = "'" . $rr['hash'] . "'";
                    }
                }
                $known_hashes_sql = 'AND xchan_hash not in (' . join(',', $known_hashes) . ')';
                $r2 = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self \n\t\t\t\t\tFROM abook left join xchan on abook_xchan = xchan_hash \n\t\t\t\t\tWHERE abook_channel IN ({$extra_channels_sql}) {$known_hashes_sql} AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and abook_hidden = 0 and xchan_deleted = 0 {$sql_extra2} order by {$order_extra2} xchan_name asc");
                if ($r2) {
                    $r = array_merge($r, $r2);
                }
                // Sort accoring to match position, then alphabetically. This could be avoided if the above two SQL queries could be combined into one, and the sorting could be done on the SQl server (like in the case of a local user)
                $matchpos = function ($x) use($search) {
                    $namepos = strpos($x['name'], $search);
                    $nickpos = strpos($x['nick'], $search);
                    // Use a large position if not found
                    return min($namepos === false ? 9999 : $namepos, $nickpos === false ? 9999 : $nickpos);
                };
                // This could be made simpler if PHP supported stable sorting
                usort($r, function ($a, $b) use($matchpos) {
                    $pos1 = $matchpos($a);
                    $pos2 = $matchpos($b);
                    if ($pos1 == $pos2) {
                        // Order alphabetically if match position is the same
                        if ($a['name'] == $b['name']) {
                            return 0;
                        } else {
                            return $a['name'] < $b['name'] ? -1 : 1;
                        }
                    }
                    return $pos1 < $pos2 ? -1 : 1;
                });
            }
        }
        if (intval(get_config('system', 'taganyone')) || intval(get_pconfig(local_channel(), 'system', 'taganyone'))) {
//.........这里部分代码省略.........
开发者ID:TamirAl,项目名称:hubzilla,代码行数:101,代码来源:acl.php

示例12: relate

 /**
  * Validate relate fields
  *
  * @param  $value  string
  * @param  $vardef array
  * @param  $focus  object bean of the module we're importing into
  * @param  $addRelatedBean bool true if we want to add the related bean if it is not found
  * @return string sanitized and validated value on success, bool false on failure
  */
 public function relate($value, $vardef, &$focus, $addRelatedBean = true)
 {
     if (!isset($vardef['module'])) {
         return false;
     }
     $newbean = loadBean($vardef['module']);
     // Bug 27046 - Validate field against type as it is in the related field
     $rvardef = $newbean->getFieldDefinition($vardef['rname']);
     if (isset($rvardef['type']) && method_exists($this, $rvardef['type'])) {
         $fieldtype = $rvardef['type'];
         $returnValue = $this->{$fieldtype}($value, $rvardef);
         if (!$returnValue) {
             return false;
         } else {
             $value = $returnValue;
         }
     }
     if (isset($vardef['id_name'])) {
         $idField = $vardef['id_name'];
         // Bug 24075 - clear out id field value if it is invalid
         if (isset($focus->{$idField})) {
             $checkfocus = loadBean($vardef['module']);
             if ($checkfocus && is_null($checkfocus->retrieve($focus->{$idField}))) {
                 $focus->{$idField} = '';
             }
         }
         // be sure that the id isn't already set for this row
         if (empty($focus->{$idField}) && $idField != $vardef['name'] && !empty($vardef['rname']) && !empty($vardef['table'])) {
             // Bug 27562 - Check db_concat_fields first to see if the field name is a concat
             $relatedFieldDef = $newbean->getFieldDefinition($vardef['rname']);
             if (isset($relatedFieldDef['db_concat_fields']) && is_array($relatedFieldDef['db_concat_fields'])) {
                 $fieldname = db_concat($vardef['table'], $relatedFieldDef['db_concat_fields']);
             } else {
                 $fieldname = $vardef['rname'];
             }
             // lookup first record that matches in linked table
             $query = "SELECT id \n                            FROM {$vardef['table']} \n                            WHERE {$fieldname} = '" . $focus->db->quote($value) . "'\n                                AND deleted != 1";
             $result = $focus->db->limitQuery($query, 0, 1, true, "Want only a single row");
             if (!empty($result)) {
                 if ($relaterow = $focus->db->fetchByAssoc($result)) {
                     $focus->{$idField} = $relaterow['id'];
                 } elseif (!$addRelatedBean || $newbean->bean_implements('ACL') && !$newbean->ACLAccess('save') || in_array($newbean->module_dir, array('Teams', 'Users')) && !is_admin($GLOBALS['current_user'])) {
                     return false;
                 } else {
                     // add this as a new record in that bean, then relate
                     if (isset($relatedFieldDef['db_concat_fields']) && is_array($relatedFieldDef['db_concat_fields'])) {
                         $relatedFieldParts = explode(' ', $value);
                         foreach ($relatedFieldDef['db_concat_fields'] as $relatedField) {
                             $newbean->{$relatedField} = array_shift($relatedFieldParts);
                         }
                     } else {
                         $newbean->{$vardef}['rname'] = $value;
                     }
                     if (!isset($focus->assigned_user_id) || $focus->assigned_user_id == '') {
                         $newbean->assigned_user_id = $GLOBALS['current_user']->id;
                     } else {
                         $newbean->assigned_user_id = $focus->assigned_user_id;
                     }
                     if (!isset($focus->modified_user_id) || $focus->modified_user_id == '') {
                         $newbean->modified_user_id = $GLOBALS['current_user']->id;
                     } else {
                         $newbean->modified_user_id = $focus->modified_user_id;
                     }
                     // populate fields from the parent bean to the child bean
                     $focus->populateRelatedBean($newbean);
                     $newbean->save(false);
                     $focus->{$idField} = $newbean->id;
                     self::$createdBeans[] = array($newbean->object_name, ImportFile::writeRowToLastImport($focus->module_dir, $newbean->object_name, $newbean->id));
                 }
             }
         }
     }
     return $value;
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:83,代码来源:ImportFieldSanitize.php

示例13: getRelateJoin

 public function getRelateJoin($field_def, $joinTableAlias, $withIdName = true)
 {
     if (empty($field_def['type']) || $field_def['type'] != "relate" || empty($field_def['module'])) {
         return false;
     }
     $rel_mod = BeanFactory::getBean($field_def['module']);
     if (empty($rel_mod)) {
         return false;
     }
     $rel_table = $rel_mod->table_name;
     if (isset($rel_mod->field_defs['name'])) {
         $name_field_def = $rel_mod->field_defs['name'];
         if (isset($name_field_def['db_concat_fields'])) {
             $name_field = db_concat($joinTableAlias, $name_field_def['db_concat_fields']);
         } else {
             if (!empty($rel_mod->field_defs['name']['source']) && $rel_mod->field_defs['name']['source'] == "non-db" && !empty($field_def['rname'])) {
                 $name_field = "{$joinTableAlias}." . $field_def['rname'];
             } else {
                 $name_field = "{$joinTableAlias}.name";
             }
         }
     }
     $tableName = isset($field_def['custom_module']) ? "{$this->bean->table_name}_cstm" : $this->bean->table_name;
     $relID = $field_def['id_name'];
     $select = '';
     if ($withIdName) {
         $select .= ', ' . $tableName . '.' . $relID;
     }
     $relate_query = $rel_mod->getRelateFieldQuery($field_def, $joinTableAlias);
     if ($relate_query['select']) {
         $select .= ', ' . $relate_query['select'];
     }
     $ret_array['rel_table'] = $rel_table = $rel_mod->table_name;
     $ret_array['name_field'] = $name_field;
     $ret_array['select'] = $select;
     $ret_array['from'] = " LEFT JOIN {$rel_table} {$joinTableAlias} ON {$tableName}.{$relID} = {$joinTableAlias}.id" . " AND {$joinTableAlias}.deleted=0 " . $relate_query['join'];
     return $ret_array;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:38,代码来源:DynamicField.php

示例14: address_popup_create_new_list_query

 function address_popup_create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean = null, $singleSelect = false)
 {
     //if this is any action that is not the contact address popup, then go to parent function in sugarbean
     if (isset($_REQUEST['action']) && $_REQUEST['action'] !== 'ContactAddressPopup') {
         return parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, $return_array, $parentbean, $singleSelect);
     }
     $custom_join = $this->getCustomJoin();
     // MFH - BUG #14208 creates alias name for select
     $select_query = "SELECT ";
     $select_query .= db_concat($this->table_name, array('first_name', 'last_name')) . " name, ";
     $select_query .= "\n\t\t\t\t{$this->table_name}.*,\n                accounts.name as account_name,\n                accounts.id as account_id,\n                accounts.assigned_user_id account_id_owner,\n                users.user_name as assigned_user_name ";
     $select_query .= ",teams.name AS team_name ";
     $select_query .= $custom_join['select'];
     $ret_array['select'] = $select_query;
     $from_query = "\n                FROM contacts ";
     // We need to confirm that the user is a member of the team of the item.
     $this->addVisibilityFrom($from_query, array('where_condition' => true));
     $from_query .= "LEFT JOIN users\n\t                    ON contacts.assigned_user_id=users.id\n\t                    LEFT JOIN accounts_contacts\n\t                    ON contacts.id=accounts_contacts.contact_id  and accounts_contacts.deleted = 0\n\t                    LEFT JOIN accounts\n\t                    ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 ";
     $from_query .= "LEFT JOIN teams ON contacts.team_id=teams.id AND (teams.deleted=0) ";
     $from_query .= "LEFT JOIN email_addr_bean_rel eabl  ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 ";
     $from_query .= "LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) ";
     $from_query .= $custom_join['join'];
     $ret_array['from'] = $from_query;
     $ret_array['from_min'] = 'from contacts';
     $where_auto = '1=1';
     if ($show_deleted == 0) {
         $where_auto = " {$this->table_name}.deleted=0 ";
         //$where_auto .= " AND accounts.deleted=0  ";
     } else {
         if ($show_deleted == 1) {
             $where_auto = " {$this->table_name}.deleted=1 ";
         }
     }
     if ($where != "") {
         $where_query = "where ({$where}) AND " . $where_auto;
     } else {
         $where_query = "where " . $where_auto;
     }
     $this->addVisibilityWhere($where_query, array('where_condition' => true));
     $acc = BeanFactory::getBean('Accounts');
     $acc->addVisibilityWhere($where_query, array('where_condition' => true, 'table_alias' => 'accounts'));
     $ret_array['where'] = $where_query;
     $ret_array['order_by'] = '';
     //process order by and add if it's not empty
     $order_by = $this->process_order_by($order_by);
     if (!empty($order_by)) {
         $ret_array['order_by'] = ' ORDER BY ' . $order_by;
     }
     if ($return_array) {
         return $ret_array;
     }
     return $ret_array['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by'];
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:53,代码来源:Contact.php

示例15: getRelatedFields

 function getRelatedFields($module, $id, $fields, $return_array = false)
 {
     if (empty($GLOBALS['beanList'][$module])) {
         return '';
     }
     $object = $GLOBALS['beanList'][$module];
     if ($object == 'aCase') {
         $object = 'Case';
     }
     VardefManager::loadVardef($module, $object);
     if (empty($GLOBALS['dictionary'][$object]['table'])) {
         return '';
     }
     $table = $GLOBALS['dictionary'][$object]['table'];
     $query = 'SELECT id';
     foreach ($fields as $field => $alias) {
         if (!empty($GLOBALS['dictionary'][$object]['fields'][$field]['db_concat_fields'])) {
             $query .= ' ,' . db_concat($table, $GLOBALS['dictionary'][$object]['fields'][$field]['db_concat_fields']) . ' as ' . $alias;
         } else {
             if (!empty($GLOBALS['dictionary'][$object]['fields'][$field]) && (empty($GLOBALS['dictionary'][$object]['fields'][$field]['source']) || $GLOBALS['dictionary'][$object]['fields'][$field]['source'] != "non-db")) {
                 $query .= ' ,' . $table . '.' . $field . ' as ' . $alias;
             }
         }
         if (!$return_array) {
             $this->{$alias} = '';
         }
     }
     if ($query == 'SELECT id' || empty($id)) {
         return '';
     }
     if (isset($GLOBALS['dictionary'][$object]['fields']['assigned_user_id'])) {
         $query .= " , " . $table . ".assigned_user_id owner";
     } else {
         if (isset($GLOBALS['dictionary'][$object]['fields']['created_by'])) {
             $query .= " , " . $table . ".created_by owner";
         }
     }
     $query .= ' FROM ' . $table . ' WHERE deleted=0 AND id=';
     $result = $GLOBALS['db']->query($query . "'{$id}'");
     $row = $GLOBALS['db']->fetchByAssoc($result);
     if ($return_array) {
         return $row;
     }
     $owner = empty($row['owner']) ? '' : $row['owner'];
     foreach ($fields as $alias) {
         $this->{$alias} = !empty($row[$alias]) ? $row[$alias] : '';
         $alias = $alias . '_owner';
         $this->{$alias} = $owner;
         $a_mod = $alias . '_mod';
         $this->{$a_mod} = $module;
     }
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:52,代码来源:SugarBean.php


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