Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/ListView/ListViewSmarty.php');
global $app_strings, $app_list_strings, $current_language, $currentModule, $mod_strings;
echo get_module_title('SavedSearch', $mod_strings['LBL_MODULE_TITLE'], false);
echo get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$search_form = new XTemplate ('modules/SavedSearch/SearchForm.html');
$search_form->assign('MOD', $mod_strings);
$search_form->assign('APP', $app_strings);
$search_form->assign('JAVASCRIPT', get_clear_form_js());
if (isset($_REQUEST['name'])) $search_form->assign('name', to_html($_REQUEST['name']));
if (isset($_REQUEST['search_module'])) $search_form->assign('search_module', to_html($_REQUEST['search_module']));
$search_form->parse('main');
$search_form->out('main');
if (!isset($where)) $where = "assigned_user_id = {$current_user->id}";
echo '<br />' .get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], '', false);
$savedSearch = new SavedSearch();
$lv = new ListViewSmarty();
if(file_exists('custom/modules/SavedSearch/metadata/listviewdefs.php')){
require_once('custom/modules/SavedSearch/metadata/listviewdefs.php');
}else{
require_once('modules/SavedSearch/metadata/listviewdefs.php');
}
$lv->displayColumns = $listViewDefs['SavedSearch'];
$lv->setup($savedSearch, 'include/ListView/ListViewGeneric.tpl', $where);
$lv->display(true);
?>

45
modules/SavedSearch/Menu.php Executable file
View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$module_menu = Array();
?>

View File

