function criteria_my_preferred($element) { $field = $this->put_alias($element['real_field']); $criteria = phpgwapi_sql_criteria::or_(phpgwapi_sql_criteria::equal($field, phpgwapi_sql::string($element['value'])), phpgwapi_sql_criteria::is_null($field)); $this->_add_criteria($criteria); return $criteria; }
function criteria_comm_find_descr($element) { $field = $this->put_alias($element['real_field']); foreach ($element['value'] as $value) { $data[] = phpgwapi_sql_criteria::equal($field, phpgwapi_sql::string($value)); } $criteria = phpgwapi_sql_criteria::append_or($data); $this->_add_criteria($criteria); }
/** * Allow to edit the current other data for the owner, you can modify other_name or other_value fields * * @param integer $id the owner id * @param string $new_data The new value which you want to update. * @param string $old_data The current value which you want to update. * @param string $field_data The field is can be other_name or other_value * @param integer $action PHPGW_SQL_RETURN_SQL | PHPGW_SQL_RUN_SQL depending what we want * @return string SQL update string */ function edit_other_by_owner($id, $new_data, $old_data, $field_data, $action = PHPGW_SQL_RUN_SQL) { $other = createObject('phpgwapi.contact_others'); $criteria = phpgwapi_sql_criteria::append_and(array(phpgwapi_sql_criteria::equal('contact_owner', phpgwapi_sql::integer($id)), phpgwapi_sql_criteria::equal($field_data, phpgwapi_sql::string($old_data)))); return $other->update(array($field_data => $new_data), $criteria, $action); }
public static function character($str) { return phpgwapi_sql::string($str); }
function criteria_sel_cat_id($element) { $field = $this->put_alias($element['real_field']); if (is_array($element['value'])) { foreach ($element['value'] as $value) { $data[] = phpgwapi_sql_criteria::or_(phpgwapi_sql_criteria::equal($field, sql::string($value)), phpgwapi_sql_criteria::has($field, ',' . $value . ',')); } $criteria = phpgwapi_sql_criteria::append_or($data); $this->_add_criteria($criteria); } else { $this->_add_criteria(phpgwapi_sql_criteria::equal($field, phpgwapi_sql::string($element['value']))); } }
function full_name() { $this->add_field('per_full_name', phpgwapi_sql::concat_null(array($this->real_field('per_prefix'), phpgwapi_sql::string(' '), $this->real_field('per_first_name'), phpgwapi_sql::string(' '), $this->real_field('per_middle_name'), phpgwapi_sql::string(' '), $this->real_field('per_last_name'), phpgwapi_sql::string(' '), $this->real_field('per_suffix')))); }