Duplicate checking

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • livewire
    Senior Member
    • Nov 2016
    • 100

    Duplicate checking

    Hi

    Can someone let me know how the duplicate check works on Espocrm?

    Also when i try to import a csv and even the duplicate check is enabled, it imports all the records although some phone numbers and email addresses are in the crm. The duplicate check doesnt seem to be working properly.

    also how to i add a phone number for duplicate check?
  • item
    Active Community Member
    • Mar 2017
    • 1489

    #2
    Hello,

    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2206

      #3
      I tried to create a duplicate check but fail, as a test I just copy and paste both code in documentation, rebuild and getting a Error 500. It seem like I also create a "Class" as well? Which the documents don't really explain further into that.

      Any can point in a direction?

      Trying to create a duplication checker for the RealEstate extensions. The error is quite long but I take it the vital part is what causing it not to work:

      Code:
      Espo.ERROR: Slim Application Error Type: Error Code: 0 Message: Class 'Espo\Modules\Crm\Services\RealEstateProperty' not found File: /home/user/domains/espocrm.com/public_html/crm/custom/Espo/Custom/Services/RealEstateProperty.php

      The code in documents say this

      Code:
      class Lead extends \Espo\Modules\Crm\Services\Lead
      Which seem to reference the file at: "\Application\Espo\Modules\Crm\Services\Lead.p hp" which is an existing file, how what would I need to do for non-existing file?
      Last edited by esforim; 03-01-2021, 07:51 AM.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Hi,
        If you are trying to achieve it for the Real Estate Property you have to extend it from Espo\Modules\RealEstate\Services\RealEstatePropert y. E.g.:
        PHP Code:
        class RealEstateProperty extends \Espo\Modules\RealEstate\Services\RealEstateProperty 
        

        Comment


        • joshdoyle56
          joshdoyle56 commented
          Editing a comment
          Hi I want to Know more about detail Espo Module for real estate?

        • Maximus
          Maximus commented
          Editing a comment
          Hi @joshdoyle56.
          What actually do you want to know?

        • esforim
          esforim commented
          Editing a comment
          Wouldn't it be best to ask about it in the Extensions itself thread or create another thread josh? I doubt many people can help you in a thread about Duplicate Checking
      • esforim
        Active Community Member
        • Jan 2020
        • 2206

        #5
        EDIT: 2023 NO LONGER WORK. See Link below for v7+. This post is applicable to v6 only (I think)

        CODE for 2023 working as follow: https://github.com/o-data/EspoCRM_Mo...r%20RealEstate


        Thank you so much Maximus! It worked. So the secret I guess, it need to find to the Modules (extensions?)

        ---

        Now to figure out the checking mechanism. Don't quite understand the email section so I just removed. Here is the final code for anyone who would just like to copy/paste a duplicate checker for RealEstateProperty free extension.

        All it check is the Street Name and City. I didn't change anything complex except remove the Email checking part from the code example. Follow the documents example to find out where you need to upload/create the PHP file.

        Code:
        <?php
        
        namespace Espo\Custom\Services;
        
        use Espo\ORM\Entity;
        
        class RealEstateProperty extends \Espo\Modules\RealEstate\Services\RealEstateProperty
        {
        protected $checkForDuplicatesInUpdate = false; // set true to enable for update
        
        // copied original method
        protected function getDuplicateWhereClause(Entity $entity, $data)
        {
        $whereClause = [
        'OR' => []
        ];
        $toCheck = false;
        if ($entity->get('addressStreet') || $entity->get('addressCity')) {
        $part = [];
        $part['addressStreet'] = $entity->get('addressStreet');
        $part['addressCity'] = $entity->get('addressCity');
        $whereClause['OR'][] = $part;
        $toCheck = true;
        }
        return $whereClause;
        }
        }
        Last edited by esforim; 03-22-2023, 07:13 AM.

        Comment

        Working...