function populateFromPost() { parent::populateFromPost(); if (isset($this->auto_increment)) { $this->auto_increment = $this->auto_increment == "true" || $this->auto_increment === true; } }
function populateFromPost() { parent::populateFromPost(); if (!empty($this->visibility_grid) && is_string($this->visibility_grid)) { $this->visibility_grid = json_decode(html_entity_decode($this->visibility_grid), true); } // now convert trigger,action pairs into a dependency array representation // we expect the dependencies in the following format: // trigger = [ trigger for action 1 , trigger for action 2 , ... , trigger for action n ] // action = [ action 1 , action 2 , ... , action n ] // check first if we have the component parts of a dependency $dependencyPresent = true; foreach ($this->localVardefMap as $def) { $dependencyPresent &= isset($this->{$def}); } if ($dependencyPresent) { $dependencies = array(); if (is_array($this->trigger) && is_array($this->action)) { for ($i = 0; $i < count($this->action); $i++) { $dependencies[$this->trigger[$i]] = $this->action[$i]; } $this->dependency = $dependencies; } else { if (!is_array($this->trigger) && !is_array($this->action)) { $this->dependency = array($this->trigger => $this->action); } } // tidy up unset($this->trigger); unset($this->action); } }
/** * populateFromPost * * @see parent::populateFromPost * This method checks to see if enable_range_search is set. If so, ensure that the * searchdefs for the module include the additional range fields. */ function populateFromPost() { parent::populateFromPost(); //If we are enabling range search, make sure we add the start and end range fields if (!empty($this->enable_range_search)) { //If range search is enabled, set the options attribute for the dropdown choice selections $this->options = $this->type == 'date' || $this->type == 'datetimecombo' || $this->type == 'datetime' ? 'date_range_search_dom' : 'numeric_range_search_dom'; if (isset($_REQUEST['view_module'])) { $module = $_REQUEST['view_module']; if (file_exists('modules/' . $module . '/metadata/SearchFields.php')) { require 'modules/' . $module . '/metadata/SearchFields.php'; } if (file_exists('custom/modules/' . $module . '/metadata/SearchFields.php')) { require 'custom/modules/' . $module . '/metadata/SearchFields.php'; } $field_name = $this->get_field_name($module, $_REQUEST['name']); if (isset($searchFields[$module])) { $field_name_range = 'range_' . $field_name; $field_name_start = 'start_range_' . $field_name; $field_name_end = 'end_range_' . $field_name; $isDateField = $this->type == 'date' || $this->type == 'datetimecombo' || $this->type == 'datetime'; $searchFields[$module][$field_name_range] = array('query_type' => 'default', 'enable_range_search' => true); if ($isDateField) { $searchFields[$module][$field_name_range]['is_date_field'] = true; } $searchFields[$module][$field_name_start] = array('query_type' => 'default', 'enable_range_search' => true); if ($isDateField) { $searchFields[$module][$field_name_start]['is_date_field'] = true; } $searchFields[$module][$field_name_end] = array('query_type' => 'default', 'enable_range_search' => true); if ($isDateField) { $searchFields[$module][$field_name_end]['is_date_field'] = true; } if (!file_exists('custom/modules/' . $module . '/metadata/SearchFields.php')) { mkdir_recursive('custom/modules/' . $module . '/metadata'); } write_array_to_file("searchFields['{$module}']", $searchFields[$module], 'custom/modules/' . $module . '/metadata/SearchFields.php'); } if (file_exists($cachefile = sugar_cached("modules/{$module}/SearchForm_basic.tpl"))) { unlink($cachefile); } if (file_exists($cachefile = sugar_cached("modules/{$module}/SearchForm_advanced.tpl"))) { unlink($cachefile); } } } else { //Otherwise, try to restore the searchFields to their state prior to being enabled if (isset($_REQUEST['view_module'])) { $module = $_REQUEST['view_module']; if (file_exists('modules/' . $module . '/metadata/SearchFields.php')) { require 'modules/' . $module . '/metadata/SearchFields.php'; } if (file_exists('custom/modules/' . $module . '/metadata/SearchFields.php')) { require 'custom/modules/' . $module . '/metadata/SearchFields.php'; } $field_name = $this->get_field_name($module, $_REQUEST['name']); if (isset($searchFields[$module])) { $field_name_range = 'range_' . $field_name; $field_name_start = 'start_range_' . $field_name; $field_name_end = 'end_range_' . $field_name; if (isset($searchFields[$module][$field_name_range])) { unset($searchFields[$module][$field_name_range]); } if (isset($searchFields[$module][$field_name_start])) { unset($searchFields[$module][$field_name_start]); } if (isset($searchFields[$module][$field_name_end])) { unset($searchFields[$module][$field_name_end]); } if (!file_exists('custom/modules/' . $module . '/metadata/SearchFields.php')) { mkdir_recursive('custom/modules/' . $module . '/metadata'); } write_array_to_file("searchFields['{$module}']", $searchFields[$module], 'custom/modules/' . $module . '/metadata/SearchFields.php'); } if (file_exists($cachefile = sugar_cached("modules/{$module}/SearchForm_basic.tpl"))) { unlink($cachefile); } if (file_exists($cachefile = sugar_cached("modules/{$module}/SearchForm_advanced.tpl"))) { unlink($cachefile); } } } }