39 public static function getDefaultMetadata()
45 array(
'type' =>
'SaveButton',
'renderType' =>
'Edit'),
46 array(
'type' =>
'CancelLink',
'renderType' =>
'Edit'),
47 array(
'type' =>
'EditLink',
'renderType' =>
'Details'),
48 array(
'type' =>
'AuditEventsModalListLink',
'renderType' =>
'Details'),
49 array(
'type' =>
'CopyLink',
'renderType' =>
'Details'),
50 array(
'type' =>
'ContactDeleteLink',
'renderType' =>
'Details'),
53 'derivedAttributeTypes' => array(
55 'ContactStateDropDown',
57 'nonPlaceableAttributeNames' => array(
62 'googleWebTrackingId',
63 'latestActivityDateTime'
65 'panelsDisplayType' => FormLayout::PANELS_DISPLAY_TYPE_ALL,
73 array(
'attributeName' =>
'null',
'type' =>
'TitleFullName'),
82 array(
'attributeName' =>
'null',
'type' =>
'ContactStateDropDown'),
91 array(
'attributeName' =>
'jobTitle',
'type' =>
'Text'),
100 array(
'attributeName' =>
'account',
'type' =>
'Account'),
109 array(
'attributeName' =>
'department',
'type' =>
'Text'),
118 array(
'attributeName' =>
'officePhone',
'type' =>
'Phone'),
127 array(
'attributeName' =>
'source',
'type' =>
'DropDown',
'addBlank' =>
true),
136 array(
'attributeName' =>
'mobilePhone',
'type' =>
'Phone'),
145 array(
'attributeName' =>
'officeFax',
'type' =>
'Phone'),
154 array(
'attributeName' =>
'primaryEmail',
'type' =>
'EmailAddressInformation'),
163 array(
'attributeName' =>
'secondaryEmail',
'type' =>
'EmailAddressInformation'),
172 array(
'attributeName' =>
'primaryAddress',
'type' =>
'Address'),
181 array(
'attributeName' =>
'secondaryAddress',
'type' =>
'Address'),
190 array(
'attributeName' =>
'description',
'type' =>
'TextArea'),
203 protected function renderContent()
205 $this->registerCopyAddressFromAccountScript();
206 $this->registerCopyOfficePhoneAndFaxFromAccountScript();
207 return parent::renderContent();
210 protected function renderAfterFormLayoutForDetailsContent()
212 return ContactDetailsViewUtil::renderAfterFormLayoutForDetailsContent($this->
getModel(), null);
215 protected function getNewModelTitleLabel()
217 return Zurmo::t(
'ContactsModule',
'Create ContactsModuleSingularLabel',
221 protected function registerCopyAddressFromAccountScript()
223 $url = Yii::app()->createUrl(
'contacts/default/getAccountAddressesToCopy');
224 $successScript = null;
225 foreach ($this->model->primaryAddress->getAttributeNames() as $attribute)
227 $successScript .=
"$('#Contact_primaryAddress_" . $attribute .
"').val(data.billingAddress_" . $attribute .
").trigger('change'); \n";
228 $successScript .=
"$('#Contact_secondaryAddress_" . $attribute .
"').val(data.shippingAddress_" . $attribute .
").trigger('change'); \n";
231 Yii::app()->clientScript->registerScript(
'copyAddressFromAccountToContactScript',
"
232 $('#Contact_account_id').live('change', function()
234 if ($('#Contact_account_id').val() &&
235 !$('#Contact_primaryAddress_street1').val() &&
236 !$('#Contact_primaryAddress_street2').val() &&
237 !$('#Contact_primaryAddress_city').val() &&
238 !$('#Contact_primaryAddress_state').val() &&
239 !$('#Contact_primaryAddress_postalCode').val() &&
240 !$('#Contact_primaryAddress_country').val() &&
241 !$('#Contact_secondaryAddress_street1').val() &&
242 !$('#Contact_secondaryAddress_street2').val() &&
243 !$('#Contact_secondaryAddress_city').val() &&
244 !$('#Contact_secondaryAddress_state').val() &&
245 !$('#Contact_secondaryAddress_postalCode').val() &&
246 !$('#Contact_secondaryAddress_country').val())
250 url : '" . $url .
"?id=' + $('#Contact_account_id').val(),
253 success : function(data)
255 " . $successScript .
"
270 protected function registerCopyOfficePhoneAndFaxFromAccountScript()
272 $url = Yii::app()->createUrl(
'contacts/default/getAccountOfficePhoneAndFaxToCopy');
274 Yii::app()->clientScript->registerScript(
'copyOfficePhoneAndFaxFromAccountScript',
"
275 $('#Contact_account_id').live('change', function()
277 if ($('#Contact_account_id').val() &&
278 !$('#Contact_officeFax').val() &&
279 !$('#Contact_officePhone').val())
283 url : '" . $url .
"?id=' + $('#Contact_account_id').val(),
286 success : function(data)
288 $('#Contact_officePhone').val(data.officePhone).trigger('change');
289 $('#Contact_officeFax').val(data.officeFax).trigger('change');
304 public static function getDesignerRulesType()
306 return 'DetailsViewOnlyForUserOwnerEditAndDetailsView';
static getTranslationParamsForAllModules()