@@ -0,0 +1,323 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/templates/TemplateGroupChooser.php');
class SavedSearch extends SugarBean {
var $db;
var $field_name_map;
// Stored fields
var $id;
var $date_entered;
var $date_modified;
var $assigned_user_id;
var $assigned_user_name;
var $modified_by_name;
var $name;
var $description;
var $content;
var $search_module;
var $object_name = 'SavedSearch';
var $table_name = 'saved_search';
var $module_dir = 'SavedSearch';
var $field_defs = array();
var $field_defs_map = array();
var $columns;
function SavedSearch($columns = array(), $orderBy = null, $sortOrder = 'DESC') {
parent::SugarBean();
$this->columns = $columns;
$this->orderBy = $orderBy;
$this->sortOrder = $sortOrder;
$this->setupCustomFields('SavedSearch');
foreach ($this->field_defs as $field) {
$this->field_name_map[$field['name']] = $field;
}
}
// Saved Search Form
function getForm($module, $inline = true) {
global $db, $current_user, $currentModule, $current_language, $app_strings;
$json = getJSONobj();
$saved_search_mod_strings = return_module_language($current_language, 'SavedSearch');
$query = 'SELECT id, name FROM saved_search
WHERE
deleted = \'0\' AND
assigned_user_id = \'' . $current_user->id . '\' AND
search_module = \'' . $module . '\'
ORDER BY name';
$result = $db->query($query, true, "Error filling in saved search list: ");
$savedSearchArray['_none'] = $app_strings['LBL_NONE'];
while ($row = $db->fetchByAssoc($result)) {
$savedSearchArray[$row['id']] = $row['name'];
}
$sugarSmarty = new Sugar_Smarty();
$sugarSmarty->assign('SEARCH_MODULE', $module);
$sugarSmarty->assign('MOD', $saved_search_mod_strings);
$sugarSmarty->assign('DELETE', $app_strings['LBL_DELETE_BUTTON_LABEL']);
$sugarSmarty->assign('UPDATE', $app_strings['LBL_UPDATE']);
$sugarSmarty->assign('SAVE', $app_strings['LBL_SAVE_BUTTON_LABEL']);
// Column Chooser
$chooser = new TemplateGroupChooser();
$chooser->args['id'] = 'edit_tabs';
$chooser->args['left_size'] = 7;
$chooser->args['right_size'] = 7;
$chooser->args['values_array'][0] = array();
$chooser->args['values_array'][1] = array();
if(isset($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
$this->retrieveSavedSearch($_REQUEST['saved_search_select']);
}
if((!empty($_REQUEST['displayColumns']) && $_REQUEST['displayColumns'] != 'undefined') || (isset($this->contents['displayColumns']) && $this->contents['displayColumns'] != 'undefined')) {
// columns to display
if(!empty($_REQUEST['displayColumns']) && $_REQUEST['displayColumns'] != 'undefined') $temp_displayColumns = $_REQUEST['displayColumns'];
else $temp_displayColumns = $this->contents['displayColumns'];
foreach(explode('|', $temp_displayColumns) as $num => $name) {
if (!isset($this->columns[$name])) {
// Ignore any column that is not on the list.
continue;
}
$chooser->args['values_array'][0][$name] = trim(translate($this->columns[$name]['label'], $module), ':');
}
// columns not displayed
foreach(array_diff(array_keys($this->columns), array_values(explode('|', $temp_displayColumns))) as $num => $name) {
$chooser->args['values_array'][1][$name] = trim(translate($this->columns[$name]['label'], $module), ':');
}
}
else {
foreach($this->columns as $name => $val) {
if(!empty($val['default']) && $val['default'])
$chooser->args['values_array'][0][$name] = trim(translate($val['label'], $module), ':');
else
$chooser->args['values_array'][1][$name] = trim(translate($val['label'], $module), ':');
}
}
if(!empty($_REQUEST['sortOrder'])) $this->sortOrder = $_REQUEST['sortOrder'];
if(!empty($_REQUEST['orderBy'])) $this->orderBy = $_REQUEST['orderBy'];
$chooser->args['left_name'] = 'display_tabs';
$chooser->args['right_name'] = 'hide_tabs';
$chooser->args['alt_tip'] = $app_strings['LBL_SORT'];
$chooser->args['left_label'] = $app_strings['LBL_DISPLAY_COLUMNS'];
$chooser->args['right_label'] = $app_strings['LBL_HIDE_COLUMNS'];
$chooser->args['title'] = '';
$sugarSmarty->assign('columnChooser', $chooser->display());
$sugarSmarty->assign('selectedOrderBy', $this->orderBy);
if(empty($this->sortOrder)) $this->sortOrder = 'ASC';
$sugarSmarty->assign('selectedSortOrder', $this->sortOrder);
$lastSavedView = (empty($_SESSION['LastSavedView'][$module]) ? '' : $_SESSION['LastSavedView'][$module]);
$sugarSmarty->assign('columnsMeta', $json->encode($this->columns));
$sugarSmarty->assign('lastSavedView', $lastSavedView);
$sugarSmarty->assign('SAVED_SEARCHES_OPTIONS', get_select_options_with_id($savedSearchArray, $lastSavedView));
$json = getJSONobj();
return $sugarSmarty->fetch('modules/SavedSearch/SavedSearchForm.tpl');
}
function getSelect($module) {
global $db, $current_user, $currentModule, $current_lang, $app_strings;
$saved_search_mod_strings = return_module_language($current_lang, 'SavedSearch');
$query = 'SELECT id, name FROM saved_search
WHERE
deleted = \'0\' AND
assigned_user_id = \'' . $current_user->id . '\' AND
search_module = \'' . $module . '\'
ORDER BY name';
$result = $db->query($query, true, "Error filling in saved search list: ");
$savedSearchArray['_none'] = $app_strings['LBL_NONE'];
while ($row = $db->fetchByAssoc($result)) {
$savedSearchArray[$row['id']] = $row['name'];
}
$sugarSmarty = new Sugar_Smarty();
$sugarSmarty->assign('SEARCH_MODULE', $module);
$sugarSmarty->assign('MOD', $saved_search_mod_strings);
if(!empty($_SESSION['LastSavedView'][$module]) && (($_REQUEST['action'] == 'ListView') || ($_REQUEST['action'] == 'index')))
$selectedSearch = $_SESSION['LastSavedView'][$module];
else
$selectedSearch = '';
$sugarSmarty->assign('SAVED_SEARCHES_OPTIONS', get_select_options_with_id($savedSearchArray, $selectedSearch));
return $sugarSmarty->fetch('modules/SavedSearch/SavedSearchSelects.tpl');
}
function returnSavedSearch($id, $searchFormTab = 'advanced_search', $showDiv='no') {
global $db, $current_user, $currentModule;
$this->retrieveSavedSearch($id);
$header = 'Location: index.php?action=index&module=';
$saved_search_name = '';
$header .= $this->contents['search_module'];
if(empty($_SESSION['LastSavedView'])) $_SESSION['LastSavedView'] = array();
$_SESSION['LastSavedView'][$this->contents['search_module']] = $id;
$saved_search_id = $id;
$saved_search_name = $this->name;
$search_form_tab = $this->contents['searchFormTab'];
$query = $this->contents['query'];
$orderBy = empty($this->contents['orderBy'])? 'name' : $this->contents['orderBy'];
//Reduce the params to avoid the problems caused by URL max length in IE.
header($header . '&saved_search_select=' . $saved_search_id . '&saved_search_select_name=' . $saved_search_name . '&orderBy=' . $orderBy . '&sortOrder=' . $this->contents['sortOrder'] . '&query=' . $query . '&searchFormTab='. $search_form_tab .'&showSSDIV=' . $showDiv);
}
function returnSavedSearchContents($id) {
global $db, $current_user, $currentModule;
$query = 'SELECT id, name, contents, search_module FROM saved_search
WHERE
id = \'' . $id . '\'';
$result = $db->query($query, true, "Error filling in saved search list: ");
$header = 'Location: index.php?action=index&module=';
$contents = '';
$saved_search_name = '';
while ($row = $db->fetchByAssoc($result, -1, false)) {
$header .= $row['search_module'];
if(empty($_SESSION['LastSavedView'])) $_SESSION['LastSavedView'] = array();
$_SESSION['LastSavedView'][$row['search_module']] = $row['id'];
$contents = unserialize(base64_decode($row['contents']));
$saved_search_id = $row['id'];
$saved_search_name = $row['name'];
}
return $contents;
}
function handleDelete($id) {
$this->mark_deleted($id);
header("Location: index.php?action=index&module={$_REQUEST['search_module']}&advanced={$_REQUEST['advanced']}&query=true&clear_query=true");
}
function handleSave($prefix, $redirect = true, $useRequired = false, $id = null) {
global $current_user;
$focus = new SavedSearch();
if($id) $focus->retrieve($id);
if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$ignored_inputs = array('PHPSESSID', 'module', 'action', 'saved_search_name', 'saved_search_select', 'advanced', 'Calls_divs', 'ACLRoles_divs');
$contents = $_REQUEST;
if($id == null) $focus->name = $contents['saved_search_name'];
$focus->search_module = $contents['search_module'];
foreach($contents as $input => $value) {
if(in_array($input, $ignored_inputs)) unset($contents[$input]);
}
$contents['advanced'] = true;
$focus->contents = base64_encode(serialize($contents));
$focus->assigned_user_id = $current_user->id;
$focus->new_schema = true;
$saved_search_id = $focus->save();
$GLOBALS['log']->debug("Saved record with id of " . $focus->id);
$orderBy = empty($contents['orderBy'])? 'name' : $contents['orderBy'];
$search_query = "&orderBy=" . $orderBy . "&sortOrder=".$contents['sortOrder'] . "&query=" . $_REQUEST['query'] . "&searchFormTab=" . $_REQUEST['searchFormTab'].'&showSSDIV=' . $contents['showSSDIV'];
$this->handleRedirect($focus->search_module, $search_query, $saved_search_id, 'true');
}
function handleRedirect($return_module, $search_query, $saved_search_id, $advanced = 'false') {
$_SESSION['LastSavedView'][$return_module] = $saved_search_id;
$return_action = 'index';
//Reduce the params to avoid the problems caused by URL max length in IE ( the reduced params can be get from saved search according to saved_search_id).
header("Location: index.php?action=$return_action&module=$return_module&saved_search_select={$saved_search_id}{$search_query}&advanced={$advanced}");
die();
}
function fill_in_additional_list_fields() {
global $app_list_strings;
// Fill in the assigned_user_name
$this->search_module = $app_list_strings['moduleList'][$this->contents['search_module']];
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
}
function retrieveSavedSearch($id) {
parent::retrieve($id);
$this->contents = unserialize(base64_decode($this->contents));
}
function populateRequest(){
foreach($this->contents as $key=>$val){
// todo wp: remove this
if($key != 'advanced' && $key != 'module' && !strpos($key, '_ORDER_BY') && $key != 'lvso') { // cn: bug 6546 storequery stomps correct value for 'module' in Activities
$_REQUEST[$key] = $val;
$_GET[$key] = $val;
}
}
}
}
?>

View File

@@ -0,0 +1,128 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class UpgradeSavedSearch {
function UpgradeSavedSearch() {
$result = $GLOBALS['db']->query("SELECT id FROM saved_search");
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
$focus = new SavedSearch();
$focus->retrieve($row['id']);
$contents = unserialize(base64_decode($focus->contents));
$has_team_name_saved = isset($contents['team_name_advanced']) || isset($contents['team_name_basic']) ? true : false;
//If $contents['searchFormTab'] is set then this is coming from a 4.x saved search
if(isset($contents['searchFormTab']) && $contents['searchFormTab'] == 'saved_views') {
$new_contents = array();
$module = $contents['search_module'];
$advanced = !empty($contents['advanced']);
$field_map = array();
if(file_exists("custom/modules/{$module}/metadata/searchdefs.php")) {
require("custom/modules/{$module}/metadata/searchdefs.php");
$field_map = $advanced ? $searchdefs[$module]['layout']['advanced_search'] : $searchdefs[$module]['layout']['basic_search'];
}else if(file_exists("modules/{$module}/metadata/SearchFields.php")) {
require("modules/{$module}/metadata/SearchFields.php");
$field_map = $searchFields[$module];
} else {
$bean = loadBean($module);
$field_map = $bean->field_name_map;
}
//Special case for team_id field (from 4.5.x)
if(isset($contents['team_id'])) {
$contents['team_name'] = $contents['team_id'];
unset($contents['team_id']);
}
foreach($contents as $key=>$value) {
if(isset($field_map[$key])) {
$new_key = $key . ($advanced ? '_advanced' : '_basic');
if(preg_match('/^team_name_(advanced|basic)$/', $new_key)) {
if(!is_array($value)) {
$temp_value = array();
$teap_value[] = $value;
$value = $temp_value;
}
$team_results = $GLOBALS['db']->query("SELECT id, name FROM teams where id in ('" . implode("','", $value) . "')");
if(!empty($team_results)) {
$count = 0;
while($team_row = $GLOBALS['db']->fetchByAssoc($team_results)) {
$team_key = $new_key . '_collection_' . $count;
$new_contents[$team_key] = $team_row['name'];
$new_contents['id_' . $team_key] = $team_row['id'];
$count++;
} //while
} //if
//Unset the original key
unset($new_contents[$key]);
//Add the any switch
$new_contents[$new_key . '_type'] = 'any';
} else {
$new_contents[$new_key] = $value;
}
} else {
$new_contents[$key] = $value;
}
}
$new_contents['searchFormTab'] = $advanced ? 'advanced_search' : 'basic_search';
$content = base64_encode(serialize($new_contents));
$GLOBALS['db']->query("UPDATE saved_search SET contents = '{$content}' WHERE id = '{$row['id']}'");
} else if($has_team_name_saved) {
//Otherwise, if the boolean has_team_name_saved is set to true, we also need to parse (coming from 5.x)
if(isset($contents['team_name_advanced'])) {
$team_results = $GLOBALS['db']->query("SELECT name FROM teams where id = '{$contents['team_name_advanced']}'");
if(!empty($team_results)) {
$team_row = $GLOBALS['db']->fetchByAssoc($team_results);
$contents['team_name_advanced_collection_0'] = $team_row['name'];
$contents['id_team_name_advanced_collection_0'] = $contents['team_name_advanced'];
$contents['team_name_advanced_type'] = 'any';
unset($contents['team_name_advanced']);
$content = base64_encode(serialize($contents));
$GLOBALS['db']->query("UPDATE saved_search SET contents = '{$content}' WHERE id = '{$row['id']}'");
}
}
}
} //while
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains field arrays that are used for caching
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$fields_array['SavedSearch'] = array ('column_fields' => Array(
'id'
,'search_module'
,'name'
,'description'
,'contents'
,'assigned_user_id'
,'date_entered'
,'date_modified'
,'deleted'
),
'list_fields' => Array('id', 'module','name','description'),
'required_fields' => array('id' => 1, 'name'=>1, 'module'=>1),
);
?>

87
modules/SavedSearch/index.php Executable file
View File

@@ -0,0 +1,87 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
if(!empty($_REQUEST['saved_search_action'])) {
// _pp($_REQUEST);
$ss = new SavedSearch();
switch($_REQUEST['saved_search_action']) {
case 'update': // save here
$ss->handleSave('', true, false, $_REQUEST['saved_search_select']);
break;
case 'save': // save here
$ss->handleSave('', true, false);
break;
case 'delete': // delete here
$ss->handleDelete($_REQUEST['saved_search_select']);
break;
}
}
elseif(!empty($_REQUEST['saved_search_select'])) { // requesting a search here.
if(!empty($_REQUEST['searchFormTab'])) // where is the request from
$searchFormTab = $_REQUEST['searchFormTab'];
else
$searchFormTab = 'saved_views';
if($_REQUEST['saved_search_select'] == '_none') { // none selected
$_SESSION['LastSavedView'][$_REQUEST['search_module']] = '';
$current_user->setPreference('ListViewDisplayColumns', array(), 0, $_REQUEST['search_module']);
header("Location: index.php?action=index&module={$_REQUEST['search_module']}&searchFormTab={$searchFormTab}&query=true&clear_query=true");
die();
}
else {
$ss = new SavedSearch();
$show='no';
if(isset($_REQUEST['showSSDIV'])){$show = $_REQUEST['showSSDIV'];}
$ss->returnSavedSearch($_REQUEST['saved_search_select'], $searchFormTab, $show);
}
}
else {
include('modules/SavedSearch/ListView.php');
}
?>

View File

@@ -0,0 +1,69 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_MODULE_TITLE' => 'My Saved Searches',
'LBL_MODULE_TITLE' => 'My Saved Searches',
'LBL_SEARCH_FORM_TITLE' => 'My Saved Searches : Search',
'LBL_LIST_FORM_TITLE' => 'My Saved Searches List',
'LBL_DELETE_CONFIRM' => 'Are you sure you want to delete the selected Saved Search?',
'LBL_UPDATE_BUTTON_TITLE' => 'Update this Saved Search',
'LBL_DELETE_BUTTON_TITLE' => 'Delete this Saved Search',
'LBL_SAVE_BUTTON_TITLE' => 'Save the current search',
'LBL_LIST_NAME' => 'Name',
'LBL_LIST_MODULE' => 'Module',
'LBL_ORDER_BY_COLUMNS' => 'Order by column:',
'LBL_DIRECTION' => 'Direction:',
'LBL_SAVE_SEARCH_AS' => 'Save search as:',
'LBL_SAVE_SEARCH_AS_HELP' => 'This saves your view settings and any filters on the Advanced Search tab.',
'LBL_PREVIOUS_SAVED_SEARCH' => 'Previous Saved Searches:',
'LBL_PREVIOUS_SAVED_SEARCH_HELP' => 'Edit or Delete an existing Saved Search.',
'LBL_ASCENDING' => 'Ascending',
'LBL_DESCENDING' => 'Descending',
'LBL_MODIFY_CURRENT_SEARCH'=> 'Modify current search',
);
?>

View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Professional End User
* License Agreement ("License") which can be viewed at
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
* By installing or using this file, You have unconditionally agreed to the
* terms and conditions of the License, and You may not use this file except in
* compliance with the License. Under the terms of the license, You shall not,
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
* or otherwise transfer Your rights to the Software, and 2) use the Software
* for timesharing or service bureau purposes such as hosting the Software for
* commercial gain and/or for the benefit of a third party. Use of the Software
* may be subject to applicable fees and any use of the Software without first
* paying applicable fees is strictly prohibited. You do not have the right to
* remove SugarCRM copyrights from the source code or user interface.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* Your Warranty, Limitations of liability and Indemnity are expressly stated
* in the License. Please refer to the License for the specific language
* governing these rights and limitations under the License. Portions created
* by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; All Rights Reserved.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_MODULE_TITLE' => 'Moje zapisane wyniki wyszukiwania',
'LBL_MODULE_TITLE' => 'Moje zapisane wyniki wyszukiwania',
'LBL_SEARCH_FORM_TITLE' => 'Moje Zapisane wyniki wyszukiwania: Szukaj',
'LBL_LIST_FORM_TITLE' => 'Lista Moich wyszukanych wyników',
'LBL_DELETE_CONFIRM' => 'Czy na pewno chcesz usunąć wybrany wynik wyszukiwania?',
'LBL_UPDATE_BUTTON_TITLE' => 'Uaktualnij ten wynik wyszukiwania',
'LBL_DELETE_BUTTON_TITLE' => 'Usuń ten wynik wyszukiwania',
'LBL_SAVE_BUTTON_TITLE' => 'Zapisz bieżące wyszukiwanie',
'LBL_LIST_NAME' => 'Nazwa',
'LBL_LIST_MODULE' => 'Moduł',
'LBL_ORDER_BY_COLUMNS' => 'Porządkuj po kolumnie:',
'LBL_DIRECTION' => 'Kierunek:',
'LBL_SAVE_SEARCH_AS' => 'Zapisz wynik wyszukiawania jako:',
'LBL_SAVE_SEARCH_AS_HELP' => 'Zapisuje Twoje ustawienia wyszukiwania i wszystkie filtry w Zakładce
wyszukiwanie zaawansowane.',
'LBL_PREVIOUS_SAVED_SEARCH' => 'Poprzedni zapisany wynik wyszukiwania:',
'LBL_PREVIOUS_SAVED_SEARCH_HELP' => 'Edytuje lub usuwa zapisany wynik wyszukiwania.',
'LBL_ASCENDING' => 'Rosnąco',
'LBL_DESCENDING' => 'Malejąco',
'LBL_MODIFY_CURRENT_SEARCH'=> 'Modyfikuj bieżące wyszukiwanie',
);
?>

