2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
38 require_once 'tests/service/SOAPTestCase.php';
40 class Bug51617Test extends SOAPTestCase
44 public function setUp()
46 $this->_soapURL = $GLOBALS['sugar_config']['site_url'].'/service/v2/soap.php';
50 require('include/modules.php');
51 $GLOBALS['beanList'] = $beanList;
52 $GLOBALS['beanFiles'] = $beanFiles;
53 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
54 $GLOBALS['current_user']->status = 'Active';
55 $GLOBALS['current_user']->is_admin = 1;
56 $GLOBALS['current_user']->save();
58 $this->field = get_widget('varchar');
59 $this->field->id = 'Accountstest_custom_c';
60 $this->field->name = 'test_custom_c';
61 $this->field->vanme = 'LBL_TEST_CUSTOM_C';
62 $this->field->comments = NULL;
63 $this->field->help = NULL;
64 $this->field->custom_module = 'Accounts';
65 $this->field->type = 'varchar';
66 $this->field->label = 'LBL_TEST_CUSTOM_C';
67 $this->field->len = 255;
68 $this->field->required = 0;
69 $this->field->default_value = NULL;
70 $this->field->date_modified = '2009-09-14 02:23:23';
71 $this->field->deleted = 0;
72 $this->field->audited = 0;
73 $this->field->massupdate = 0;
74 $this->field->duplicate_merge = 0;
75 $this->field->reportable = 1;
76 $this->field->importable = 'true';
77 $this->field->ext1 = NULL;
78 $this->field->ext2 = NULL;
79 $this->field->ext3 = NULL;
80 $this->field->ext4 = NULL;
82 $this->df = new DynamicField('Accounts');
83 $this->mod = new Account();
84 $this->df->setup($this->mod);
85 $this->df->addFieldObject($this->field);
86 $this->df->buildCache('Accounts');
87 VardefManager::clearVardef();
88 VardefManager::refreshVardefs('Accounts', 'Account');
89 $this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields'];
91 $this->_account = SugarTestAccountUtilities::createAccount();
93 $this->_account->test_custom_c = 'Custom Field';
94 $this->_account->save();
96 $GLOBALS['db']->commit(); // Making sure we commit any changes
101 public function tearDown()
103 $this->df->deleteField($this->field);
105 SugarTestAccountUtilities::removeAllCreatedAccounts();
107 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
108 unset($GLOBALS['current_user']);
112 global $soap_version_test_accountId, $soap_version_test_opportunityId, $soap_version_test_contactId;
113 unset($soap_version_test_accountId);
114 unset($soap_version_test_opportunityId);
115 unset($soap_version_test_contactId);
116 unset($GLOBALS['beanFiles']);
117 unset($GLOBALS['beanList']);
120 public function testGetEntryListWithCustomField()
123 $result = $this->_soapClient->call('get_entry_list',
125 'session'=>$this->_sessionId,
126 "module_name" => 'Accounts',
130 "select_fields" => array('id', 'name', 'test_custom_c'),
136 $this->assertTrue($result['result_count'] > 0,
137 'Get_entry_list failed: Fault code: '.$this->_soapClient->faultcode.', fault string:'.$this->_soapClient->faultstring.', fault detail: '.$this->_soapClient->faultdetail);
140 $row = $result['entry_list'][0]['name_value_list'];
142 // find the custom field
145 foreach($row as $r) {
146 // just make sure they are all not empty
147 $this->assertNotEmpty($r['value']);
148 // make sure that the test field has our value in it
149 if($r['name'] == "test_custom_c") {
150 $this->assertEquals("Custom Field", $r['value']);