All Data Structures Functions Variables Pages
OpportunitiesModule.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo 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 ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo 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
16  * details.
17  *
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
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified 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.
29  *
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 Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
38  {
39  const RIGHT_CREATE_OPPORTUNITIES = 'Create Opportunities';
40  const RIGHT_DELETE_OPPORTUNITIES = 'Delete Opportunities';
41  const RIGHT_ACCESS_OPPORTUNITIES = 'Access Opportunities Tab';
42 
43  public function getDependencies()
44  {
45  return array(
46  'configuration',
47  'zurmo',
48  );
49  }
50 
51  public function getRootModelNames()
52  {
53  return array('Opportunity');
54  }
55 
56  public static function getTranslatedRightsLabels()
57  {
59  $labels = array();
60  $labels[self::RIGHT_CREATE_OPPORTUNITIES] = Zurmo::t('OpportunitiesModule', 'Create OpportunitiesModulePluralLabel', $params);
61  $labels[self::RIGHT_DELETE_OPPORTUNITIES] = Zurmo::t('OpportunitiesModule', 'Delete OpportunitiesModulePluralLabel', $params);
62  $labels[self::RIGHT_ACCESS_OPPORTUNITIES] = Zurmo::t('OpportunitiesModule', 'Access OpportunitiesModulePluralLabel Tab', $params);
63  return $labels;
64  }
65 
66  public static function getDefaultMetadata()
67  {
68  $metadata = array();
69  $metadata['global'] = array(
70  'designerMenuItems' => array(
71  'showFieldsLink' => true,
72  'showGeneralLink' => true,
73  'showLayoutsLink' => true,
74  'showMenusLink' => true,
75  ),
76  'globalSearchAttributeNames' => array(
77  'name'
78  ),
79  'stageToProbabilityMapping' => array(
80  'Prospecting' => 10,
81  'Qualification' => 25,
82  'Negotiating' => 50,
83  'Verbal' => 75,
84  'Closed Won' => 100,
85  'Closed Lost' => 0,
86  ),
87  'automaticProbabilityMappingDisabled' => false,
88  'stageToRottingMapping' => array(
89  'Prospecting' => 0,
90  'Qualification' => 0,
91  'Negotiating' => 0,
92  'Verbal' => 0,
93  'Closed Won' => 0,
94  'Closed Lost' => 0,
95  ),
96  'opportunityRottingMappingEnabled' => false,
97  'tabMenuItems' => array(
98  array(
99  'label' => "eval:Zurmo::t('OpportunitiesModule', 'OpportunitiesModulePluralLabel', \$translationParams)",
100  'url' => array('/opportunities/default'),
101  'right' => self::RIGHT_ACCESS_OPPORTUNITIES,
102  'mobile' => true,
103  ),
104  ),
105  'shortcutsCreateMenuItems' => array(
106  array(
107  'label' => "eval:Zurmo::t('OpportunitiesModule', 'OpportunitiesModuleSingularLabel', \$translationParams)",
108  'url' => array('/opportunities/default/create'),
109  'right' => self::RIGHT_CREATE_OPPORTUNITIES,
110  'mobile' => true,
111  ),
112  ),
113  );
114  return $metadata;
115  }
116 
117  public static function getPrimaryModelName()
118  {
119  return 'Opportunity';
120  }
121 
122  public static function getSingularCamelCasedName()
123  {
124  return 'Opportunity';
125  }
126 
127  protected static function getSingularModuleLabel($language)
128  {
129  return Zurmo::t('OpportunitiesModule', 'Opportunity', array(), null, $language);
130  }
131 
132  protected static function getPluralModuleLabel($language)
133  {
134  return Zurmo::t('OpportunitiesModule', 'Opportunities', array(), null, $language);
135  }
136 
137  public static function getAccessRight()
138  {
139  return self::RIGHT_ACCESS_OPPORTUNITIES;
140  }
141 
142  public static function getCreateRight()
143  {
144  return self::RIGHT_CREATE_OPPORTUNITIES;
145  }
146 
147  public static function getDeleteRight()
148  {
149  return self::RIGHT_DELETE_OPPORTUNITIES;
150  }
151 
152  public static function getDefaultDataMakerClassName()
153  {
154  return 'OpportunitiesDefaultDataMaker';
155  }
156 
157  public static function getDemoDataMakerClassNames()
158  {
159  return array('OpportunitiesDemoDataMaker');
160  }
161 
162  public static function getGlobalSearchFormClassName()
163  {
164  return 'OpportunitiesSearchForm';
165  }
166 
167  public static function hasPermissions()
168  {
169  return true;
170  }
171 
172  public static function isReportable()
173  {
174  return true;
175  }
176 
177  public static function canHaveWorkflow()
178  {
179  return true;
180  }
181 
182  public static function canHaveContentTemplates()
183  {
184  return true;
185  }
186 
187  public static function getStageToProbabilityMappingData()
188  {
189  $metadata = static::getMetadata();
190  if (isset($metadata['global']['stageToProbabilityMapping']))
191  {
192  return $metadata['global']['stageToProbabilityMapping'];
193  }
194  return array();
195  }
196 
201  public static function getProbabilityByStageValue($value)
202  {
203  assert('is_string($value) || $value == null');
204  $stageToProbabilityMapping = self::getStageToProbabilityMappingData();
205  if (isset($stageToProbabilityMapping[$value]))
206  {
207  return $stageToProbabilityMapping[$value];
208  }
209  return 0;
210  }
211 
212  public static function isAutomaticProbabilityMappingDisabled()
213  {
214  $metadata = static::getMetadata();
215  if (isset($metadata['global']['automaticProbabilityMappingDisabled']))
216  {
217  return (bool) $metadata['global']['automaticProbabilityMappingDisabled'];
218  }
219  return false;
220  }
221 
222  public static function getStageToRottingMappingData()
223  {
224  $metadata = static::getMetadata();
225  if (isset($metadata['global']['stageToRottingMapping']))
226  {
227  return $metadata['global']['stageToRottingMapping'];
228  }
229  return array();
230  }
231 
236  public static function getRottingByStageValue($value)
237  {
238  assert('is_string($value) || $value == null');
239  $stageToRottingMapping = self::getStageToRottingMappingData();
240  if (isset($stageToRottingMapping[$value]))
241  {
242  return $stageToRottingMapping[$value];
243  }
244  return 0;
245  }
246 
247  public static function isRottingMappingEnabled()
248  {
249  $metadata = static::getMetadata();
250  if (isset($metadata['global']['opportunityRottingMappingEnabled']))
251  {
252  return (bool) $metadata['global']['opportunityRottingMappingEnabled'];
253  }
254  return false;
255  }
256  }
257 ?>
static getTranslationParamsForAllModules()
Definition: LabelUtil.php:75
static getProbabilityByStageValue($value)
static getRottingByStageValue($value)
Generated on Tue Apr 7 2020 07:10:44