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


PHP StoreQuery::getStoredQueryForUser方法代码示例

本文整理汇总了PHP中StoreQuery::getStoredQueryForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP StoreQuery::getStoredQueryForUser方法的具体用法?PHP StoreQuery::getStoredQueryForUser怎么用?PHP StoreQuery::getStoredQueryForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StoreQuery的用法示例。


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

示例1: 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

示例2: 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

示例3: testGetStoredQuery

 function testGetStoredQuery()
 {
     $query = StoreQuery::getStoredQueryForUser("Contacts");
     $this->assertTrue(empty($query), "StoreQuery::getStoredQueryForUser is not empty.");
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:5,代码来源:StoreQueryTest.php

示例4: 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


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