Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ContactsModule.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_CONTACTS = 'Create Contacts';
40  const RIGHT_DELETE_CONTACTS = 'Delete Contacts';
41  const RIGHT_ACCESS_CONTACTS = 'Access Contacts 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('Contact');
54  }
55 
56  public static function getTranslatedRightsLabels()
57  {
59  $labels = array();
60  $labels[self::RIGHT_CREATE_CONTACTS] = Zurmo::t('ContactsModule', 'Create ContactsModulePluralLabel', $params);
61  $labels[self::RIGHT_DELETE_CONTACTS] = Zurmo::t('ContactsModule', 'Delete ContactsModulePluralLabel', $params);
62  $labels[self::RIGHT_ACCESS_CONTACTS] = Zurmo::t('ContactsModule', 'Access ContactsModulePluralLabel 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  'fullName',
78  'anyEmail',
79  'officePhone',
80  'mobilePhone',
81  ),
82  'startingState' => 1,
83  'tabMenuItems' => array(
84  array(
85  'label' => "eval:Zurmo::t('ContactsModule', 'ContactsModulePluralLabel', \$translationParams)",
86  'url' => array('/contacts/default'),
87  'right' => self::RIGHT_ACCESS_CONTACTS,
88  'mobile' => true,
89  ),
90  ),
91  'shortcutsCreateMenuItems' => array(
92  array(
93  'label' => "eval:Zurmo::t('ContactsModule', 'ContactsModuleSingularLabel', \$translationParams)",
94  'url' => array('/contacts/default/create'),
95  'right' => self::RIGHT_CREATE_CONTACTS,
96  'mobile' => true,
97  ),
98  ),
99  'updateLatestActivityDateTimeWhenATaskIsCompleted' => true,
100  'updateLatestActivityDateTimeWhenANoteIsCreated' => true,
101  'updateLatestActivityDateTimeWhenAnEmailIsSentOrArchived' => true,
102  'updateLatestActivityDateTimeWhenAMeetingIsInThePast' => true,
103  );
104  return $metadata;
105  }
106 
107  public static function getPrimaryModelName()
108  {
109  return 'Contact';
110  }
111 
117  public static function loadStartingData()
118  {
119  if (count(ContactState::GetAll()) != 0)
120  {
121  return false;
122  }
123  $data = array(
124  Zurmo::t('Core', 'New'),
125  Zurmo::t('Core', 'In Progress'),
126  Zurmo::t('ContactsModule', 'Recycled'),
127  Zurmo::t('ContactsModule', 'Dead'),
128  Zurmo::t('ContactsModule', 'Qualified'),
129  Zurmo::t('ZurmoModule', 'Customer')
130  );
131  $order = 0;
132  $startingStateId = null;
133  foreach ($data as $stateName)
134  {
135  $state = new ContactState();
136  $state->name = $stateName;
137  $state->order = $order;
138  $saved = $state->save();
139  assert('$saved');
140  if ($stateName == Zurmo::t('ContactsModule', 'Qualified'))
141  {
142  $startingStateId = $state->id;
143  }
144  $order++;
145  }
146  if ($startingStateId == null)
147  {
148  throw new NotSupportedException();
149  }
150  $metadata = ContactsModule::getMetadata();
151  $metadata['global']['startingStateId'] = $startingStateId;
152  ContactsModule::setMetadata($metadata);
153  assert('count(ContactState::GetAll()) == 6');
154  return true;
155  }
156 
157  public static function getAccessRight()
158  {
159  return self::RIGHT_ACCESS_CONTACTS;
160  }
161 
162  public static function getCreateRight()
163  {
164  return self::RIGHT_CREATE_CONTACTS;
165  }
166 
167  public static function getDeleteRight()
168  {
169  return self::RIGHT_DELETE_CONTACTS;
170  }
171 
175  public static function getSecurableModuleDisplayName()
176  {
177  $label = static::getModuleLabelByTypeAndLanguage('Plural') . '&#160;&#38;&#160;' .
178  LeadsModule::getModuleLabelByTypeAndLanguage('Plural');
179  return $label;
180  }
181 
182  public static function getDefaultDataMakerClassName()
183  {
184  return 'ContactsDefaultDataMaker';
185  }
186 
187  public static function getDemoDataMakerClassNames()
188  {
189  return array('ContactsDemoDataMaker');
190  }
191 
192  public static function getStateMetadataAdapterClassName()
193  {
194  return 'ContactsStateMetadataAdapter';
195  }
196 
197  public static function getGlobalSearchFormClassName()
198  {
199  return 'ContactsSearchForm';
200  }
201 
202  public static function hasPermissions()
203  {
204  return true;
205  }
206 
207  public static function isReportable()
208  {
209  return true;
210  }
211 
212  public static function canHaveWorkflow()
213  {
214  return true;
215  }
216 
217  public static function canHaveContentTemplates()
218  {
219  return true;
220  }
221 
222  protected static function getSingularModuleLabel($language)
223  {
224  return Zurmo::t('ContactsModule', 'Contact', array(), null, $language);
225  }
226 
227  protected static function getPluralModuleLabel($language)
228  {
229  return Zurmo::t('ContactsModule', 'Contacts', array(), null, $language);
230  }
231 
232  public static function shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted()
233  {
234  $metadata = static::getMetadata();
235  if (isset($metadata['global']['updateLatestActivityDateTimeWhenATaskIsCompleted']))
236  {
237  return (bool) $metadata['global']['updateLatestActivityDateTimeWhenATaskIsCompleted'];
238  }
239  return false;
240  }
241 
242  public static function shouldUpdateLatestActivityDateTimeWhenANoteIsCreated()
243  {
244  $metadata = static::getMetadata();
245  if (isset($metadata['global']['updateLatestActivityDateTimeWhenANoteIsCreated']))
246  {
247  return (bool) $metadata['global']['updateLatestActivityDateTimeWhenANoteIsCreated'];
248  }
249  return false;
250  }
251 
252  public static function shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived()
253  {
254  $metadata = static::getMetadata();
255  if (isset($metadata['global']['updateLatestActivityDateTimeWhenAnEmailIsSentOrArchived']))
256  {
257  return (bool) $metadata['global']['updateLatestActivityDateTimeWhenAnEmailIsSentOrArchived'];
258  }
259  return false;
260  }
261 
262  public static function shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast()
263  {
264  $metadata = static::getMetadata();
265  if (isset($metadata['global']['updateLatestActivityDateTimeWhenAMeetingIsInThePast']))
266  {
267  return (bool) $metadata['global']['updateLatestActivityDateTimeWhenAMeetingIsInThePast'];
268  }
269  return false;
270  }
271  }
272 ?>
static getMetadata(User $user=null)
Definition: Module.php:502
static getTranslationParamsForAllModules()
Definition: LabelUtil.php:75
static loadStartingData()
static setMetadata(array $metadata, User $user=null)
Definition: Module.php:533
static getSecurableModuleDisplayName()
Generated on Tue Jul 7 2020 07:10:31
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.