本文整理汇总了PHP中StoreQuery类的典型用法代码示例。如果您正苦于以下问题:PHP StoreQuery类的具体用法?PHP StoreQuery怎么用?PHP StoreQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StoreQuery类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testPopulateRequestOverride
function testPopulateRequestOverride()
{
$_REQUEST['lvso'] = 'desc';
$_REQUEST['foo'] = 'bar';
$sq = new StoreQuery();
$sq->loadQuery("Contacts");
//StoreQuery should override foo while leaving lvso untouched
$sq->query['lvso'] = 'asc';
$sq->query['foo'] = 'overridden';
$sq->populateRequest();
$this->assertEquals($_REQUEST['lvso'], 'desc');
$this->assertEquals($_REQUEST['foo'], 'overridden');
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:13,代码来源:StoreQueryTest.php
示例2: testAdvancedSearchWithCommaSeparatedBugNumbers
public function testAdvancedSearchWithCommaSeparatedBugNumbers()
{
$_REQUEST = array();
$storeQuery = new StoreQuery();
$query['action'] = 'index';
$query['module'] = 'Bugs';
$query['orderBy'] = 'BUG_NUMBER';
$query['sortOrder'] = 'ASC';
$query['query'] = 'true';
$query['searchFormTab'] = 'advanced_search';
$query['showSSDIV'] = 'no';
$query['bug_number_advanced'] = '1,2,3,4,5';
$query['name_advanced'] = '';
$query['status_advanced'][] = 'Assigned';
$query['favorites_only_advanced'] = '0';
$query['search_module'] = 'Bug';
$query['saved_search_action'] = 'save';
$query['displayColumns'] = 'BUG_NUMBER|NAME|STATUS|TYPE|PRIORITY|FIXED_IN_RELEASE_NAME|ASSIGNED_USER_NAME';
$storeQuery->query = $query;
$storeQuery->populateRequest();
$this->assertEquals('1,2,3,4,5', $_REQUEST['bug_number_advanced'], "Assert that bug search string 1,2,3,4,5 was not formatted");
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:22,代码来源:Bug44908Test.php
示例3: loadQuery
function loadQuery($name)
{
$saveType = $this->getSaveType($name);
if ($saveType == 'all' || $saveType == 'myitems') {
global $current_user;
$this->query = StoreQuery::getStoredQueryForUser($name);
if (empty($this->query)) {
$this->query = array();
}
if (!empty($this->populate_only) && !empty($this->query['query'])) {
$this->query['query'] = 'MSI';
}
}
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:14,代码来源:StoreQuery.php
示例4: get_admin_fts_list
function get_admin_fts_list($where, $isMultiSelect = false)
{
global $app_strings, $app_list_strings, $current_language, $sugar_version, $sugar_config, $current_user;
global $urlPrefix, $currentModule, $theme;
$current_module_strings = return_module_language($current_language, 'KBDocuments');
// focus_list is the means of passing data to a ListView.
global $focus_list;
require_once 'include/ListView/ListViewSmarty.php';
require_once SugarAutoLoader::loadWithMetafiles('KBDocuments', 'listviewdefs');
require_once 'modules/KBDocuments/KBListViewData.php';
global $app_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'KBDocuments');
global $urlPrefix;
global $currentModule;
global $theme;
global $current_user;
// focus_list is the means of passing data to a ListView.
global $focus_list;
// setup quicksearch
//require_once('include/QuickSearchDefaults.php');
//$qsd = new QuickSearchDefaults();
// clear the display columns back to default when clear query is called
if (!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true') {
$current_user->setPreference('ListViewDisplayColumns', array(), 0, $currentModule);
}
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', $currentModule);
// get user defined display columns
$json = getJSONobj();
$seedCase = BeanFactory::getBean('KBDocuments');
// seed bean
// setup listview smarty
$lv = new ListViewSmarty();
$lv->lvd = new KBListViewData();
$lv->export = false;
$lv->select = false;
$lv->delete = false;
$_REQUEST['action'] = 'index';
$displayColumns = array();
// check $_REQUEST if new display columns from post
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs['KBDocuments'][$col])) {
$displayColumns[$col] = $listViewDefs['KBDocuments'][$col];
}
}
} elseif (!empty($savedDisplayColumns)) {
// use user defined display columns from preferences
$displayColumns = $savedDisplayColumns;
} else {
// use columns defined in listviewdefs for default display columns
foreach ($listViewDefs['KBDocuments'] as $col => $params) {
if (!empty($params['default']) && $params['default']) {
$displayColumns[$col] = $params;
}
}
}
$params = array('massupdate' => true);
// setup ListViewSmarty params
if (!empty($_REQUEST['orderBy'])) {
// order by coming from $_REQUEST
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if (!empty($_REQUEST['sortOrder'])) {
$params['sortOrder'] = $_REQUEST['sortOrder'];
}
}
//make sure the column names (array keys) are in upper case
$displayColumns = array_change_key_case($displayColumns, CASE_UPPER);
$lv->displayColumns = $displayColumns;
// use the stored query if there is one
if (!isset($where)) {
$where = "";
}
require_once 'modules/MySettings/StoreQuery.php';
$storeQuery = new StoreQuery();
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromGet($currentModule);
}
if (isset($_REQUEST['query'])) {
// we have a query
// first save columns
$current_user->setPreference('ListViewDisplayColumns', $displayColumns, 0, $currentModule);
if (!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) {
// from EditView cancel
$searchForm->populateFromArray($storeQuery->query);
} else {
$searchForm->populateFromRequest();
}
$where_clauses = $searchForm->generateSearchWhere(true, "kbdocuments");
// builds the where clause from search field inputs
if (count($where_clauses) > 0) {
$where = implode(' and ', $where_clauses);
}
$GLOBALS['log']->info("Here is the where clause for the list view: {$where}");
}
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:SearchUtils.php
示例5: StoreQuery
case 'advanced_search':
$searchForm->setup();
$searchForm->displayAdvanced(false);
break;
case 'saved_views':
echo $searchForm->displaySavedViews($listViewDefs, $lv, false);
break;
}
return;
}
// use the stored query if there is one
if (!isset($where)) {
$where = "";
}
require_once 'modules/MySettings/StoreQuery.php';
$storeQuery = new StoreQuery();
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromGet($currentModule);
}
if (isset($_REQUEST['query'])) {
// we have a query
// first save columns
$current_user->setPreference('ListViewDisplayColumns', $displayColumns, 0, $currentModule);
$searchForm->populateFromRequest();
// gathers search field inputs from $_REQUEST
$where_clauses = $searchForm->generateSearchWhere(true, "Products");
// builds the where clause from search field inputs
if (count($where_clauses) > 0) {
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:ListView.php
示例6: display
//.........这里部分代码省略.........
$lv = new ListViewSmarty();
$displayColumns = array();
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs[$module][$col])) {
$displayColumns[$col] = $listViewDefs[$module][$col];
}
}
} else {
foreach ($listViewDefs[$module] as $col => $params) {
if (!empty($params['default']) && $params['default']) {
$displayColumns[$col] = $params;
}
}
}
global $current_user;
if (!is_admin($current_user)) {
$params = array('massupdate' => false);
$lv->export = false;
} else {
$params = array('massupdate' => true, 'export' => true);
}
if (!empty($_REQUEST['orderBy'])) {
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if (!empty($_REQUEST['sortOrder'])) {
$params['sortOrder'] = $_REQUEST['sortOrder'];
}
}
$lv->displayColumns = $displayColumns;
$this->seed = $seed;
$this->module = $module;
$searchForm = null;
$storeQuery = new StoreQuery();
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($this->module);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromRequest($this->module);
}
//search
$view = 'basic_search';
if (!empty($_REQUEST['search_form_view'])) {
$view = $_REQUEST['search_form_view'];
}
$headers = true;
if (!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) {
$headers = false;
} elseif (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$view = 'advanced_search';
} else {
$view = 'basic_search';
}
}
$use_old_search = true;
if (file_exists('modules/' . $this->module . '/SearchForm.html')) {
require_once 'include/SearchForm/SearchForm.php';
$searchForm = new SearchForm($this->module, $this->seed);
} else {
$use_old_search = false;
require_once 'include/SearchForm/SearchForm2.php';
if (file_exists('custom/modules/' . $this->module . '/metadata/searchdefs.php')) {
require_once 'custom/modules/' . $this->module . '/metadata/searchdefs.php';
} elseif (!empty($metafiles[$this->module]['searchdefs'])) {
require_once $metafiles[$this->module]['searchdefs'];
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:67,代码来源:view.list.php
示例7: action_massupdate
/**
* Perform the actual massupdate.
*/
protected function action_massupdate()
{
if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) {
if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
set_time_limit(0);
//I'm wondering if we will set it never goes timeout here.
// until we have more efficient way of handling MU, we have to disable the limit
$GLOBALS['db']->setQueryLimit(0);
require_once "include/MassUpdate.php";
require_once 'modules/MySettings/StoreQuery.php';
$seed = loadBean($_REQUEST['module']);
$mass = new MassUpdate();
$mass->setSugarBean($seed);
if (isset($_REQUEST['entire']) && empty($_POST['mass'])) {
$mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
}
$mass->handleMassUpdate();
$storeQuery = new StoreQuery();
//restore the current search. to solve bug 24722 for multi tabs massupdate.
$temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']);
if ($_REQUEST['return_module'] == 'Emails') {
if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) {
$this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']);
// Specifically for My Achieves
}
}
$_REQUEST = array();
$_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page']));
unset($_REQUEST[$seed->module_dir . '2_' . strtoupper($seed->object_name) . '_offset']);
//after massupdate, the page should redirect to no offset page
$storeQuery->saveFromRequest($_REQUEST['module']);
$_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);
//for post_massupdate, to go back to original page.
} else {
sugar_die("You must massupdate at least one record");
}
}
开发者ID:sunmo,项目名称:snowlotus,代码行数:43,代码来源:SugarController.php
示例8: testStoreQuerySaveAndPopulate
public function testStoreQuerySaveAndPopulate()
{
global $current_user, $timedate;
$storeQuery = new StoreQuery();
//Simulate a search request here
$_REQUEST = array('module' => 'Opportunities', 'action' => 'index', 'searchFormTab' => 'advanced_search', 'query' => true, 'name_advanced' => '', 'account_name_advanced' => '', 'amount_advanced_range_choice' => '=', 'range_amount_advanced' => '', 'start_range_amount_advanced' => '', 'end_range_amount_advanced' => '', 'date_closed_advanced_range_choice' => '=', 'range_date_closed_advanced' => '09/01/2008', 'start_range_date_closed_advanced' => '', 'end_range_date_closed_advanced' => '', 'next_step_advanced' => '', 'update_fields_team_name_advanced_collection' => '', 'team_name_advanced_new_on_update' => false, 'team_name_advanced_allow_update' => '', 'team_name_advanced_allowed_to_check' => false, 'team_name_advanced_collection_0' => '', 'id_team_name_advanced_collection_0' => '', 'team_name_advanced_type' => 'any', 'favorites_only_advanced' => 0, 'showSSDIV' => 'no', 'saved_search_name' => '', 'search_module' => '', 'saved_search_action' => '', 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED', 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME', 'orderBy' => 'NAME', 'sortOrder' => 'ASC', 'button' => 'Search', 'saved_search_select' => '_none', 'sugar_user_theme' => 'Sugar', 'ModuleBuilder' => 'helpHidden=true', 'Contacts_divs' => 'quotes_v=#', 'sugar_theme_gm_current' => 'All', 'globalLinksOpen' => 'true', 'SQLiteManager_currentLangue' => '2', 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca');
$storeQuery->saveFromRequest('Opportunities');
$storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
$this->assertEquals($storedSearch['range_date_closed_advanced'], '2008-09-01', 'Assert that search date 09/02/2008 was saved in db format 2008-09-01');
//Test that value is converted to user date preferences when retrieved
unset($_REQUEST['range_date_closed_advanced']);
$storeQuery->loadQuery('Opportunities');
$storeQuery->populateRequest();
$this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
$this->assertEquals($_REQUEST['range_date_closed_advanced'], '09/01/2008', 'Assert that search date in db_format 2008-09-01 was converted to user date preference 09/01/2008');
//Now say the user changes his date preferences and switches back to this StoredQuery
$current_user->setPreference('datef', 'Y.m.d', 0, 'global');
$current_user->save();
//Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
unset($_REQUEST['range_date_closed_advanced']);
$storeQuery->loadQuery('Opportunities');
$storeQuery->populateRequest();
$this->assertTrue(isset($_REQUEST['range_date_closed_advanced']), 'Assert that the field was correctly populated');
$this->assertEquals($_REQUEST['range_date_closed_advanced'], '2008.09.01', 'Assert that search date in db_format 2008-09-01 was converted to user date preference 2008.09.01');
}
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:25,代码来源:Bug42378Test.php
示例9: loadBean
}
}
if (!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select'] != '_none') {
if (empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query'] != 'true')) {
$saved_search = loadBean('SavedSearch');
$saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
$saved_search->populateRequest();
} elseif (!empty($_REQUEST['button'])) {
// click the search button, after retrieving from saved_search
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
unset($_REQUEST['saved_search_select']);
unset($_REQUEST['saved_search_select_name']);
}
}
require_once 'modules/MySettings/StoreQuery.php';
$storeQuery = new StoreQuery();
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery('Users');
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromRequest('Users');
}
$displayColumns = array();
// check $_REQUEST if new display columns from post
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs['Users'][$col])) {
$displayColumns[$col] = $listViewDefs['Users'][$col];
}
}
} elseif (!empty($savedDisplayColumns)) {
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:ListView.php
示例10: testStoreQuerySaveAndPopulate
public function testStoreQuerySaveAndPopulate()
{
global $current_user, $timedate;
$storeQuery = new StoreQuery();
//Simulate a search request here
$_REQUEST = array('module' => 'Opportunities', 'action' => 'index', 'searchFormTab' => 'advanced_search', 'query' => true, 'name_advanced' => '', 'account_name_advanced' => '', 'amount_advanced_range_choice' => '=', 'range_amount_advanced' => '', 'start_range_amount_advanced' => '$9,500.00', 'end_range_amount_advanced' => '$45,900.00', 'date_closed_advanced_range_choice' => '=', 'range_date_closed_advanced' => '', 'start_range_date_closed_advanced' => '', 'end_range_date_closed_advanced' => '', 'next_step_advanced' => '', 'update_fields_team_name_advanced_collection' => '', 'team_name_advanced_new_on_update' => false, 'team_name_advanced_allow_update' => '', 'team_name_advanced_allowed_to_check' => false, 'team_name_advanced_collection_0' => '', 'id_team_name_advanced_collection_0' => '', 'team_name_advanced_type' => 'any', 'favorites_only_advanced' => 0, 'showSSDIV' => 'no', 'saved_search_name' => '', 'search_module' => '', 'saved_search_action' => '', 'displayColumns' => 'NAME|ACCOUNT_NAME|SALES_STAGE|AMOUNT_USDOLLAR|DATE_CLOSED|ASSIGNED_USER_NAME|DATE_ENTERED', 'hideTabs' => 'OPPORTUNITY_TYPE|LEAD_SOURCE|NEXT_STEP|PROBABILITY|CREATED_BY_NAME|TEAM_NAME|MODIFIED_BY_NAME', 'orderBy' => 'NAME', 'sortOrder' => 'ASC', 'button' => 'Search', 'saved_search_select' => '_none', 'sugar_user_theme' => 'Sugar', 'ModuleBuilder' => 'helpHidden=true', 'Contacts_divs' => 'quotes_v=#', 'sugar_theme_gm_current' => 'All', 'globalLinksOpen' => 'true', 'SQLiteManager_currentLangue' => '2', 'PHPSESSID' => 'b8e4b4b955ef3c4b29291779751b5fca');
$storeQuery->saveFromRequest('Opportunities');
$storedSearch = StoreQuery::getStoredQueryForUser('Opportunities');
$this->assertEquals($storedSearch['start_range_amount_advanced'], 9500.0, 'Assert that start range amount $9,500.00 was saved unformatted as 9500.00');
$this->assertEquals($storedSearch['end_range_amount_advanced'], 45900.0, 'Assert that end range amount $45,900.00 was saved unformatted as 45900.00');
//Test that value is converted to user's numer formatting
unset($_REQUEST['start_range_amount_advanced']);
unset($_REQUEST['end_range_amount_advanced']);
$storeQuery->loadQuery('Opportunities');
$storeQuery->populateRequest();
$this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
$this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9,500.00');
$this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
$this->assertEquals('$45,900.00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45,900.00');
//Now say the user changes his number preferences and switches back to this StoredQuery
$current_user->setPreference('num_grp_sep', '.');
$current_user->setPreference('dec_sep', ',');
$current_user->save();
//Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
get_number_seperators(true);
//Now when we reload this store query, the $_REQUEST array should be populated with new user date preference
unset($_REQUEST['start_range_amount_advanced']);
unset($_REQUEST['end_range_amount_advanced']);
$storeQuery->loadQuery('Opportunities');
$storeQuery->populateRequest();
$this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
$this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value was converted to $9.500,00');
$this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
$this->assertEquals('$45.900,00', $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value was converted to $45.900,00');
//Okay so now what happens if they don't specify currency or separator or decimal values?
$_REQUEST['start_range_amount_advanced'] = 9500;
$_REQUEST['end_range_amount_advanced'] = 45900;
$storeQuery->saveFromRequest('Opportunities');
$storeQuery->loadQuery('Opportunities');
$storeQuery->populateRequest();
$this->assertTrue(isset($_REQUEST['start_range_amount_advanced']), 'Assert that the start_range_amount_advanced field was correctly populated');
$this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], 'Assert that start_range_amount_advanced value remained as is (9500)');
$this->assertTrue(isset($_REQUEST['end_range_amount_advanced']), 'Assert that the end_range_amount_advanced field was correctly populated');
$this->assertEquals(45900, $_REQUEST['end_range_amount_advanced'], 'Assert that end_range_amount_advanced value remained as is (45900)');
}
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:45,代码来源:Bug42915Test.php
示例11: action_massupdate
/**
* Perform the actual massupdate.
*/
protected function action_massupdate()
{
global $app_strings;
if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) {
if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
set_time_limit(0);
//I'm wondering if we will set it never goes timeout here.
// until we have more efficient way of handling MU, we have to disable the limit
$GLOBALS['db']->setQueryLimit(0);
require_once 'modules/MySettings/StoreQuery.php';
$seed = BeanFactory::getBean($_REQUEST['module']);
SugarAutoLoader::requireWithCustom('include/MassUpdate.php');
$massUpdateClass = SugarAutoLoader::customClass('MassUpdate');
$mass = new $massUpdateClass();
$mass->setSugarBean($seed);
if (isset($_REQUEST['entire']) && empty($_POST['mass'])) {
$mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
}
$arr = $mass->handleMassUpdate();
$storeQuery = new StoreQuery();
//restore the current search. to solve bug 24722 for multi tabs massupdate.
$temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']);
if (!empty($_POST['mass'])) {
$total_records = count($_POST['mass']);
$failed_update = count($arr);
$successful_update = $total_records - $failed_update;
if ($successful_update == $total_records) {
//show succesful deletion message if this is a delete update
if (!empty($_REQUEST['Delete'])) {
$massupdate_status = $app_strings['TPL_MASSDELETE_SUCCESS'];
$massupdate_status = str_replace("{{num}}", $successful_update, $massupdate_status);
} else {
//show succesful update message if this is not a delete request
$massupdate_status = $app_strings['LBL_MASS_UPDATE_SUCCESS'];
}
} else {
if (!empty($_REQUEST['Delete'])) {
$massupdate_status = $app_strings['TPL_MASSDELETE_SUCCESS'];
} else {
$massupdate_status = $app_strings['TPL_MASSUPDATE_SUCCESS'];
}
$massupdate_status .= " " . $app_strings['TPL_MASSUPDATE_WARNING_PERMISSION'];
$massupdate_status = str_replace("{{num}}", $successful_update, $massupdate_status);
$massupdate_status = str_replace("{{remain}}", $failed_update, $massupdate_status);
}
$temp_req['updated_records'] = $massupdate_status;
}
if ($_REQUEST['return_module'] == 'Emails') {
if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) {
$this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']);
// Specifically for My Achieves
}
}
$_REQUEST = array();
$_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page']));
unset($_REQUEST[$seed->module_dir . '2_' . strtoupper($seed->object_name) . '_offset']);
//after massupdate, the page should redirect to no offset page
$storeQuery->saveFromRequest($_REQUEST['module']);
$_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action'], 'updated_records' => $temp_req['updated_records']);
//for post_massupdate, to go back to original page.
} else {
sugar_die("You must massupdate at least one record");
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:70,代码来源:SugarController.php
示例12: display
function display()
{
if (!$this->bean->ACLAccess('list')) {
ACLController::displayNoAccess();
return;
}
$module = $GLOBALS['module'];
$metadataFile = SugarAutoLoader::loadWithMetafiles($module, 'listviewdefs');
require_once $metadataFile;
$this->bean->ACLFilterFieldList($listViewDefs[$module], array("owner_override" => true));
$seed = $this->bean;
if (!empty($this->bean->object_name) && isset($_REQUEST[$module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) {
//if you click the pagination button, it will populate the search criteria here
if (!empty($_REQUEST['current_query_by_page'])) {
//The code support multi browser tabs pagination
$blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'request_data', 'current_query_by_page', $module . '2_' . strtoupper($this->bean->object_name) . '_ORDER_BY');
if (isset($_REQUEST['lvso'])) {
$blockVariables[] = 'lvso';
}
$current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page']));
foreach ($current_query_by_page as $search_key => $search_value) {
if ($search_key != $module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) {
if (!is_array($search_value)) {
$_REQUEST[$search_key] = $GLOBALS['db']->quote($search_value);
} else {
foreach ($search_value as $key => &$val) {
$val = $GLOBALS['db']->quote($val);
}
$_REQUEST[$search_key] = $search_value;
}
}
}
}
}
if (!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select'] != '_none') {
if (empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query'] != 'true')) {
$this->saved_search = BeanFactory::getBean('SavedSearch');
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
$this->saved_search->populateRequest();
} elseif (!empty($_REQUEST['button'])) {
// click the search button, after retrieving from saved_search
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
unset($_REQUEST['saved_search_select']);
unset($_REQUEST['saved_search_select_name']);
}
}
$lv = new ListViewSmarty();
$displayColumns = array();
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs[$module][$col])) {
$displayColumns[$col] = $listViewDefs[$module][$col];
}
}
} else {
foreach ($listViewDefs[$module] as $col => $params) {
if (!empty($params['default']) && $params['default']) {
$displayColumns[$col] = $params;
}
}
}
$params = array('massupdate' => true, 'export' => true);
if (!empty($_REQUEST['orderBy'])) {
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if (!empty($_REQUEST['sortOrder'])) {
$params['sortOrder'] = $_REQUEST['sortOrder'];
}
}
$lv->displayColumns = $displayColumns;
$this->seed = $seed;
$this->module = $module;
$searchForm = null;
$storeQuery = new StoreQuery();
if (!isset($_REQUEST['query'])) {
$storeQuery->loadQuery($this->module);
$storeQuery->populateRequest();
} else {
$storeQuery->saveFromRequest($this->module);
}
//search
$view = 'basic_search';
if (!empty($_REQUEST['search_form_view'])) {
$view = $_REQUEST['search_form_view'];
}
$headers = true;
if (!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) {
$headers = false;
} elseif (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$view = 'advanced_search';
} else {
$view = 'basic_search';
}
}
$use_old_search = true;
if (SugarAutoLoader::existing('modules/' . $this->module . '/SearchForm.html')) {
require_once 'include/SearchForm/SearchForm.php';
$searchForm = new SearchForm($this->module, $this->seed);
} else {
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:view.list.php
注:本文中的StoreQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论