No announcement yet.

Extend Real Estate Request functionality

  • Filter
  • Time
  • Show
Clear All
new posts

  • Extend Real Estate Request functionality


    I would like to extend RealEstateRequest entity functionality in order to better suit my needs.

    What I'm trying to achieve is having additional criterias in property requests, i.e. boolean and enum fields that match with the properties in our database.

    From my researches in this forum, the only way to add this kind of functionality is through coding, but I have not found any tutorial or code snippets to help me with the editing.

    Could someone please help me? I'm new to EspoCRM, but I'm really keen on learning and even some little indication to get me on the right track would be greatly appreciated.


    Server setup (not sure if needed):
    EspoCRM 5.0.5
    Real Estate extension 1.2.1
    PHP 7.1.14

  • #2
    application/Espo/Modules/RealEstate/Services RealEstateProperty.php and RealEstateRequest.php findLinkedEntitiesMatching* methods
    override it in custom folder
    (an example with other method)


    • #3
      Thank you for your kind help Tanya!
      Also, sorry for the late reply, but I have been off the internet for some time.

      I managed to add boolean criterias to Requests (eg: ticking Air Conditioning shows only the properties with such feature), and everything is working flawlessly. An example of the code I added to /custom/Espo/Custom/Modules/RealEstate/Services/RealEstateRequest.php is:
      //inside findLinkedEntitiesMatchingProperties method
      if ($entity->get('airConditioning') !== null) {
                  $selectParams['whereClause']['airConditioning>='] = $entity->get('airConditioning');
      However, I could not understand how to add Request criterias with enum fields to findLinkedEntitiesMatchingProperties (eg: selecting an item from an enum field would only show properties with the exact same item selected). Do you have any example implementation of this feature?

      One last question: I am not sure how or what shoud I edit inside findLinkedEntitiesMatchingRequests method in RealEstateProperty.php.

      Thank you very much for your time and patience.


      • #4
        in enum field contains the key of option (not the translation)

        $selectParams['whereClause']['status!='] = array('Duplicate', 'Rejected', 'Closed'); // status NOT IN ('Duplicate', 'Rejected', 'Closed')
        $selectParams['whereClause']['status'] = array( 'Closed'); // status IN ('Closed')
        $selectParams['whereClause']['status'] = 'Closed'; // status = 'Closed'

        $selectParams['whereClause']['type'] = array( $entity->get('type'));


        • #5

          I'm sorry but Requests now seem to ignore the custom code I added to /custom/Espo/Custom/Modules/RealEstate/Services/RealEstateRequest.php.
          I tried resetting Request entity and layout, rebuilding and clearing browser cache (Espo cache is disabled in admin settings) but the custom code is still ignored (file permissions are correct). EspoCRM and Real Estate extension are up to date.

          I attached a screenshot of RealEstateRequest.php to help you better understand the issue.

          Could you please help me solve this problem?
          Many many thanks.

          EspoCRM 5.0.5
          Real Estate extension 1.2.1
          PHP 7.1.14

          Edit: when I add my custom code to /application/Espo/Modules/RealEstate/Services everything is fine.
          Have a nice weekend you all!
          Last edited by agenzialife; 03-03-2018, 09:10 AM.


          • #6
            the correct path is /custom/Espo/Custom/Services/RealEstateRequest.php.