PageRenderTime 63ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/modules/Opportunities/vardefs.php

https://github.com/lukio/sugarcrm_dev
PHP | 436 lines | 390 code | 8 blank | 38 comment | 2 complexity | d8e5afe13fbbe921dda33706536f9df3 MD5 | raw file
  1. <?php
  2. if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
  3. /*********************************************************************************
  4. * SugarCRM Community Edition is a customer relationship management program developed by
  5. * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it under
  8. * the terms of the GNU Affero General Public License version 3 as published by the
  9. * Free Software Foundation with the addition of the following permission added
  10. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  11. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  12. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License along with
  20. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  21. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22. * 02110-1301 USA.
  23. *
  24. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  25. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  26. *
  27. * The interactive user interfaces in modified source and object code versions
  28. * of this program must display Appropriate Legal Notices, as required under
  29. * Section 5 of the GNU Affero General Public License version 3.
  30. *
  31. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  32. * these Appropriate Legal Notices must retain the display of the "Powered by
  33. * SugarCRM" logo. If the display of the logo is not reasonably feasible for
  34. * technical reasons, the Appropriate Legal Notices must display the words
  35. * "Powered by SugarCRM".
  36. ********************************************************************************/
  37. $dictionary['Opportunity'] = array('table' => 'opportunities','audited'=>true, 'unified_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true,
  38. 'comment' => 'An opportunity is the target of selling activities',
  39. 'fields' => array (
  40. 'name' =>
  41. array (
  42. 'name' => 'name',
  43. 'vname' => 'LBL_OPPORTUNITY_NAME',
  44. 'type' => 'name',
  45. 'dbType' => 'varchar',
  46. 'len' => '50',
  47. 'unified_search' => true,
  48. 'comment' => 'Name of the opportunity',
  49. 'merge_filter' => 'selected',
  50. 'importable' => 'required',
  51. 'required' => true,
  52. ),
  53. 'opportunity_type' =>
  54. array (
  55. 'name' => 'opportunity_type',
  56. 'vname' => 'LBL_TYPE',
  57. 'type' => 'enum',
  58. 'options'=> 'opportunity_type_dom',
  59. 'len' => '255',
  60. 'audited'=>true,
  61. 'comment' => 'Type of opportunity (ex: Existing, New)',
  62. 'merge_filter' => 'enabled',
  63. ),
  64. 'account_name' =>
  65. array (
  66. 'name' => 'account_name',
  67. 'rname' => 'name',
  68. 'id_name' => 'account_id',
  69. 'vname' => 'LBL_ACCOUNT_NAME',
  70. 'type' => 'relate',
  71. 'table' => 'accounts',
  72. 'join_name'=>'accounts',
  73. 'isnull' => 'true',
  74. 'module' => 'Accounts',
  75. 'dbType' => 'varchar',
  76. 'link'=>'accounts',
  77. 'len' => '255',
  78. 'source'=>'non-db',
  79. 'unified_search' => true,
  80. 'required' => true,
  81. 'importable' => 'required',
  82. 'required' => true,
  83. ),
  84. 'account_id' =>
  85. array (
  86. 'name' => 'account_id',
  87. 'vname' => 'LBL_ACCOUNT_ID',
  88. 'type' => 'id',
  89. 'source'=>'non-db',
  90. 'audited'=>true,
  91. ),
  92. 'campaign_id' =>
  93. array (
  94. 'name' => 'campaign_id',
  95. 'comment' => 'Campaign that generated lead',
  96. 'vname'=>'LBL_CAMPAIGN_ID',
  97. 'rname' => 'id',
  98. 'type' => 'id',
  99. 'dbType'=>'id',
  100. 'table' => 'campaigns',
  101. 'isnull' => 'true',
  102. 'module' => 'Campaigns',
  103. //'dbType' => 'char',
  104. 'reportable'=>false,
  105. 'massupdate' => false,
  106. 'duplicate_merge'=> 'disabled',
  107. ),
  108. 'campaign_name'=>
  109. array(
  110. 'name'=>'campaign_name',
  111. 'rname'=>'name',
  112. 'id_name'=>'campaign_id',
  113. 'vname'=>'LBL_CAMPAIGN',
  114. 'type'=>'relate',
  115. 'link' => 'campaign_opportunities',
  116. 'isnull'=>'true',
  117. 'table' => 'campaigns',
  118. 'module'=>'Campaigns',
  119. 'source' => 'non-db',
  120. ),
  121. 'campaign_opportunities' =>
  122. array (
  123. 'name' => 'campaign_opportunities',
  124. 'type' => 'link',
  125. 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
  126. 'relationship' => 'campaign_opportunities',
  127. 'source' => 'non-db',
  128. ),
  129. 'lead_source' =>
  130. array (
  131. 'name' => 'lead_source',
  132. 'vname' => 'LBL_LEAD_SOURCE',
  133. 'type' => 'enum',
  134. 'options' => 'lead_source_dom',
  135. 'len' => '50',
  136. 'comment' => 'Source of the opportunity',
  137. 'merge_filter' => 'enabled',
  138. ),
  139. 'amount' =>
  140. array (
  141. 'name' => 'amount',
  142. 'vname' => 'LBL_AMOUNT',
  143. //'function'=>array('vname'=>'getCurrencyType'),
  144. 'type' => 'currency',
  145. // 'disable_num_format' => true,
  146. 'dbType' => 'double',
  147. 'comment' => 'Unconverted amount of the opportunity',
  148. 'importable' => 'required',
  149. 'duplicate_merge'=>'1',
  150. 'required' => true,
  151. 'options' => 'numeric_range_search_dom',
  152. 'enable_range_search' => true,
  153. ),
  154. 'amount_usdollar' =>
  155. array (
  156. 'name' => 'amount_usdollar',
  157. 'vname' => 'LBL_AMOUNT_USDOLLAR',
  158. 'type' => 'currency',
  159. 'group'=>'amount',
  160. 'dbType' => 'double',
  161. 'disable_num_format' => true,
  162. 'duplicate_merge'=>'0',
  163. 'audited'=>true,
  164. 'comment' => 'Formatted amount of the opportunity',
  165. ),
  166. 'currency_id' =>
  167. array (
  168. 'name' => 'currency_id',
  169. 'type' => 'id',
  170. 'group'=>'currency_id',
  171. 'vname' => 'LBL_CURRENCY',
  172. 'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
  173. 'reportable'=>false,
  174. 'comment' => 'Currency used for display purposes'
  175. ),
  176. 'currency_name'=>
  177. array(
  178. 'name'=>'currency_name',
  179. 'rname'=>'name',
  180. 'id_name'=>'currency_id',
  181. 'vname'=>'LBL_CURRENCY_NAME',
  182. 'type'=>'relate',
  183. 'isnull'=>'true',
  184. 'table' => 'currencies',
  185. 'module'=>'Currencies',
  186. 'source' => 'non-db',
  187. 'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
  188. 'studio' => 'false',
  189. 'duplicate_merge' => 'disabled',
  190. ),
  191. 'currency_symbol'=>
  192. array(
  193. 'name'=>'currency_symbol',
  194. 'rname'=>'symbol',
  195. 'id_name'=>'currency_id',
  196. 'vname'=>'LBL_CURRENCY_SYMBOL',
  197. 'type'=>'relate',
  198. 'isnull'=>'true',
  199. 'table' => 'currencies',
  200. 'module'=>'Currencies',
  201. 'source' => 'non-db',
  202. 'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
  203. 'studio' => 'false',
  204. 'duplicate_merge' => 'disabled',
  205. ),
  206. 'date_closed' =>
  207. array (
  208. 'name' => 'date_closed',
  209. 'vname' => 'LBL_DATE_CLOSED',
  210. 'type' => 'date',
  211. 'audited'=>true,
  212. 'comment' => 'Expected or actual date the oppportunity will close',
  213. 'importable' => 'required',
  214. 'required' => true,
  215. 'enable_range_search' => true,
  216. 'options' => 'date_range_search_dom',
  217. ),
  218. 'next_step' =>
  219. array (
  220. 'name' => 'next_step',
  221. 'vname' => 'LBL_NEXT_STEP',
  222. 'type' => 'varchar',
  223. 'len' => '100',
  224. 'comment' => 'The next step in the sales process',
  225. 'merge_filter' => 'enabled',
  226. ),
  227. 'sales_stage' =>
  228. array (
  229. 'name' => 'sales_stage',
  230. 'vname' => 'LBL_SALES_STAGE',
  231. 'type' => 'enum',
  232. 'options' => 'sales_stage_dom',
  233. 'len' => '255',
  234. 'audited'=>true,
  235. 'comment' => 'Indication of progression towards closure',
  236. 'merge_filter' => 'enabled',
  237. 'importable' => 'required',
  238. 'required' => true,
  239. ),
  240. 'probability' =>
  241. array (
  242. 'name' => 'probability',
  243. 'vname' => 'LBL_PROBABILITY',
  244. 'type' => 'int',
  245. 'dbType' => 'double',
  246. 'audited'=>true,
  247. 'comment' => 'The probability of closure',
  248. 'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
  249. 'merge_filter' => 'enabled',
  250. ),
  251. 'accounts' =>
  252. array (
  253. 'name' => 'accounts',
  254. 'type' => 'link',
  255. 'relationship' => 'accounts_opportunities',
  256. 'source'=>'non-db',
  257. 'link_type'=>'one',
  258. 'module'=>'Accounts',
  259. 'bean_name'=>'Account',
  260. 'vname'=>'LBL_ACCOUNTS',
  261. ),
  262. 'contacts' =>
  263. array (
  264. 'name' => 'contacts',
  265. 'type' => 'link',
  266. 'relationship' => 'opportunities_contacts',
  267. 'source'=>'non-db',
  268. 'module'=>'Contacts',
  269. 'bean_name'=>'Contact',
  270. 'rel_fields'=>array('contact_role'=>array('type'=>'enum', 'options'=>'opportunity_relationship_type_dom')),
  271. 'vname'=>'LBL_CONTACTS',
  272. ),
  273. 'tasks' =>
  274. array (
  275. 'name' => 'tasks',
  276. 'type' => 'link',
  277. 'relationship' => 'opportunity_tasks',
  278. 'source'=>'non-db',
  279. 'vname'=>'LBL_TASKS',
  280. ),
  281. 'notes' =>
  282. array (
  283. 'name' => 'notes',
  284. 'type' => 'link',
  285. 'relationship' => 'opportunity_notes',
  286. 'source'=>'non-db',
  287. 'vname'=>'LBL_NOTES',
  288. ),
  289. 'meetings' =>
  290. array (
  291. 'name' => 'meetings',
  292. 'type' => 'link',
  293. 'relationship' => 'opportunity_meetings',
  294. 'source'=>'non-db',
  295. 'vname'=>'LBL_MEETINGS',
  296. ),
  297. 'calls' =>
  298. array (
  299. 'name' => 'calls',
  300. 'type' => 'link',
  301. 'relationship' => 'opportunity_calls',
  302. 'source'=>'non-db',
  303. 'vname'=>'LBL_CALLS',
  304. ),
  305. 'emails' =>
  306. array (
  307. 'name' => 'emails',
  308. 'type' => 'link',
  309. 'relationship' => 'emails_opportunities_rel',/* reldef in emails */
  310. 'source'=>'non-db',
  311. 'vname'=>'LBL_EMAILS',
  312. ),
  313. 'documents'=>
  314. array (
  315. 'name' => 'documents',
  316. 'type' => 'link',
  317. 'relationship' => 'documents_opportunities',
  318. 'source' => 'non-db',
  319. 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
  320. ),
  321. 'project' =>
  322. array (
  323. 'name' => 'project',
  324. 'type' => 'link',
  325. 'relationship' => 'projects_opportunities',
  326. 'source'=>'non-db',
  327. 'vname'=>'LBL_PROJECTS',
  328. ),
  329. 'leads' =>
  330. array (
  331. 'name' => 'leads',
  332. 'type' => 'link',
  333. 'relationship' => 'opportunity_leads',
  334. 'source'=>'non-db',
  335. 'vname'=>'LBL_LEADS',
  336. ),
  337. 'campaigns' =>
  338. array (
  339. 'name' => 'campaigns',
  340. 'type' => 'link',
  341. 'relationship' => 'opportunities_campaign',
  342. 'module'=>'CampaignLog',
  343. 'bean_name'=>'CampaignLog',
  344. 'source'=>'non-db',
  345. 'vname'=>'LBL_CAMPAIGNS',
  346. ),
  347. 'campaign_link' =>
  348. array (
  349. 'name' => 'campaign_link',
  350. 'type' => 'link',
  351. 'relationship' => 'opportunities_campaign',
  352. 'vname' => 'LBL_CAMPAIGNS',
  353. 'link_type' => 'one',
  354. 'module'=>'Campaigns',
  355. 'bean_name'=>'Campaign',
  356. 'source'=>'non-db',
  357. ),
  358. 'currencies' =>
  359. array (
  360. 'name' => 'currencies',
  361. 'type' => 'link',
  362. 'relationship' => 'opportunity_currencies',
  363. 'source'=>'non-db',
  364. 'vname'=>'LBL_CURRENCIES',
  365. ),
  366. ),
  367. 'indices' => array (
  368. array(
  369. 'name' => 'idx_opp_name',
  370. 'type' => 'index',
  371. 'fields' => array('name'),
  372. ),
  373. array(
  374. 'name' => 'idx_opp_assigned',
  375. 'type' => 'index',
  376. 'fields' => array('assigned_user_id'),
  377. ),
  378. ),
  379. 'relationships' => array (
  380. 'opportunity_calls' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  381. 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
  382. 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
  383. 'relationship_role_column_value'=>'Opportunities')
  384. ,'opportunity_meetings' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  385. 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
  386. 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
  387. 'relationship_role_column_value'=>'Opportunities')
  388. ,'opportunity_tasks' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  389. 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
  390. 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
  391. 'relationship_role_column_value'=>'Opportunities')
  392. ,'opportunity_notes' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  393. 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
  394. 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
  395. 'relationship_role_column_value'=>'Opportunities')
  396. ,'opportunity_emails' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  397. 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
  398. 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
  399. 'relationship_role_column_value'=>'Opportunities')
  400. ,'opportunity_leads' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
  401. 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'opportunity_id',
  402. 'relationship_type'=>'one-to-many')
  403. ,'opportunity_currencies' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'currency_id',
  404. 'rhs_module'=> 'Currencies', 'rhs_table'=> 'currencies', 'rhs_key' => 'id',
  405. 'relationship_type'=>'one-to-many')
  406. ,'opportunities_assigned_user' =>
  407. array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
  408. 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'assigned_user_id',
  409. 'relationship_type'=>'one-to-many')
  410. ,'opportunities_modified_user' =>
  411. array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
  412. 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'modified_user_id',
  413. 'relationship_type'=>'one-to-many')
  414. ,'opportunities_created_by' =>
  415. array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
  416. 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'created_by',
  417. 'relationship_type'=>'one-to-many'),
  418. 'opportunities_campaign' =>
  419. array('lhs_module'=> 'campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
  420. 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
  421. 'relationship_type'=>'one-to-many'),
  422. )
  423. //This enables optimistic locking for Saves From EditView
  424. ,'optimistic_locking'=>true,
  425. );
  426. VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',
  427. ));
  428. ?>