View File

@@ -0,0 +1,53 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$listViewDefs['SavedSearch'] = array(
'NAME' => array(
'width' => '40%',
'label' => 'LBL_LIST_NAME',
'link' => true,
'customCode' => '<a href="index.php?action=index&module=SavedSearch&saved_search_select={$ID}">{$NAME}</a>'),
'SEARCH_MODULE' => array(
'width' => '35%',
'label' => 'LBL_LIST_MODULE'),
'ASSIGNED_USER_NAME' => array(
'width' => '10%',
'label' => 'LBL_LIST_ASSIGNED_USER')
);
?>

146
modules/SavedSearch/vardefs.php Executable file
View File

@@ -0,0 +1,146 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['SavedSearch'] = array('table' => 'saved_search',
'fields' => array (
'id' =>
array (
'name' => 'id',
'vname' => 'LBL_NAME',
'type' => 'id',
'required'=>true,
'reportable'=>false,
),
'name' =>
array (
'name' => 'name',
'type' => 'varchar',
'vname' => 'LBL_NAME',
'len' => 150,
),
'search_module' =>
array (
'name' => 'search_module',
'type' => 'varchar',
'vname' => 'LBL_MODULE',
'len' => 150,
),
'deleted' =>
array (
'name' => 'deleted',
'vname' => 'LBL_CREATED_BY',
'type' => 'bool',
'required'=>true,
'reportable'=>false,
),
'date_entered' =>
array (
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'required'=>true,
),
'date_modified' =>
array (
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'required'=>true,
),
'assigned_user_id' =>
array (
'name' => 'assigned_user_id',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'vname' => 'LBL_ASSIGNED_TO',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => 'false',
'dbType' => 'id',
'reportable'=>true,
'massupdate' => false,
),
'assigned_user_name' =>
array (
'name' => 'assigned_user_name',
'vname' => 'LBL_ASSIGNED_TO_NAME',
'type' => 'varchar',
'reportable'=>false,
'massupdate' => false,
'source'=>'non-db',
'table' => 'users',
),
'contents' =>
array (
'name' => 'contents',
'type' => 'text',
'vname' => 'LBL_DESCRIPTION',
'isnull' => true,
),
'description' =>
array (
'name' => 'description',
'type' => 'text',
'vname' => 'LBL_DESCRIPTION',
'isnull' => true,
),
'assigned_user_link' =>
array (
'name' => 'assigned_user_link',
'type' => 'link',
'relationship' => 'saved_search_assigned_user',
'vname' => 'LBL_ASSIGNED_TO_USER',
'link_type' => 'one',
'module'=>'Users',
'bean_name'=>'User',
'source'=>'non-db',
),
),
'relationships' => array (
'saved_search_assigned_user' =>
array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
'rhs_module'=> 'SavedSearch', 'rhs_table'=> 'saved_search', 'rhs_key' => 'assigned_user_id',
'relationship_type'=>'one-to-many')
),
'indices' => array (
array('name' =>'savedsearchpk', 'type' =>'primary', 'fields'=>array('id')),
array('name' =>'idx_desc', 'type'=>'index', 'fields'=>array('name','deleted')))
);
VardefManager::createVardef('SavedSearch','SavedSearch', array(
));
?>