Address layout modification

Iā€™m trying to change the order of the address field lines for Accounts. Specifically the Postalcode I would like after the city in both edit and detail views. Previous posts have always pointed to customising the include/sugarfields/fields/address/ā€¦ , but when I view these files (editview.tpl & detailview.tpl), the postalcode comes after the city. Why then does this not reflect in the views.

Can anyone please point me to where this can be modified?

Thanks
Terry

Where do you see them? I mean, which module, which view, which screen, which button do you press to see them on the screen in the wrong order?

Can you please check same for at include/sugarfields/fields/address for file ā€œen_us.EditView.tplā€ and ā€œen_us.DetailView.tplā€

Hi pgr, I have installed a fresh instance of 8.1.3 with the sample data to make sure it wasnā€™t something to do with my working instance. I have not made any alterations.

Everywhere the billing address or shipping address or primary address or alternative address displays, both in detail and edit views of accounts and contacts and leads modules, the postalcode field appears before the city. I believe the same piece of code (somewhere) is responsible for ordering the address lines in this order for billing, shipping, primary and alternative address blocks.

I have searched for hours to see where this is coded, but without success. It doesnā€™t appear to be in the editview.tpl, detailview.tpl, en_us.EditView.tpl, en_us.detailView.tpl, as these files have the postalcode field in the correct order from what I can see.

I am relatively new to SuiteCRM and probably missing something very obvious. Any help is very much appreciated.

Regards
Terry

Thanks urdhvatech, yes I checked those. Please see my answer to pgr.
Regards
Terry

Aah, You are asking about the Suite 8.1.*

If you wish to change Address sequence, You need to edit group field definition to change sequence at
config/services/record/fields/grouped_fields_type_map.yaml

After changing this you need to do Admin->Repair->Quick Repair and Rebuild
Yet, I am not sure about upgrade safe change.

2 Likes

Good morning urdhvatech, I altered the grouped_fields_type_map.yaml, did a quick repair, but there was no change. Argh!

So I started another search for ā€˜postalcodeā€™ and the very first hit wasā€¦ line 4005 in

/htdocs/Suite8/cache/prod/ContainerJXnEIcc/App_KernelProdContainer.php

I altered this file at lines 4005 from ;

           'address' => [
                'layout' => [
                   0 => 'street',
                   1 => 'postalcode',
                   2 => 'city',
                  3 => 'state',
                    4 => 'country',
              ],

to

           'address' => [
                'layout' => [
                   0 => 'street',
                   1 => 'city',
                   2 => 'postalcode',
                  3 => 'state',
                    4 => 'country',
              ],

and it immediately changed at all instances of addresses without a quick repair. That is in Accounts, contacts and leads, wherever there is an ā€˜address blockā€™.

After a little more investigation, it appears this file is created in part from grouped_fields_type_map.yaml if it does not exist. So the App_KernelProdContainer.php file either needs to be deleted or altered as I have done (to match the yaml alteration).

Developer Mode does not seem to delete this file with a quick repair.

Thank you urdhvatech, I donā€™t think I would have found this without your help.

Regards
Terry

SuiteCRM 8.1.3 on MAMP with PHP7.4.21

OK, so having resolved the postalcode move to after city in ā€˜Grouped Addressesā€™ , the next step Iā€™d like to achieve is adding a ā€˜Suburbā€™ field/line between street and city for all grouped addresses, because thatā€™s what we use down here in this part of the world.

So I thought Iā€™d start with just the billing address in the Accounts Module. I followed much of Add district into address by cloudcon.
Also added in ā€˜suburbā€™ in the grouped_fields_type_map.yaml. Did all the usual Admin ā†’ Repair ā†’ Quick Repair and Rebuilds. Made sure the cache was deleted.

Result:
I have the the extra field in the database, I can show it in listview of Accounts, but (after a full day of tinkering) I cannot get it to show in the Billings grouped address on Accounts. Not in Detail View or Edit View.

I would really appreciate any help here please.

Regards
Terry

Maybe this should be a new topic???

I am glad that it worked for you. Yes, separate topic will help others as well.

I suspect the missing step to update things without manually clearing cache files might be the ng command-line to generate the Angular front-end

Can you please mark this thread as solved?

Hi pgr, can you explain this further please. I am no expert on Angular. Are you saying that there is a command I should use to solve this problem?

I am not that expert, but If you wish to clear cache form backend. You can use the command like this.
./bin/console cache:clear

I also donā€™t know much about Angular.

Itā€™s just then you mentioned the file you needed to change was in a cacheā€¦:

ā€¦ I suspect that that was a generated file and that somewhere there is:

  1. An ā€œearilerā€ file from which that one was built, which is where you really should be changing things
  2. Some process to cause the generation to take place

Number 2 was the Quick Repair and Rebuild in the legacy SuiteCRM 7, now itā€™s still the QR&R but also adds some front-end generation.

Thanks pgr & urdhvatech for clearing that up. Your help is appreciated.