Address Format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iscon
    Active Community Member
    • May 2014
    • 187

    Address Format

    I changed

    /client/src/views/fields/address.js and
    /client/res/templates/fields/address/edit.tpl

    in order to edit/show addresses in the correct format for Germany/Austria/Switzerland. How can this be made upgrade safe?
    ------------------
    Robert Laussegger
    iscon group
    http://www.iscongroup.net
    mailto://info@iscongroup.net
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Create:

    1. custom/Espo/Custom/Resources/metadata/fields/address.json
    PHP Code:
    {
       "view": "custom:views/fields/address"
    } 
    

    2. client/custom/src/views/fields/address.js
    PHP Code:
    Espo.define('custom:views/fields/address', 'views/fields/address', function (Dep) {
      return Dep.extend({
         editTemplate: 'custom:fields/address/edit'
      });
    }); 
    

    3. Create client/custom/res/templates/fields/address/edit.tpl

    I didn't test but I believe everything is correct.

    BTW in 3.7.0 address string for detail view is generated in javascript function.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • c.binder
      Junior Member
      • Apr 2016
      • 5

      #3
      I did all the changes mentioned above and detected that this affects the billing address but didn't change the shipping address.

      There is a file (client/modules/crm/src/views/account/fields/shipping-address.js) that adds the button "Copy from Billing Address" to the view and it's based on Views.Fields.Address (but not on the custom view).

      Therefore, how to change this (upgrade safe) so that the shipping address is based on the custom view?

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        You can make shipping address to look to custom.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • c.binder
          Junior Member
          • Apr 2016
          • 5

          #5
          Do you suggest to change the file client/modules/crm/src/views/account/fields/shipping-address.js?

          Originally:
          Code:
          ...
          Espo.define('Crm:Views.Account.Fields.ShippingAddress', 'Views.Fields.Address', function (Dep) {
          ...
          Changed:
          Code:
          ...
          Espo.define('Crm:Views.Account.Fields.ShippingAddress', '[B]Custom:[/B]Views.Fields.Address', function (Dep) {
          ...
          This works but I guess that with one of the next patches this change might be overwritten, right?

          Would be great if you can provide the information where to put this to be upgrade safe...
          Last edited by c.binder; 04-12-2016, 09:59 AM.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            You can specify custom view name in entityDefs and then create view class in custom directory that will inherit existing view class.
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • c.binder
              Junior Member
              • Apr 2016
              • 5

              #7
              Thanks for your support - now it's working as expected!

              Comment

              Working...