Hi, how do I add a column for âDistrictâ in the address column for billing and shipping? Anyone can help?
You can look at this post Here
I have tried but not working.
Which module do you want to create this column?
Letâs go to the new Manual
Iâm going to assume that the module is accounts
1Âș - Go to the folder ââŠ\custom\Extension\modules\Accounts\Extâ
2Âș - Verify that a folder called âVardefsâ already exists
3Âș - If it does not exist, create this folder
4Âș - Within this folder create a file called âbilling_address_district.phpâ
5Âș - In the file place the following code
<?php
$dictionary['Account']['fields']['billing_address_district'] =
array (
'required' => false,
'name' => 'billing_address_district',
'vname' => 'LBL_BILLING_ADDRESS_DISTRICT',
'type' => 'varchar',
'massupdate' => 0,
'no_default' => false,
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => false,
'reportable' => true,
'unified_search' => false,
'merge_filter' => 'disabled',
'len' => '100',
'size' => '20',
'dbType' => 'varchar',
'inline_edit' => '1',
);
6Âș - Save and close the file
7Âș - Verify that a folder called âLanguageâ already exists
8Âș - If it does not exist, create this folder
9Âș - Within this folder create a file called âen_us.billing_address_district.phpâ
10Âș - In the file place the following code
<?php
$mod_strings['LBL_BILLING_ADDRESS_DISTRICT'] = 'Billing Address District:';
11Âș - Save and close the file
12Âș - Now in SuiteCrm go to Admin -> Repair -> Quick Repair and Rebuild and execute the SQL changes
13Âș - Afterwards go to Studio -> Select Accounts -> Fields
14Âș - In This moment you can see that field there
15Âș - Now we need change other files to show this field in Account module
16Âș - Go to ââŠ\include\SugarFields\Fields\Addressâ
17Âș - Change the file âEditView.tplâ
18Âș - Search for the line with the content
{{assign var="street" value=$displayParams.key|cat:'_address_street'}}
19Âș - Below it, place the following code
{{assign var="district" value=$displayParams.key|cat:'_address_district'}}
20Âș - Below in the file you can see that there is a table where the fields are located, choose the position where you want the district field to be and add the following code
<tr>
<td id="{{$district}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
<label for='{{$district}}'>{sugar_translate label='LBL_ADDRESS_DISTRICT' module='{{$module}}'}:</label>
{if $fields.{{$district}}.required || {{if $district|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$district}}" id="{{$district}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$district}}.value}' {{if !empty($tabindex)}} tabindex="{{$tabindex}}" {{/if}}>
</td>
</tr>
21Âș - Save and close the file
22Âș - Change the file âen_us.EditViewâ
23Âș - Search for the line with the content
{{assign var="street" value=$displayParams.key|cat:'_address_street'}}
24Âș - Below it, place the following code
{{assign var="district" value=$displayParams.key|cat:'_address_district'}}
25Âș - Below in the file you can see that there is a table where the fields are located, choose the position where you want the district field to be and add the following code
<tr>
<td id="{{$district}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >
<label for='{{$district}}'>{sugar_translate label='LBL_ADDRESS_DISTRICT' module='{{$module}}'}:</label>
{if $fields.{{$district}}.required || {{if $district|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$district}}" id="{{$district}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$district}}.value}' {{if !empty($tabindex)}} tabindex="{{$tabindex}}" {{/if}}>
</td>
</tr>
26Âș - Save and close the file
27Âș - Change the file âDetailView.tplâ
28Âș - Search for the line with the content
<input type="hidden" class="sugar_field" id="{{$displayParams.key}}_address_street" value="{$fields.{{$displayParams.key}}_address_street.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}">
29Âș - Below it, place the following code
<input type="hidden" class="sugar_field" id="{{$displayParams.key}}_address_district" value="{$fields.{{$displayParams.key}}_address_district.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}">
30Âș - Search for the line with the content
{$fields.{{$displayParams.key}}_address_city.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
31Âș - Below it, place the following code
{$fields.{{$displayParams.key}}_address_district.value|escape:'htmlentitydecode'|escape:'html'|url2html|nl2br}
32Âș - Save and close the file
33Âș - Change the file âSugarFieldAddress.jsâ
34Âș - Search for the line with the content
SUGAR.AddressField.prototype={elems:[
35Âș - And Add in the array
,"address_district"
36Âș - Save and close the file
37Âș - Afterwards to an Admin -> Repair -> Quick Repair and Rebuild
38Âș - If you wish the sabe field to shipping adress repeat the operation changind billing to shipping
Be Happy
Thank you very much for your guidance and I will follow step by step and update you accordingly.
I have another issue that I need to solve if you donât mind; I need to reassign accounts to my users by postcode, is there a way that I can filtered by range of postcode and then assign to user by batch accordingly?
Thanks a lot and you are helpful.
I am still novice in suiteCrm so do not know if I can help you perfectly on that question.
But I think you could do the following.
1Âș - Go to Admin-> Studio
2Âș - Click on âAccountsâ
3Âș - Click on âLayoutsâ
4Âș - Click on âListviewâ
5Âș - Select the Shipping or Billing postal code field and drop in the Default
6Âș - Click in Save&Deploy
7Âș - Go To Accounts now you see the Field Postal Code in the Grid
8Âș - Click in Filter locate the Postal Code Field and put your initial post code - Here in Brazil itâs something like this 29167
9Âș - Click in search
10Âș - Now the grid only show the postal code with 29167
11Âș - click on Select All
12Âș - Mass update and make your updates there
If this help you, Be Happy
Hi, I actually did that but the filtering is only limited to one postcode, I am thinking if we can filter by range, such as from 56000 to 66000 or 56 - 66 (first 2 digit of the postcode).
I think it is not yet possible to perform interval searches on fields of type Text .
But if you have many clients, I can try to do a workaround for you, itâs not very elegant, but I think it might work.
What database do you use?
PS: Just remember, Iâm not an expert on SuiteCrm. So it might be that someone has some better solution
Hi, I have followed the steps to add District to the Account module but I observed the following, I have repeated the steps for few times.
- I cannot manage to change the Display Label name from Billing Address District to District from Studio, the name can be saved but the name will not be changed, for me to do the name change I have to change the name from âen_us.billing_address_district.phpâ.
- On the create account page, the name showing is âLBL_ADDRESS_DISTRICT:â instead of âBilling Address District:â for both Billing Address and Shipping address, even thoiugh the name fhas been changed from the âen_us.billing_address_district.phpâ (picture attached)
- âCopy address from leftâ cannot copy when using Chrome but can copy by using Firefox and Edge.
- The District doesnât show on the Detail Page" both in the billing and shipping address.
- When export the newlt created âDistrictâ is not included in the export list.
- Just for yur information, I didnât made any additional district for the shipping address, it just show after I updated the billing.
Is anyting else I can make the name change to the create account page, showin the District on the detailed page and include the District in the export list?
About the reassigned by postal code range, we have few hundred contacts need to be done, I am using MySQL database. If nothing can be done, the last resource is to export the list to make the necessary chages and import again. but that is a real time consuming task to be done, I think this has to be include in SuiteCRM since it is already a great CRM software among all.
Appreciate your helpâŠ
To correct:
The âDistrictâ is included in the export list, just didnât noticed that it is far away from the usual address column at the end.
letâs go then
About the address.
Did you take the same steps to the shiping district?
If not, you need to perform the steps
1st, 2nd, 3rd, 4th (of course, switching from billing to shipping), 5th (of course, switching from billing to shipping), 6th, 7th, 8th, 9th (of course, switching from billing to shipping), 10th Of billing to shipping), 11th, 12th. I think thatâs enough.
On the part of the label address, I will install a homologation environment here to try to help you, unfortunately I will not be able to do it in a fast way, but I promise I will do it as soon as possible.
About part of zip code, we think we can do the following
1Âș - Go to Studio -> Select Accounts -> Fields
2Âș - Add Field
3Âș - Data Type (Integer), Field Name (rangepostalcode), Max Size (9), Check (Enable Range Search), Check (Disable Format)
4Âș - Save (The system will create a field with name rangepostalcode_c)
:whistle: [color=#880088]Now come the not elegant part[/color] :whistle:
6Âș - Go To Php my Admin or other admin database you use and execute the following command
[color=#0000bb]NOTE: THE COMMAND BELOW WILL ONLY WORK IF THE FIRST 3 DIGITS OF YOUR POSTAL CODE ARE INTEGER[/color]
update accounts_cstm set
accounts_cstm.rangepostalcode_c = (SELECT
SUBSTR (accounts.billing_address_postalcode,1,3)
from accounts
where accounts_cstm.id_c = accounts.id)
7Âș - Now, Go to Studio -> Select Accounts -> Layout -> ListView
8Âș - In Hidden Drag de rangepostalcode and Drop in Default
9Âș - Click in Save & Deploy
10 - Select Accounts -> -> Layouts -> Filter -> Quick Filter
11Âș - In Hidden Drag de rangepostalcode and Drop in Default
12Âș - Click in Save & Deploy
13Âș - Now, Go to Account and you will see the rangepostalcode field in grid
14Âș - Click in Filter and in rangepostal code select Is Between
15Âș - Search Make your changes
After make your bulk changes.
16Âș - Go to Studio -> Select Accounts -> Fields
17Âș - Click rangepostalcode field
18Âș - Click in DELETE
19 - Go To Account click in filter and after search (Your Accounts will appears again)
Be Happy
Hi, great to hear from you.I have followed your steps for the billing and shipping district for Account and Contact mocules, everything is fine, but the âDistrictâ copy from left is still not workng in Chrome for Account and Contact modules, Firefox can copy but cannot pass the "District to the Detall View. I wonder what happen, I have checked many times.
For the name, I made oe changes from EditView.tpl, from {sugar_translate label=âLBL_ADDRESS_DISTRICTâ module=â{{$module}}â}: to {sugar_translate label=âDistrictâ module=â{{$module}}â}: and it works fine.
For me to make changes to Contact module, I change the name from bto primary_address_street - LBL_PRIMARY_ADDRESS_STREET and
alt_address_street - LBL_ALT_ADDRESS_STREET.
No so sure what I can do now for this.
I will try the way you show for the filtering.
Thanks again.
The District is working perfectly with Edge and Firefox, Chrome is not working with the newly added âDistrictâ field, I think this is due to chrome.
I must say thank you again for your patience and help.
Thanks a lot.
Just to update you that all browsers are 100% perfect now, it is the cache issue, after clearing it, perfect. Thanks
About postal code filter ?
Hi, I have successfully updated the District to Account and Contact modules, how can I add this into the filter as I canât filtered by District now.
Hi, any question I have gotten after adding the District to the address, the Geocode now is not working better than before adding the district and I suspect it is due to the arrangement of the address, may I know how to rearrange the the address sequence for cache the address?