Announcement

Collapse
No announcement yet.

RealEstate - name field is street address

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RealEstate - name field is street address

    hi
    in the real estate extension, the name of a Property is the first address line

    where is this stated in the entity settings?
    how to change the name of the Property (top of the page) for a new field (ex: buildingName)?

    thanks
    Last edited by punkyard; 04-26-2021, 08:54 PM.

  • #2
    I don't think too many people use the Real Estate extensions so you might have to figure this one out on your own by looking into the code. It not possible to do this through the GUI/admin.

    The "Name" field used the following field:
    Street Address, City

    I use this extensions too but never look into changing it with code, the only thing I added was "Duplicate check" so I don't create two same address

    Comment


    • punkyard
      punkyard commented
      Editing a comment
      thanks espcrm
      alas, there is no documentation on this extension, though the user experience of this extension could benefit from a extensive tutorial/documentation, I recon.

    • espcrm
      espcrm commented
      Editing a comment
      Yes, unfortunately it. I wrote what I can (scatter through various post) on the extensions. But if it anything too complex in term of coding I have to shy away from trying it. I break the CRM too many time and panicked.

    • punkyard
      punkyard commented
      Editing a comment
      well .. that's a good recall to 'back up back up back up' ^^

  • #3
    if anyone can help, my questions would be :

    1 - could it be possible to display a custom format option panel for the automatic nomination format of the RealEstateRequest Name field (R 000001)?
    this could be useful to companies with their own formatting

    how to play with? : (adding the date for example?)

    if ($entity->isNew() && !$entity->get('name')) {

    $e = $this->get($entity->id);
    $name = strval($e->get('number'));
    $name = str_pad($name, 6, '0', STR_PAD_LEFT);
    $name = 'R' . $name;

    $e->set('name', $name);
    $this->save($e);
    $entity->set('name', $name);
    $entity->set('number', $e->get('number'));

    Though, It is possible to uncheck the "read only" option in the entity manager, and type your own.

    Comment


    • #4
      2 - How to give a custom name to the Properties?
      I looked in /application/Espo/Modules/RealEstate/repositories/RealEstateProperty.php :
      but i'm afraid to mess around in the whole entity :

      {
      $propertyType = $entity->get('type');
      $fieldList = $this->getMetadata()->get(['entityDefs', 'RealEstateProperty', 'propertyTypes', $propertyType, 'fieldList'], []);
      $fieldDefs = $this->getMetadata()->get(['entityDefs', 'RealEstateProperty', 'fields'], []);
      foreach ($fieldDefs as $field => $defs) {
      if (empty($defs['isMatching'])) continue;
      if (!in_array($field, $fieldList)) {
      $entity->set($field, null);
      }
      }
      $name = '';
      if ($entity->get('addressStreet') || $entity->get('addressCity')) {
      if ($entity->get('addressStreet')) {
      $name .= str_replace("\n", ', ', $entity->get('addressStreet'));
      }
      if ($entity->get('addressCity')) {
      if ($name != '') {
      $name .= ", ";
      }
      $name .= $entity->get('addressCity');
      }
      } else {
      $name = "unknown-address";
      }
      $entity->set('name', $name);
      return parent::beforeSave($entity, $options);
      }

      could I turn it into this: ? (without messing around with something else) :

      $name = $entity->get('name');

      $entity->set('name', $name);


      + I added the 'name' field into the layouts in order to give a data to that field ^^

      Thanks a lot
      Last edited by punkyard; 04-26-2021, 08:51 PM.

      Comment

      Working...
      X