All Data Structures Functions Variables Pages
LeadsModule.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 CONVERT_NO_ACCOUNT = 1;
40  const CONVERT_ACCOUNT_NOT_REQUIRED = 2;
41  const CONVERT_ACCOUNT_REQUIRED = 3;
42  const CONVERT_NO_OPPORTUNITY = 4;
43  const CONVERT_OPPORTUNITY_NOT_REQUIRED = 5;
44  const CONVERT_OPPORTUNITY_REQUIRED = 6;
45 
46  const RIGHT_CREATE_LEADS = 'Create Leads';
47  const RIGHT_DELETE_LEADS = 'Delete Leads';
48  const RIGHT_ACCESS_LEADS = 'Access Leads Tab';
49  const RIGHT_CONVERT_LEADS = 'Convert Leads';
50 
51  public function getDependencies()
52  {
53  return array(
54  'accounts',
55  'contacts',
56  'configuration',
57  'zurmo',
58  );
59  }
60 
61  public function getRootModelNames()
62  {
63  return array();
64  }
65 
66  public static function getTranslatedRightsLabels()
67  {
69  $labels = array();
70  $labels[self::RIGHT_CREATE_LEADS] = Zurmo::t('LeadsModule', 'Create LeadsModulePluralLabel', $params);
71  $labels[self::RIGHT_DELETE_LEADS] = Zurmo::t('LeadsModule', 'Delete LeadsModulePluralLabel', $params);
72  $labels[self::RIGHT_ACCESS_LEADS] = Zurmo::t('LeadsModule', 'Access LeadsModulePluralLabel Tab', $params);
73  $labels[self::RIGHT_CONVERT_LEADS] = Zurmo::t('LeadsModule', 'Convert LeadsModulePluralLabel', $params);
74  return $labels;
75  }
76 
77  public static function getDefaultMetadata()
78  {
79  $metadata = array();
80  $metadata['global'] = array(
81  'convertToAccountSetting' => LeadsModule::CONVERT_ACCOUNT_NOT_REQUIRED,
82  'convertToOpportunitySetting' => LeadsModule::CONVERT_OPPORTUNITY_NOT_REQUIRED,
83  'convertToAccountAttributesMapping' => array(
84  'industry' => 'industry',
85  'website' => 'website',
86  'primaryAddress' => 'billingAddress',
87  'secondaryAddress' => 'shippingAddress',
88  'officePhone' => 'officePhone',
89  'officeFax' => 'officeFax',
90  'companyName' => 'name',
91  ),
92  'designerMenuItems' => array(
93  'showFieldsLink' => true,
94  'showGeneralLink' => true,
95  'showLayoutsLink' => true,
96  'showMenusLink' => true,
97  ),
98  'globalSearchAttributeNames' => array(
99  'fullName',
100  'anyEmail',
101  'officePhone',
102  'mobilePhone',
103  'companyName'
104  ),
105  'tabMenuItems' => array(
106  array(
107  'label' => "eval:Zurmo::t('LeadsModule', 'LeadsModulePluralLabel', \$translationParams)",
108  'url' => array('/leads/default'),
109  'right' => self::RIGHT_ACCESS_LEADS,
110  'mobile' => true,
111  ),
112  ),
113  'shortcutsCreateMenuItems' => array(
114  array(
115  'label' => "eval:Zurmo::t('LeadsModule', 'LeadsModuleSingularLabel', \$translationParams)",
116  'url' => array('/leads/default/create'),
117  'right' => self::RIGHT_CREATE_LEADS,
118  'mobile' => true,
119  ),
120  ),
121  );
122  return $metadata;
123  }
124 
125  public static function getPrimaryModelName()
126  {
127  return 'Contact';
128  }
129 
130  public static function getConvertToAccountSetting()
131  {
132  $metadata = LeadsModule::getMetadata();
133  if (isset($metadata['global']['convertToAccountSetting']))
134  {
135  return (int)$metadata['global']['convertToAccountSetting'];
136  }
137  else
138  {
139  return (int)LeadsModule::CONVERT_ACCOUNT_NOT_REQUIRED;
140  }
141  }
142 
143  public static function getConvertToOpportunitySetting()
144  {
145  $metadata = LeadsModule::getMetadata();
146  if (isset($metadata['global']['convertToOpportunitySetting']))
147  {
148  return (int)$metadata['global']['convertToOpportunitySetting'];
149  }
150  else
151  {
152  return (int)LeadsModule::CONVERT_OPPORTUNITY_NOT_REQUIRED;
153  }
154  }
155 
156  public static function getAccessRight()
157  {
158  return self::RIGHT_ACCESS_LEADS;
159  }
160 
161  public static function getCreateRight()
162  {
163  return self::RIGHT_CREATE_LEADS;
164  }
165 
166  public static function getDeleteRight()
167  {
168  return self::RIGHT_DELETE_LEADS;
169  }
170 
171  public static function getDemoDataMakerClassNames()
172  {
173  return array('LeadsDemoDataMaker');
174  }
175 
176  public static function getStateMetadataAdapterClassName()
177  {
178  return 'LeadsStateMetadataAdapter';
179  }
180 
181  public static function getGlobalSearchFormClassName()
182  {
183  return 'LeadsSearchForm';
184  }
185 
186  protected static function getSingularModuleLabel($language)
187  {
188  return Zurmo::t('LeadsModule', 'Lead', array(), null, $language);
189  }
190 
191  protected static function getPluralModuleLabel($language)
192  {
193  return Zurmo::t('LeadsModule', 'Leads', array(), null, $language);
194  }
195  }
196 ?>
static getMetadata(User $user=null)
Definition: Module.php:502
static getTranslationParamsForAllModules()
Definition: LabelUtil.php:75
Generated on Tue Jun 2 2020 07:10:32